apps/web/app/auth/operator/page.tsx
Metadata
- Purpose: Web app route or page component for operator/client experience.
- Domain:
applications - Language:
tsx - Bytes: 4792
- Lines: 98
- Content hash (short):
2e81f8e3 - Source (start): apps/web/app/auth/operator/page.tsx:1
- Source (end): apps/web/app/auth/operator/page.tsx:98
Indexed Symbols
firstValue(line 10, function) - Implements first value for module behavior.
Markdown Headings (if applicable)
No markdown headings detected.
Source Preview
import { TopNav } from "../../../components/top-nav";
import { readOperatorSession } from "../../../lib/operator-session";
import { type SearchParamRecord, workspaceIdFromSearchParams, withWorkspaceQuery } from "../../../lib/workspace-context";
import { operatorSessionSignInAction, operatorSessionSignOutAction } from "./actions";
type OperatorAuthPageProps = {
searchParams?: Promise<SearchParamRecord>;
};
function firstValue(value: string | string[] | undefined): string {
if (Array.isArray(value)) {
return typeof value[0] === "string" ? value[0] : "";
}
return typeof value === "string" ? value : "";
}
export default async function OperatorAuthPage({ searchParams }: OperatorAuthPageProps) {
const resolvedSearchParams = (await searchParams) ?? {};
const workspaceId = workspaceIdFromSearchParams(resolvedSearchParams);
const returnTo = firstValue(resolvedSearchParams.returnTo) || (workspaceId ? withWorkspaceQuery("/", workspaceId) : "/");
const errorMessage = firstValue(resolvedSearchParams.error);
const session = await readOperatorSession();
return (