Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: efficient dashboard #131

Merged
merged 15 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 91 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"prepare": "husky"
},
"dependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.1.3",
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
"@axa-fr/react-oidc": "^7.21.0",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
Expand All @@ -22,6 +25,7 @@
"@types/react": "18.2.48",
"@types/react-dom": "18.2.25",
"autoprefixer": "10.4.19",
"jsoncrush": "^1.1.8",
"next": "^14.1.4",
"postcss": "8.4.38",
"react": "^18.2.0",
Expand Down
File renamed without changes.
39 changes: 39 additions & 0 deletions src/app/(dashboard)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"use client";
import * as React from "react";
import CssBaseline from "@mui/material/CssBaseline";
import { Box } from "@mui/material";
import { ThemeProvider as MUIThemeProvider } from "@mui/material/styles";
import { useMUITheme } from "@/hooks/theme";
import Dashboard from "@/components/layout/Dashboard";
import ApplicationsProvider from "@/contexts/ApplicationsProvider";
import { OIDCSecure } from "@/components/layout/OIDCSecure";

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

return (
<section>
<ApplicationsProvider>
<OIDCSecure>
<Dashboard>
<MUIThemeProvider theme={theme}>
<CssBaseline />
<Box
sx={{
ml: "5%",
mr: "5%",
}}
>
{children}
</Box>
</MUIThemeProvider>
</Dashboard>
</OIDCSecure>
</ApplicationsProvider>
</section>
);
}
25 changes: 25 additions & 0 deletions src/app/(dashboard)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use client";
import React from "react";
import { useSearchParams } from "next/navigation";
import UserDashboard from "@/components/applications/UserDashboard";
import { ApplicationsContext } from "@/contexts/ApplicationsProvider";
import { applicationList } from "@/components/applications/ApplicationList";

export default function Page() {
const searchParams = useSearchParams();
const appId = searchParams.get("appId");
const [sections] = React.useContext(ApplicationsContext);

const appType = React.useMemo(() => {
const section = sections.find((section) =>
section.items.some((item) => item.id === appId),
);
return section?.items.find((item) => item.id === appId)?.type;
}, [sections, appId]);

const Component = React.useMemo(() => {
return applicationList.find((app) => app.name === appType)?.component;
}, [appType]);

return Component ? <Component /> : <UserDashboard />;
}
22 changes: 0 additions & 22 deletions src/app/jobmonitor/error.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions src/app/jobmonitor/layout.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions src/app/jobmonitor/page.tsx

This file was deleted.

Loading