feat: productionize learning engine and classroom

This commit is contained in:
inman
2026-08-16 21:44:52 +08:00
parent 2d04197f3f
commit ba35adfbfa
124 changed files with 9071 additions and 796 deletions

View File

@@ -5,6 +5,7 @@ import { AccessCodeModal } from '@/components/access-code-modal';
import { useSettingsStore } from '@/lib/store/settings';
export function AccessCodeGuard({ children }: { children: ReactNode }) {
const isOpsDeployment = process.env.NEXT_PUBLIC_OPENMAIC_DEPLOYMENT_ROLE === 'ops';
const [status, setStatus] = useState<{
enabled: boolean;
authenticated: boolean;
@@ -12,6 +13,10 @@ export function AccessCodeGuard({ children }: { children: ReactNode }) {
}>({ enabled: false, authenticated: false, loading: true });
useEffect(() => {
if (isOpsDeployment || new URLSearchParams(window.location.search).get('embedded') === '1') {
setStatus({ enabled: false, authenticated: true, loading: false });
return;
}
let cancelled = false;
fetch('/api/access-code/status')
.then((res) => res.json())
@@ -33,7 +38,7 @@ export function AccessCodeGuard({ children }: { children: ReactNode }) {
return () => {
cancelled = true;
};
}, []);
}, [isOpsDeployment]);
const needsAuth = !status.loading && status.enabled && !status.authenticated;