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 14 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.
aldbr marked this conversation as resolved.
Show resolved Hide resolved
File renamed without changes.
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 JobMonitorLayout({
Loxeris marked this conversation as resolved.
Show resolved Hide resolved
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>
);
}
21 changes: 21 additions & 0 deletions src/app/(dashboard)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"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 = sections
.find((section) => section.items.some((item) => item.id === appId))
?.items.find((item) => item.id === appId)?.type;
aldbr marked this conversation as resolved.
Show resolved Hide resolved

const Component = applicationList.find((app) => app.name === appType)
?.component;
aldbr marked this conversation as resolved.
Show resolved Hide resolved

return Component ? <Component /> : <UserDashboard />;
}
6 changes: 1 addition & 5 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Inter } from "next/font/google";
import { OIDCConfigurationProvider } from "@/contexts/OIDCConfigurationProvider";
import { ThemeProvider } from "@/contexts/ThemeProvider";
import Dashboard from "@/components/layout/Dashboard";
import { OIDCSecure } from "@/components/layout/OIDCSecure";

const inter = Inter({ subsets: ["latin"] });

Expand All @@ -24,9 +22,7 @@ export default function RootLayout({
<html lang="en">
<body className={inter.className}>
<OIDCConfigurationProvider>
<ThemeProvider>
<OIDCSecure>{children}</OIDCSecure>
</ThemeProvider>
<ThemeProvider>{children}</ThemeProvider>
</OIDCConfigurationProvider>
</body>
</html>
Expand Down
5 changes: 0 additions & 5 deletions src/app/page.tsx

This file was deleted.

17 changes: 17 additions & 0 deletions src/components/applications/ApplicationList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Dashboard, FolderCopy, Monitor } from "@mui/icons-material";
import JobMonitor from "./JobMonitor";
import UserDashboard from "./UserDashboard";

export const applicationList = [
aldbr marked this conversation as resolved.
Show resolved Hide resolved
{ name: "Dashboard", component: UserDashboard, icon: Dashboard },
{
name: "Job Monitor",
component: JobMonitor,
icon: Monitor,
},
{
name: "File Catalog",
component: JobMonitor,
icon: FolderCopy,
},
];
Loading