mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
change semantics
Update README deployment steps and add deploy:secrets script to package.json update local inference script and README update lockfile reconfigure package scripts for development update test execution pass server tests Update README with revised Bun commands and workspace details remove pnpm package manager designator create bun server
This commit is contained in:

committed by
Geoff Seemueller

parent
1055cda2f1
commit
497eb22ad8
52
packages/client/src/layout/Layout.tsx
Normal file
52
packages/client/src/layout/Layout.tsx
Normal file
@@ -0,0 +1,52 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { PageContextProvider } from "../renderer/usePageContext";
|
||||
import { MobileProvider } from "../components/contexts/MobileContext";
|
||||
import LayoutComponent from "./LayoutComponent";
|
||||
import userOptionsStore from "../stores/UserOptionsStore";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { Chakra } from "../components/contexts/ChakraContext";
|
||||
import { getTheme } from "./theme/color-themes";
|
||||
|
||||
export { Layout };
|
||||
|
||||
const Layout = observer(({ pageContext, children }) => {
|
||||
const [activeTheme, setActiveTheme] = useState<string>("darknight");
|
||||
|
||||
useEffect(() => {
|
||||
if (userOptionsStore.theme !== activeTheme) {
|
||||
setActiveTheme(userOptionsStore.theme);
|
||||
}
|
||||
}, [userOptionsStore.theme]);
|
||||
|
||||
try {
|
||||
if (pageContext?.headersOriginal) {
|
||||
const headers = new Headers(pageContext.headersOriginal);
|
||||
|
||||
const cookies = headers.get("cookie");
|
||||
|
||||
const userPreferencesCookie = cookies
|
||||
?.split("; ")
|
||||
.find((row) => row.startsWith("user_preferences="))
|
||||
?.split("=")[1];
|
||||
|
||||
try {
|
||||
const { theme: receivedTheme } = JSON.parse(
|
||||
atob(userPreferencesCookie ?? "{}"),
|
||||
);
|
||||
setActiveTheme(receivedTheme);
|
||||
} catch (e) {}
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
return (
|
||||
<React.StrictMode>
|
||||
<PageContextProvider pageContext={pageContext}>
|
||||
<MobileProvider>
|
||||
<Chakra theme={getTheme(activeTheme)}>
|
||||
<LayoutComponent>{children}</LayoutComponent>
|
||||
</Chakra>
|
||||
</MobileProvider>
|
||||
</PageContextProvider>
|
||||
</React.StrictMode>
|
||||
);
|
||||
});
|
Reference in New Issue
Block a user