50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import type { Metadata, Viewport } from "next";
|
|
import { Suspense } from "react";
|
|
import "./globals.css";
|
|
import { AppLogBridge, NativeAppBridge } from "@/components/app-runtime";
|
|
import { getCurrentPageSession } from "@/lib/boss-auth";
|
|
import { getPreferredDeviceIdForAccountFromState, readState } from "@/lib/boss-data";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Boss 控制台",
|
|
description: "多设备 Codex 协作控制台 MVP",
|
|
};
|
|
|
|
export const viewport: Viewport = {
|
|
width: "device-width",
|
|
initialScale: 1,
|
|
maximumScale: 1,
|
|
userScalable: false,
|
|
themeColor: "#eef2eb",
|
|
viewportFit: "cover",
|
|
};
|
|
|
|
export default async function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
const session = await getCurrentPageSession();
|
|
const state = session ? await readState() : null;
|
|
const boundDeviceId =
|
|
session && state
|
|
? getPreferredDeviceIdForAccountFromState(
|
|
state,
|
|
session.account,
|
|
state.user.boundDeviceId,
|
|
)
|
|
: undefined;
|
|
|
|
return (
|
|
<html lang="zh-CN">
|
|
<body data-bound-device-id={boundDeviceId ?? ""}>
|
|
<Suspense fallback={null}>
|
|
<NativeAppBridge />
|
|
</Suspense>
|
|
<AppLogBridge deviceId={boundDeviceId} />
|
|
{children}
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|