cleanup work
This commit is contained in:
parent
6312f47545
commit
5483018783
@ -20,7 +20,6 @@ import { darkTheme, lightTheme } from "./theme/themes";
|
||||
|
||||
import Background from "@/components/background";
|
||||
import { AppContext, WithAppState } from "@/components/hooks/useAppContext";
|
||||
// import { usePathname, redirect } from "next/navigation";
|
||||
|
||||
const roboto = localFont({
|
||||
src: [
|
||||
@ -37,17 +36,6 @@ axios.defaults.baseURL = "http://localhost:2979";
|
||||
// add negative margin for smooth transition to fill the space of the sidebar
|
||||
const translate = tw`lg:-ml-64 -ml-14`;
|
||||
|
||||
// const AutoRedirectEffect = () => {
|
||||
// const { isLoading, data } = useAppState();
|
||||
// const pathname = usePathname();
|
||||
// React.useEffect(() => {
|
||||
// if (!isLoading && !data.isJoined && pathname !== "/") {
|
||||
// redirect("/");
|
||||
// }
|
||||
// }, [isLoading, data, pathname]);
|
||||
// return <></>;
|
||||
// };
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
@ -55,38 +43,15 @@ export default function RootLayout({
|
||||
}) {
|
||||
const userPrefersDarkmode = useMediaQuery("(prefers-color-scheme: dark)");
|
||||
|
||||
// const theme = useTheme({});
|
||||
// const is_small = useMediaQuery(theme.breakpoints.down("sm"));
|
||||
// const [useDarkTheme, setUseDarkTheme] = useState(false);
|
||||
const [showSidebar, setShowSidebar] = React.useState(true);
|
||||
|
||||
// If the screen is small, hide the sidebar
|
||||
// useEffect(() => {
|
||||
// if (is_small) {
|
||||
// setShowSidebar(false);
|
||||
// } else {
|
||||
// setShowSidebar(true);
|
||||
// }
|
||||
// }, [is_small]);
|
||||
|
||||
// useEffect(() => {
|
||||
// if (useDarkTheme !== userPrefersDarkmode) {
|
||||
// // Enable dark theme if the user prefers dark mode
|
||||
// setUseDarkTheme(userPrefersDarkmode);
|
||||
// }
|
||||
// }, [userPrefersDarkmode, useDarkTheme, setUseDarkTheme]);
|
||||
|
||||
// const changeThemeHandler = (target: ChangeEvent, currentValue: boolean) => {
|
||||
// setUseDarkTheme(currentValue);
|
||||
// };
|
||||
|
||||
return (
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Clan.lol</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Clan.lol - build your own network" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<link rel="icon" href="favicon.ico" sizes="any" />
|
||||
</head>
|
||||
<StyledEngineProvider injectFirst>
|
||||
<ThemeProvider theme={userPrefersDarkmode ? darkTheme : lightTheme}>
|
||||
@ -141,7 +106,6 @@ export default function RootLayout({
|
||||
<div className="px-1">
|
||||
<div className="relative flex h-full flex-1 flex-col">
|
||||
<main>
|
||||
{/* <AutoRedirectEffect /> */}
|
||||
<Button
|
||||
fullWidth
|
||||
onClick={() => {
|
||||
|
5
pkgs/ui/src/app/machines/layout.tsx
Normal file
5
pkgs/ui/src/app/machines/layout.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
import { MachineContextProvider } from "@/components/hooks/useMachines";
|
||||
|
||||
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||
return <MachineContextProvider>{children}</MachineContextProvider>;
|
||||
}
|
@ -6,7 +6,6 @@ import { Notifications } from "@/components/dashboard/notifications";
|
||||
import { QuickActions } from "@/components/dashboard/quickActions";
|
||||
import { TaskQueue } from "@/components/dashboard/taskQueue";
|
||||
import { useAppState } from "@/components/hooks/useAppContext";
|
||||
import { MachineContextProvider } from "@/components/hooks/useMachines";
|
||||
import { LoadingOverlay } from "@/components/join/loadingOverlay";
|
||||
import JoinPrequel from "@/views/joinPrequel";
|
||||
|
||||
@ -55,24 +54,22 @@ export default function Dashboard() {
|
||||
}
|
||||
if (data.isJoined) {
|
||||
return (
|
||||
<MachineContextProvider>
|
||||
<div className="flex w-full">
|
||||
<div className="grid w-full grid-flow-row grid-cols-3 gap-4">
|
||||
<div className="row-span-2">
|
||||
<NetworkOverview />
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<AppOverview />
|
||||
</div>
|
||||
<div className="row-span-2">
|
||||
<RecentActivity />
|
||||
</div>
|
||||
<QuickActions />
|
||||
<Notifications />
|
||||
<TaskQueue />
|
||||
<div className="flex w-full">
|
||||
<div className="grid w-full grid-flow-row grid-cols-3 gap-4">
|
||||
<div className="row-span-2">
|
||||
<NetworkOverview />
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<AppOverview />
|
||||
</div>
|
||||
<div className="row-span-2">
|
||||
<RecentActivity />
|
||||
</div>
|
||||
<QuickActions />
|
||||
<Notifications />
|
||||
<TaskQueue />
|
||||
</div>
|
||||
</MachineContextProvider>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user