2026-01-20 09:02:26 -06:00

55 lines
1.2 KiB
TypeScript
Executable File

// _app.tsx
import { define, type PageProps } from "../utils.ts";
import WelcomeBar from "../islands/WelcomeBar/WelcomeBar.tsx";
import { createPublicId } from "../helpers.ts";
import { SessionCookie } from "./auth/callback.ts";
export default define.page(async function App(props: PageProps) {
const {
Component,
data,
error,
info,
isPartial,
params,
req,
state,
url,
route,
} = props;
const stateData: SessionCookie = state.data ??
{
started_on: 0,
user_name: "",
user_id: "",
role: "",
user_encrypted: false,
};
const publicId = stateData.user_id
? await createPublicId(stateData.user_id)
: "";
return (
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cyber Hybrid Hub</title>
</head>
<body>
<WelcomeBar
publicId={publicId}
user_name={stateData.user_name}
currentRoute={url.pathname}
isEncrypted={stateData.user_encrypted}
stateId={state.stateId}
/>
<div style={{ marginTop: "50px" }}>
<Component />
</div>
</body>
</html>
);
});