Skip to content

Commit

Permalink
feat: change pages structure to avoid dashboard menu refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
Loxeris committed Apr 24, 2024
1 parent 6c03fee commit e80c73f
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 38 deletions.
File renamed without changes.
2 changes: 0 additions & 2 deletions src/app/(dashboard)/jobmonitor/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from "react";

export default function JobMonitorLayout({
children,
}: {
Expand Down
File renamed without changes.
33 changes: 33 additions & 0 deletions src/app/(dashboard)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"use client";
import * as React from "react";
import CssBaseline from "@mui/material/CssBaseline";
import { Box } from "@mui/material";
import { useMUITheme } from "@/hooks/theme";
import { ThemeProvider as MUIThemeProvider } from "@mui/material/styles";
import Dashboard from "@/components/layout/Dashboard";

export default function JobMonitorLayout({
children,
}: {
children: React.ReactNode;
}) {
const theme = useMUITheme();

return (
<section>
<Dashboard>
<MUIThemeProvider theme={theme}>
<CssBaseline />
<Box
sx={{
ml: "5%",
mr: "5%",
}}
>
{children}
</Box>
</MUIThemeProvider>
</Dashboard>
</section>
);
}
File renamed without changes.
7 changes: 0 additions & 7 deletions src/app/jobmonitor/layout.tsx

This file was deleted.

18 changes: 4 additions & 14 deletions src/components/applications/JobMonitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,9 @@ export default function JobMonitor() {
const theme = useMUITheme();

return (
<Dashboard>
<MUIThemeProvider theme={theme}>
<CssBaseline />
<Box
sx={{
ml: "5%",
mr: "5%",
}}
>
<h2>Job Monitor</h2>
<JobDataTable />
</Box>
</MUIThemeProvider>
</Dashboard>
<div>
<h2>Job Monitor</h2>
<JobDataTable />
</div>
);
}
19 changes: 4 additions & 15 deletions src/components/applications/UserDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { useMUITheme } from "@/hooks/theme";
* @returns User Dashboard content
*/
export default function UserDashboard() {
const theme = useMUITheme();
const { configuration } = useOIDCContext();
const { accessTokenPayload } = useOidcAccessToken(configuration?.scope);

Expand All @@ -22,20 +21,10 @@ export default function UserDashboard() {
}

return (
<Dashboard>
<MUIThemeProvider theme={theme}>
<CssBaseline />
<Box
sx={{
ml: "5%",
mr: "5%",
}}
>
<h2>Hello {accessTokenPayload["preferred_username"]}</h2>
<div>
<h2>Hello {accessTokenPayload["preferred_username"]}</h2>

<p>To start with, select an application in the side bar</p>
</Box>
</MUIThemeProvider>
</Dashboard>
<p>To start with, select an application in the side bar</p>
</div>
);
}

0 comments on commit e80c73f

Please sign in to comment.