mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 03:38:04 +00:00
* Bump lint-staged * Check * Check * Added husky * Check * Check * Check * Check * Check * Check * Check * Check * Fix husky * Used * instead **/* in lint-staged * Bump tailwindcss and related * Added @tailwindcss/vite and removed postcss * Added lint into staged * Bump @babel/core and updated .prettierignore * Removed tailwind.config.cjs * Added ThemeInit * Added cursor-pointer to Help dropdown * Bump react-router * Removed @types/uuid and react-router-dom * Bump diff2html, prettier, @typescript-eslint/eslint-plugin, @typescript-eslint/parser * removed vite-plugin-html-config and @babel/core * removed "@eslint/eslintrc" and "@eslint/js" * Removed redundant link * Returned plugins and source to index.css * Set dark to false in tailwindcss * Fixed storybook * Fixed useGetLatestVersion with correct gcTime: 0 option * Added eslint-plugin-prettier * Removed spaces * ClustersList.tsx improved and type fixes for another files * Repository.tsx improved * Huge fix of types * Huge fix of types missed * Fixed type of SingleValue * Added cursor pointer
86 lines
2.8 KiB
TypeScript
86 lines
2.8 KiB
TypeScript
import Header from "./layout/Header";
|
|
import { HashRouter, Outlet, Route, Routes, useParams } from "react-router";
|
|
import "./index.css";
|
|
import Installed from "./pages/Installed";
|
|
import RepositoryPage from "./pages/Repository";
|
|
import Revision from "./pages/Revision";
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
import { useState } from "react";
|
|
import { ErrorAlert, ErrorModalContext } from "./context/ErrorModalContext";
|
|
import GlobalErrorModal from "./components/modal/GlobalErrorModal";
|
|
import { AppContextProvider } from "./context/AppContext";
|
|
import apiService from "./API/apiService";
|
|
import DocsPage from "./pages/DocsPage";
|
|
|
|
const queryClient = new QueryClient({
|
|
defaultOptions: {
|
|
queries: {
|
|
refetchOnWindowFocus: false,
|
|
retry: false,
|
|
},
|
|
},
|
|
});
|
|
|
|
const PageLayout = () => {
|
|
return (
|
|
<div className="flex flex-col h-screen">
|
|
<Header />
|
|
<div className="bg-body-background bg-no-repeat bg-[url('./assets/body-background.svg')] flex-1">
|
|
<Outlet />
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
const SyncContext: React.FC = () => {
|
|
const { context } = useParams();
|
|
if (context) {
|
|
apiService.setCluster(decodeURIComponent(context));
|
|
}
|
|
|
|
return <Outlet />;
|
|
};
|
|
|
|
export default function App() {
|
|
const [shouldShowErrorModal, setShowErrorModal] = useState<
|
|
ErrorAlert | undefined
|
|
>(undefined);
|
|
const value = { shouldShowErrorModal, setShowErrorModal };
|
|
|
|
return (
|
|
<AppContextProvider>
|
|
<ErrorModalContext.Provider value={value}>
|
|
<QueryClientProvider client={queryClient}>
|
|
<HashRouter>
|
|
<Routes>
|
|
<Route path="docs/" element={<DocsPage />} />
|
|
<Route path="*" element={<PageLayout />}>
|
|
<Route path=":context?/*" element={<SyncContext />}>
|
|
<Route path="installed/?" element={<Installed />} />
|
|
<Route
|
|
path=":namespace/:chart/installed/revision/:revision"
|
|
element={<Revision />}
|
|
/>
|
|
<Route path="repository/" element={<RepositoryPage />} />
|
|
<Route
|
|
path="repository/:selectedRepo?"
|
|
element={<RepositoryPage />}
|
|
/>
|
|
<Route path="*" element={<Installed />} />
|
|
</Route>
|
|
<Route path="*" element={<Installed />} />
|
|
</Route>
|
|
</Routes>
|
|
<GlobalErrorModal
|
|
isOpen={!!shouldShowErrorModal}
|
|
onClose={() => setShowErrorModal(undefined)}
|
|
titleText={shouldShowErrorModal?.title || ""}
|
|
contentText={shouldShowErrorModal?.msg || ""}
|
|
/>
|
|
</HashRouter>
|
|
</QueryClientProvider>
|
|
</ErrorModalContext.Provider>
|
|
</AppContextProvider>
|
|
);
|
|
}
|