dashboard feature to use dashboard data

This commit is contained in:
2026-04-24 14:41:19 +05:30
parent 1fe44abfde
commit 922d05ae37
6 changed files with 96 additions and 121 deletions

View File

@@ -21,18 +21,30 @@ import Header from './Header';
import Footer from './Footer';
import AppTheme from './AppTheme';
// Polyfill Node.js globals for browser environment (needed by SwaggerParser)
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
window.Buffer = Buffer;
window.process = process;
const rootElement = document.getElementById('root');
const root = createRoot(rootElement);
const API_BASE = import.meta.env.VITE_API_BASE_URL;
const AUTH_BASE = import.meta.env.VITE_AUTH_BASE_URL;
// Initialize global API clients so all components across khata-ui have generic API access
initializeApiClients(API_BASE, AUTH_BASE);
const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 5 * 60 * 1000,
retry: 1,
refetchOnWindowFocus: false,
},
},
});
const routerMapping = [
{ path: "/", component: Home, headerTitle: "Home" },
{ path: "/home", component: Home, headerTitle: "Home" },
@@ -41,35 +53,36 @@ const routerMapping = [
];
root.render(
<BrowserRouter>
<AuthProvider authBaseUrl={AUTH_BASE}>
<AppTheme>
<CssBaseline enableColorScheme />
<Header routerMapping={routerMapping} />
<QueryClientProvider client={queryClient}>
<BrowserRouter>
<AuthProvider authBaseUrl={AUTH_BASE}>
<AppTheme>
<CssBaseline enableColorScheme />
<Header routerMapping={routerMapping} />
<Box sx={{ pb: 8 }}>
<Toolbar />
<Box sx={{ pb: 8 }}>
<Toolbar />
<Routes>
{routerMapping.map(({ path, component: Component }) => (
<Route
key={path}
path={path}
element={
path.startsWith("/admin") ? (
<Component basePath="/admin" resourceOverrides={configuration} profileConfig={profileConfiguration} />
) : (
<Component />
)
}
/>
))}
</Routes>
<Routes>
{routerMapping.map(({ path, component: Component }) => (
<Route
key={path}
path={path}
element={
path.startsWith("/admin") ? (
<Component basePath="/admin" resourceOverrides={configuration} profileConfig={profileConfiguration} />
) : (
<Component />
)
}
/>
))}
</Routes>
</Box>
</Box>
<Footer />
</AppTheme>
</AuthProvider>
</BrowserRouter>
<Footer />
</AppTheme>
</AuthProvider>
</BrowserRouter>
</QueryClientProvider>
);