diff --git a/Dockerfile b/Dockerfile index df713d7..48ca373 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN npm ci COPY . . RUN VITE_API_BASE_URL=/v1/ npm run build -FROM nginx:1.31.0-alpine +FROM nginx:1.31.1-alpine RUN apk upgrade --no-cache diff --git a/package-lock.json b/package-lock.json index b539bdc..91d897b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -73,7 +73,7 @@ "react-scan": "^0.5.7", "react-spring": "^10.0.3", "react-use": "^17.6.0", - "recharts": "^2.15.4", + "recharts": "^3.8.1", "sonner": "^2.0.7", "tailwind-merge": "^3.5.0", "tailwindcss": "^4.3.0", @@ -4482,6 +4482,42 @@ } } }, + "node_modules/@reduxjs/toolkit": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.12.0.tgz", + "integrity": "sha512-KiT+RzZbp6mQET+Mg+h2c97+9j1sNflUxQkIHI7Yuzf6Peu+OYpmkn6nbHWmLLWj+1ZODUJFwGZ7gx3L9R9EOw==", + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.0.0", + "@standard-schema/utils": "^0.3.0", + "immer": "^11.0.0", + "redux": "^5.0.1", + "redux-thunk": "^3.1.0", + "reselect": "^5.1.0" + }, + "peerDependencies": { + "react": "^16.9.0 || ^17.0.0 || ^18 || ^19", + "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-redux": { + "optional": true + } + } + }, + "node_modules/@reduxjs/toolkit/node_modules/immer": { + "version": "11.1.8", + "resolved": "https://registry.npmjs.org/immer/-/immer-11.1.8.tgz", + "integrity": "sha512-/tbkHMW7y10Lx6i1crLjD4/OhNkRG+Fo7byZHtah0547nIeXYcpIXaUh0IAQY6gO5459qpGGYapcEOHtFXkIuA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, "node_modules/@rolldown/binding-android-arm64": { "version": "1.0.0-rc.17", "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.0-rc.17.tgz", @@ -5419,6 +5455,12 @@ "@types/react": "*" } }, + "node_modules/@types/use-sync-external-store": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz", + "integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==", + "license": "MIT" + }, "node_modules/@types/webxr": { "version": "0.5.24", "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.24.tgz", @@ -6822,16 +6864,6 @@ "integrity": "sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==", "license": "Apache-2.0" }, - "node_modules/dom-helpers": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", - "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.8.7", - "csstype": "^3.0.2" - } - }, "node_modules/dot-prop": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-10.1.0.tgz", @@ -7031,6 +7063,16 @@ "node": ">= 0.4" } }, + "node_modules/es-toolkit": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.47.0.tgz", + "integrity": "sha512-n1GuoD0WEQZMBk5tttoZSqwgyLx01oqa5XsBmCHwPyNe1S9jPBEmtR2pSgp2kJuWE3ciFZ6yRHmY4pM4C3OOkw==", + "license": "MIT", + "workspaces": [ + "docs", + "benchmarks" + ] + }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -7253,9 +7295,9 @@ } }, "node_modules/eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", + "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", "license": "MIT" }, "node_modules/exponential-backoff": { @@ -7293,15 +7335,6 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "license": "MIT" }, - "node_modules/fast-equals": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-5.4.0.tgz", - "integrity": "sha512-jt2DW/aNFNwke7AUd+Z+e6pz39KO5rzdbbFCg2sGafS4mk13MI7Z8O5z9cADNn5lhGODIgLwug6TZO2ctf7kcw==", - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/fast-glob": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", @@ -7956,6 +7989,16 @@ "node": ">=16.x" } }, + "node_modules/immer": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.2.0.tgz", + "integrity": "sha512-d/+XTN3zfODyjr89gM3mPq1WNX2B8pYsu7eORitdwyA2sBubnTl3laYlBk4sXY5FUa5qTZGBDPJICVbvqzjlbw==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, "node_modules/import-in-the-middle": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-3.0.1.tgz", @@ -8695,12 +8738,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lodash": { - "version": "4.18.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", - "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", - "license": "MIT" - }, "node_modules/lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", @@ -10655,6 +10692,29 @@ "react": "^19.2.0" } }, + "node_modules/react-redux": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.3.0.tgz", + "integrity": "sha512-KQopgqFo/p/fgmAs5qz6p5RWaNAzq40WAu7fJIXnQpYxFPbJYtsJPWvGeF2rOBaY/kEuV77AVsX8TsQzKm+A/g==", + "license": "MIT", + "dependencies": { + "@types/use-sync-external-store": "^0.0.6", + "use-sync-external-store": "^1.4.0" + }, + "peerDependencies": { + "@types/react": "^18.2.25 || ^19", + "react": "^18.0 || ^19", + "redux": "^5.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "redux": { + "optional": true + } + } + }, "node_modules/react-refresh": { "version": "0.14.2", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz", @@ -10795,21 +10855,6 @@ } } }, - "node_modules/react-smooth": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/react-smooth/-/react-smooth-4.0.4.tgz", - "integrity": "sha512-gnGKTpYwqL0Iii09gHobNolvX4Kiq4PKx6eWBCYYix+8cdw+cGo3do906l1NBPKkSWx1DghC1dlWG9L2uGd61Q==", - "license": "MIT", - "dependencies": { - "fast-equals": "^5.0.1", - "prop-types": "^15.8.1", - "react-transition-group": "^4.4.5" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" - } - }, "node_modules/react-spring": { "version": "10.0.3", "resolved": "https://registry.npmjs.org/react-spring/-/react-spring-10.0.3.tgz", @@ -10868,22 +10913,6 @@ } } }, - "node_modules/react-transition-group": { - "version": "4.4.5", - "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", - "integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==", - "license": "BSD-3-Clause", - "dependencies": { - "@babel/runtime": "^7.5.5", - "dom-helpers": "^5.0.1", - "loose-envify": "^1.4.0", - "prop-types": "^15.6.2" - }, - "peerDependencies": { - "react": ">=16.6.0", - "react-dom": ">=16.6.0" - } - }, "node_modules/react-universal-interface": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/react-universal-interface/-/react-universal-interface-0.6.2.tgz", @@ -10985,43 +11014,50 @@ } }, "node_modules/recharts": { - "version": "2.15.4", - "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.15.4.tgz", - "integrity": "sha512-UT/q6fwS3c1dHbXv2uFgYJ9BMFHu3fwnd7AYZaEQhXuYQ4hgsxLvsUXzGdKeZrW5xopzDCvuA2N41WJ88I7zIw==", + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/recharts/-/recharts-3.8.1.tgz", + "integrity": "sha512-mwzmO1s9sFL0TduUpwndxCUNoXsBw3u3E/0+A+cLcrSfQitSG62L32N69GhqUrrT5qKcAE3pCGVINC6pqkBBQg==", "license": "MIT", + "workspaces": [ + "www" + ], "dependencies": { - "clsx": "^2.0.0", - "eventemitter3": "^4.0.1", - "lodash": "^4.17.21", - "react-is": "^18.3.1", - "react-smooth": "^4.0.4", - "recharts-scale": "^0.4.4", - "tiny-invariant": "^1.3.1", - "victory-vendor": "^36.6.8" + "@reduxjs/toolkit": "^1.9.0 || 2.x.x", + "clsx": "^2.1.1", + "decimal.js-light": "^2.5.1", + "es-toolkit": "^1.39.3", + "eventemitter3": "^5.0.1", + "immer": "^10.1.1", + "react-redux": "8.x.x || 9.x.x", + "reselect": "5.1.1", + "tiny-invariant": "^1.3.3", + "use-sync-external-store": "^1.2.2", + "victory-vendor": "^37.0.2" }, "engines": { - "node": ">=14" + "node": ">=18" }, "peerDependencies": { - "react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", - "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, - "node_modules/recharts-scale": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/recharts-scale/-/recharts-scale-0.4.5.tgz", - "integrity": "sha512-kivNFO+0OcUNu7jQquLXAxz1FIwZj8nrj+YkOKc5694NbjCvcT6aSZiIzNzd2Kul4o4rTto8QVR9lMNtxD4G1w==", + "node_modules/redux": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==", + "license": "MIT" + }, + "node_modules/redux-thunk": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz", + "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==", "license": "MIT", - "dependencies": { - "decimal.js-light": "^2.4.1" + "peerDependencies": { + "redux": "^5.0.0" } }, - "node_modules/recharts/node_modules/react-is": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", - "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", - "license": "MIT" - }, "node_modules/regenerator-runtime": { "version": "0.13.11", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", @@ -11061,6 +11097,12 @@ "node": ">=9.3.0 || >=8.10.0 <9.0.0" } }, + "node_modules/reselect": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz", + "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==", + "license": "MIT" + }, "node_modules/resize-observer-polyfill": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", @@ -12017,9 +12059,9 @@ } }, "node_modules/victory-vendor": { - "version": "36.9.2", - "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-36.9.2.tgz", - "integrity": "sha512-PnpQQMuxlwYdocC8fIJqVXvkeViHYzotI+NJrCuav0ZYFoq912ZHBk3mCeuj+5/VpodOjPe1z0Fk2ihgzlXqjQ==", + "version": "37.3.6", + "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz", + "integrity": "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==", "license": "MIT AND ISC", "dependencies": { "@types/d3-array": "^3.0.3", diff --git a/package.json b/package.json index 2d6ebb5..195ef14 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "react-scan": "^0.5.7", "react-spring": "^10.0.3", "react-use": "^17.6.0", - "recharts": "^2.15.4", + "recharts": "^3.8.1", "sonner": "^2.0.7", "tailwind-merge": "^3.5.0", "tailwindcss": "^4.3.0", diff --git a/src/App.tsx b/src/App.tsx index 483e27b..849e5ad 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,12 +1,12 @@ -import {QueryClient, QueryClientProvider} from "@tanstack/react-query"; -import {Helmet} from "react-helmet"; -import {Toaster} from "@/components/ui/sonner" -import {MotionLazy} from "./components/animate/motion-lazy"; -import {RouteLoading} from "./components/loading"; -import {ThemeProvider} from "next-themes"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { Helmet } from "react-helmet"; +import { Toaster } from "@/components/ui/sonner"; +import { MotionLazy } from "./components/animate/motion-lazy"; +import { RouteLoading } from "./components/loading"; +import { ThemeProvider } from "next-themes"; if (import.meta.env.DEV) { - import("react-scan").then(({scan}) => { + import("react-scan").then(({ scan }) => { scan({ enabled: false, showToolbar: true, @@ -16,7 +16,7 @@ if (import.meta.env.DEV) { }); } -function App({children}: { children: React.ReactNode }) { +function App({ children }: { children: React.ReactNode }) { return ( - + PodDeck - - + + {children} ); } -export default App; \ No newline at end of file +export default App; diff --git a/src/api/client.ts b/src/api/client.ts index b1f5724..db27958 100644 --- a/src/api/client.ts +++ b/src/api/client.ts @@ -2,7 +2,7 @@ import userStore from "@/store/user-store"; import axios, { type AxiosError, type AxiosRequestConfig, - type AxiosResponse + type AxiosResponse, } from "axios"; import userService from "./services/user-service.ts"; import clusterStore from "@/store/cluster-store.ts"; @@ -14,7 +14,7 @@ export interface AuthenticationRequestConfig extends AxiosRequestConfig { const axiosInstance = axios.create({ baseURL: import.meta.env.VITE_API_BASE_URL || "/v1/", timeout: 60000, - headers: {"Content-Type": "application/json;charset=utf-8"}, + headers: { "Content-Type": "application/json;charset=utf-8" }, }); let isRefreshing = false; @@ -24,7 +24,7 @@ let failedQueue: { }[] = []; const processQueue = (error: unknown, token: string | null = null) => { - failedQueue.forEach(prom => { + failedQueue.forEach((prom) => { if (error) { prom.reject(error); } else { @@ -65,7 +65,10 @@ axiosInstance.interceptors.response.use( }, ); -async function refresh(originalRequest: AuthenticationRequestConfig, error: AxiosError) { +async function refresh( + originalRequest: AuthenticationRequestConfig, + error: AxiosError, +) { originalRequest._retry = true; const { refresh_token } = userStore.getState().token; if (!refresh_token) { @@ -87,8 +90,9 @@ async function refresh(originalRequest: AuthenticationRequestConfig, error: Axio function enqueueFailedRequest(originalRequest: AuthenticationRequestConfig) { return new Promise((resolve, reject) => { failedQueue.push({ resolve, reject }); - }).then((token) => retryRequestWithToken(originalRequest, token)) - .catch(err => { + }) + .then((token) => retryRequestWithToken(originalRequest, token)) + .catch((err) => { originalRequest._retry = false; throw err; }); @@ -98,7 +102,8 @@ async function performRefresh(refresh_token: string) { isRefreshing = true; try { const refreshResponse = await userService.refresh({ refresh_token }); - const { authentication_token, refresh_token: newRefreshToken } = refreshResponse; + const { authentication_token, refresh_token: newRefreshToken } = + refreshResponse; userStore.getState().actions.setUserToken({ authentication_token, refresh_token: newRefreshToken, @@ -113,7 +118,10 @@ async function performRefresh(refresh_token: string) { } } -function retryRequestWithToken(originalRequest: AuthenticationRequestConfig, token: string) { +function retryRequestWithToken( + originalRequest: AuthenticationRequestConfig, + token: string, +) { if (!originalRequest.headers) { originalRequest.headers = {}; } @@ -123,19 +131,19 @@ function retryRequestWithToken(originalRequest: AuthenticationRequestConfig, tok class APIClient { get(config: AxiosRequestConfig): Promise { - return this.request({...config, method: "GET"}); + return this.request({ ...config, method: "GET" }); } post(config: AxiosRequestConfig): Promise { - return this.request({...config, method: "POST"}); + return this.request({ ...config, method: "POST" }); } put(config: AxiosRequestConfig): Promise { - return this.request({...config, method: "PUT"}); + return this.request({ ...config, method: "PUT" }); } delete(config: AxiosRequestConfig): Promise { - return this.request({...config, method: "DELETE"}); + return this.request({ ...config, method: "DELETE" }); } request(config: AxiosRequestConfig): Promise { @@ -143,4 +151,4 @@ class APIClient { } } -export default new APIClient(); \ No newline at end of file +export default new APIClient(); diff --git a/src/api/services/app-service.ts b/src/api/services/app-service.ts index 0568f51..b6a0ce6 100644 --- a/src/api/services/app-service.ts +++ b/src/api/services/app-service.ts @@ -7,17 +7,17 @@ export type App = { description: string; keywords: string[]; installed: boolean; -} +}; export type Version = { chart_version: string; app_version: string; -} +}; export type AppListResponse = { apps: App[]; success?: boolean; -} +}; export interface AppInstallRequest { name: string; @@ -30,29 +30,29 @@ export type AppInstallResponse = { success: boolean; status: string; output: string; -} +}; export const AppApi = { List: "/apps/", Install: "/app/install/", } as const; -const list = () => client.get({url: AppApi.List}); -const listCluster = (clusterId: string) => client.get( - { +const list = () => client.get({ url: AppApi.List }); +const listCluster = (clusterId: string) => + client.get({ url: AppApi.List, headers: { Cluster: clusterId, }, - } -); -const install = (data: AppInstallRequest) => client.post({ - url: AppApi.Install, - data -}); + }); +const install = (data: AppInstallRequest) => + client.post({ + url: AppApi.Install, + data, + }); export default { list, listCluster, - install -}; \ No newline at end of file + install, +}; diff --git a/src/api/services/audit-service.ts b/src/api/services/audit-service.ts index 795e1ee..b49d361 100644 --- a/src/api/services/audit-service.ts +++ b/src/api/services/audit-service.ts @@ -53,28 +53,29 @@ export type AuditEntry = { control: AuditControl; test: AuditTest; result: AuditResult; -} +}; export type AuditPerformResponse = { success: boolean; audit: Audit; -} +}; export type AuditFindResponse = { success: boolean; audit: Audit; -} +}; export const AuditApi = { Perform: "/audit/perform/", - Find: "/audit/find/" + Find: "/audit/find/", } as const; -const perform = () => client.get({url: AuditApi.Perform}); +const perform = () => + client.get({ url: AuditApi.Perform }); -const find = () => client.get({url: AuditApi.Find}); +const find = () => client.get({ url: AuditApi.Find }); export default { perform, - find -}; \ No newline at end of file + find, +}; diff --git a/src/api/services/cluster-service.ts b/src/api/services/cluster-service.ts index 29bb42b..6d480af 100644 --- a/src/api/services/cluster-service.ts +++ b/src/api/services/cluster-service.ts @@ -6,7 +6,7 @@ export type Cluster = { icon: string; created_at: number; online: boolean; -} +}; export interface ClusterCreateRequest { name: string; @@ -17,7 +17,7 @@ export type ClusterCreateResponse = { success: boolean; cluster: string; agent_key: string; -} +}; export interface ClusterEditRequest { id: string; @@ -27,7 +27,7 @@ export interface ClusterEditRequest { export type ClusterEditResponse = { success: boolean; -} +}; export interface ClusterDeleteRequest { id: string; @@ -35,21 +35,21 @@ export interface ClusterDeleteRequest { export type ClusterDeleteResponse = { success: boolean; -} +}; export type ClusterListResponse = { clusters: Cluster[]; -} +}; export type ClusterAgentInstallRequest = { id: string; -} +}; export type ClusterAgentInstallResponse = { success: boolean; cluster_id: string; agent_key: string; -} +}; export const ClusterApi = { Create: "/cluster/create/", @@ -59,23 +59,27 @@ export const ClusterApi = { AgentInstall: "/cluster/agent-install/", } as const; -const create = (data: ClusterCreateRequest) => client.post({ - url: ClusterApi.Create, - data -}); -const edit = (data: ClusterEditRequest) => client.post({ - url: ClusterApi.Edit, - data -}); -const remove = (data: ClusterDeleteRequest) => client.post({ - url: ClusterApi.Delete, - data -}); -const list = () => client.get({url: ClusterApi.List}); -const agentInstall = (data: ClusterAgentInstallRequest) => client.post({ - url: ClusterApi.AgentInstall, - data -}); +const create = (data: ClusterCreateRequest) => + client.post({ + url: ClusterApi.Create, + data, + }); +const edit = (data: ClusterEditRequest) => + client.post({ + url: ClusterApi.Edit, + data, + }); +const remove = (data: ClusterDeleteRequest) => + client.post({ + url: ClusterApi.Delete, + data, + }); +const list = () => client.get({ url: ClusterApi.List }); +const agentInstall = (data: ClusterAgentInstallRequest) => + client.post({ + url: ClusterApi.AgentInstall, + data, + }); export default { create, @@ -83,4 +87,4 @@ export default { remove, list, agentInstall, -}; \ No newline at end of file +}; diff --git a/src/api/services/daemon-set-service.ts b/src/api/services/daemon-set-service.ts index 22a4a9a..480120e 100644 --- a/src/api/services/daemon-set-service.ts +++ b/src/api/services/daemon-set-service.ts @@ -24,7 +24,7 @@ export type DaemonSet = { conditions: Condition[]; events: Event[]; raw: string; -} +}; export type Condition = { type: string; @@ -32,7 +32,7 @@ export type Condition = { reason: string; message: string; last_update: number; -} +}; export type Event = { type: string; @@ -40,12 +40,12 @@ export type Event = { message: string; timestamp: number; source: string; -} +}; export type DaemonSetListResponse = { daemon_sets: DaemonSet[]; success?: boolean; -} +}; export interface DaemonSetFindRequest { namespace: string; @@ -55,7 +55,7 @@ export interface DaemonSetFindRequest { export type DaemonSetFindResponse = { success: boolean; daemon_set: DaemonSet; -} +}; export interface DaemonSetCreateRequest { raw: string; @@ -65,7 +65,7 @@ export type DaemonSetCreateResponse = { success: boolean; namespace: string; daemon_set: string; -} +}; export interface DaemonSetDeleteRequest { namespace: string; @@ -74,7 +74,7 @@ export interface DaemonSetDeleteRequest { export type DaemonSetDeleteResponse = { success: boolean; -} +}; export interface DaemonSetRestartRequest { namespace: string; @@ -83,7 +83,7 @@ export interface DaemonSetRestartRequest { export type DaemonSetRestartResponse = { success: boolean; -} +}; export interface DaemonSetEditRequest { namespace: string; @@ -93,7 +93,7 @@ export interface DaemonSetEditRequest { export type DaemonSetEditResponse = { success: boolean; -} +}; export const DaemonSetApi = { List: "/daemon-sets/", @@ -104,35 +104,40 @@ export const DaemonSetApi = { Edit: "/daemon-set/edit/", } as const; -const list = () => client.get({url: DaemonSetApi.List}); -const listCluster = (clusterId: string) => client.get( - { +const list = () => + client.get({ url: DaemonSetApi.List }); +const listCluster = (clusterId: string) => + client.get({ url: DaemonSetApi.List, headers: { Cluster: clusterId, }, - } -); -const find = (data: DaemonSetFindRequest) => client.post({ - url: DaemonSetApi.Find, - data -}); -const create = (data: DaemonSetCreateRequest) => client.post({ - url: DaemonSetApi.Create, - data -}); -const remove = (data: DaemonSetDeleteRequest) => client.post({ - url: DaemonSetApi.Delete, - data -}); -const restart = (data: DaemonSetRestartRequest) => client.post({ - url: DaemonSetApi.Restart, - data -}); -const edit = (data: DaemonSetEditRequest) => client.post({ - url: DaemonSetApi.Edit, - data -}); + }); +const find = (data: DaemonSetFindRequest) => + client.post({ + url: DaemonSetApi.Find, + data, + }); +const create = (data: DaemonSetCreateRequest) => + client.post({ + url: DaemonSetApi.Create, + data, + }); +const remove = (data: DaemonSetDeleteRequest) => + client.post({ + url: DaemonSetApi.Delete, + data, + }); +const restart = (data: DaemonSetRestartRequest) => + client.post({ + url: DaemonSetApi.Restart, + data, + }); +const edit = (data: DaemonSetEditRequest) => + client.post({ + url: DaemonSetApi.Edit, + data, + }); export default { list, @@ -141,5 +146,5 @@ export default { create, remove, restart, - edit -}; \ No newline at end of file + edit, +}; diff --git a/src/api/services/deployment-service.ts b/src/api/services/deployment-service.ts index fc7df2e..d0635e6 100644 --- a/src/api/services/deployment-service.ts +++ b/src/api/services/deployment-service.ts @@ -21,14 +21,14 @@ export type Deployment = { conditions: Condition[]; events: Event[]; raw: string; -} +}; export type Condition = { type: string; status: string; reason: string; message: string; -} +}; export type Event = { type: string; @@ -36,12 +36,12 @@ export type Event = { message: string; timestamp: number; source: string; -} +}; export type DeploymentListResponse = { deployments: Deployment[]; success?: boolean; -} +}; export interface DeploymentFindRequest { namespace: string; @@ -51,7 +51,7 @@ export interface DeploymentFindRequest { export type DeploymentFindResponse = { success: boolean; deployment: Deployment; -} +}; export interface DeploymentCreateRequest { raw: string; @@ -61,7 +61,7 @@ export type DeploymentCreateResponse = { success: boolean; namespace: string; deployment: string; -} +}; export interface DeploymentDeleteRequest { namespace: string; @@ -70,7 +70,7 @@ export interface DeploymentDeleteRequest { export type DeploymentDeleteResponse = { success: boolean; -} +}; export interface DeploymentScaleRequest { namespace: string; @@ -80,7 +80,7 @@ export interface DeploymentScaleRequest { export type DeploymentScaleResponse = { success: boolean; -} +}; export interface DeploymentRestartRequest { namespace: string; @@ -89,7 +89,7 @@ export interface DeploymentRestartRequest { export type DeploymentRestartResponse = { success: boolean; -} +}; export interface DeploymentEditRequest { namespace: string; @@ -99,7 +99,7 @@ export interface DeploymentEditRequest { export type DeploymentEditResponse = { success: boolean; -} +}; export const DeploymentApi = { List: "/deployments/", @@ -111,39 +111,45 @@ export const DeploymentApi = { Edit: "/deployment/edit/", } as const; -const list = () => client.get({url: DeploymentApi.List}); -const listCluster = (clusterId: string) => client.get( - { +const list = () => + client.get({ url: DeploymentApi.List }); +const listCluster = (clusterId: string) => + client.get({ url: DeploymentApi.List, headers: { Cluster: clusterId, }, - } -); -const find = (data: DeploymentFindRequest) => client.post({ - url: DeploymentApi.Find, - data -}); -const create = (data: DeploymentCreateRequest) => client.post({ - url: DeploymentApi.Create, - data -}); -const remove = (data: DeploymentDeleteRequest) => client.post({ - url: DeploymentApi.Delete, - data -}); -const scale = (data: DeploymentScaleRequest) => client.post({ - url: DeploymentApi.Scale, - data -}); -const restart = (data: DeploymentRestartRequest) => client.post({ - url: DeploymentApi.Restart, - data -}); -const edit = (data: DeploymentEditRequest) => client.post({ - url: DeploymentApi.Edit, - data -}); + }); +const find = (data: DeploymentFindRequest) => + client.post({ + url: DeploymentApi.Find, + data, + }); +const create = (data: DeploymentCreateRequest) => + client.post({ + url: DeploymentApi.Create, + data, + }); +const remove = (data: DeploymentDeleteRequest) => + client.post({ + url: DeploymentApi.Delete, + data, + }); +const scale = (data: DeploymentScaleRequest) => + client.post({ + url: DeploymentApi.Scale, + data, + }); +const restart = (data: DeploymentRestartRequest) => + client.post({ + url: DeploymentApi.Restart, + data, + }); +const edit = (data: DeploymentEditRequest) => + client.post({ + url: DeploymentApi.Edit, + data, + }); export default { list, @@ -153,5 +159,5 @@ export default { remove, scale, restart, - edit -}; \ No newline at end of file + edit, +}; diff --git a/src/api/services/event-service.ts b/src/api/services/event-service.ts index ea318b3..d66be04 100644 --- a/src/api/services/event-service.ts +++ b/src/api/services/event-service.ts @@ -11,7 +11,7 @@ export type Event = { first_timestamp: number; last_timestamp: number; count: number; -} +}; export interface EventListRequest { start: number; @@ -21,17 +21,18 @@ export interface EventListRequest { export type EventListResponse = { events: Event[]; -} +}; export const EventApi = { List: "/events/", } as const; -const list = (data: EventListRequest) => client.post({ - url: EventApi.List, - data -}); +const list = (data: EventListRequest) => + client.post({ + url: EventApi.List, + data, + }); export default { list, -}; \ No newline at end of file +}; diff --git a/src/api/services/namespace-service.ts b/src/api/services/namespace-service.ts index 367d1fb..e4479e7 100644 --- a/src/api/services/namespace-service.ts +++ b/src/api/services/namespace-service.ts @@ -4,7 +4,7 @@ export type Namespace = { name: string; status: string; age: number; -} +}; export interface NamespaceCreateRequest { name: string; @@ -12,7 +12,7 @@ export interface NamespaceCreateRequest { export type NamespaceCreateResponse = { success: boolean; -} +}; export interface NamespaceDeleteRequest { name: string; @@ -20,12 +20,12 @@ export interface NamespaceDeleteRequest { export type NamespaceDeleteResponse = { success: boolean; -} +}; export type NamespaceListResponse = { namespaces: Namespace[]; success?: boolean; -} +}; export const NamespaceApi = { Create: "/namespace/create/", @@ -33,27 +33,29 @@ export const NamespaceApi = { List: "/namespaces/", } as const; -const create = (data: NamespaceCreateRequest) => client.post({ - url: NamespaceApi.Create, - data -}); -const remove = (data: NamespaceDeleteRequest) => client.post({ - url: NamespaceApi.Delete, - data -}); -const list = () => client.get({url: NamespaceApi.List}); -const listCluster = (clusterId: string) => client.get( - { +const create = (data: NamespaceCreateRequest) => + client.post({ + url: NamespaceApi.Create, + data, + }); +const remove = (data: NamespaceDeleteRequest) => + client.post({ + url: NamespaceApi.Delete, + data, + }); +const list = () => + client.get({ url: NamespaceApi.List }); +const listCluster = (clusterId: string) => + client.get({ url: NamespaceApi.List, headers: { Cluster: clusterId, }, - } -); + }); export default { create, remove, list, - listCluster -}; \ No newline at end of file + listCluster, +}; diff --git a/src/api/services/node-service.ts b/src/api/services/node-service.ts index 6dea098..d74dfc9 100644 --- a/src/api/services/node-service.ts +++ b/src/api/services/node-service.ts @@ -25,7 +25,7 @@ export type Node = { annotations: Record; conditions: Condition[]; events: Event[]; -} +}; export type Condition = { type: string; @@ -34,7 +34,7 @@ export type Condition = { message: string; last_heartbeat: number; last_transition: number; -} +}; export type Event = { type: string; @@ -42,12 +42,12 @@ export type Event = { message: string; timestamp: number; source: string; -} +}; export type NodeListResponse = { nodes: Node[]; success?: boolean; -} +}; export interface NodeFindRequest { name: string; @@ -56,29 +56,29 @@ export interface NodeFindRequest { export type NodeFindResponse = { success: boolean; node: Node; -} +}; export const NodeApi = { List: "/nodes/", - Find: "/node/find/" + Find: "/node/find/", } as const; -const list = () => client.get({url: NodeApi.List}); -const listCluster = (clusterId: string) => client.get( - { +const list = () => client.get({ url: NodeApi.List }); +const listCluster = (clusterId: string) => + client.get({ url: NodeApi.List, headers: { Cluster: clusterId, }, - } -); -const find = (data: NodeFindRequest) => client.post({ - url: NodeApi.Find, - data -}); + }); +const find = (data: NodeFindRequest) => + client.post({ + url: NodeApi.Find, + data, + }); export default { list, listCluster, - find -}; \ No newline at end of file + find, +}; diff --git a/src/api/services/notification-service.ts b/src/api/services/notification-service.ts index 0da8a99..d560a77 100644 --- a/src/api/services/notification-service.ts +++ b/src/api/services/notification-service.ts @@ -30,24 +30,26 @@ export const NotificationApi = { Seen: "/notification/seen/", } as const; -const listAll = () => client.get({ - url: NotificationApi.ListAll, -}); -const listCluster = () => client.get({ - url: NotificationApi.ListCluster, -}); -const listSpecificCluster = (clusterId: string) => client.get( - { +const listAll = () => + client.get({ + url: NotificationApi.ListAll, + }); +const listCluster = () => + client.get({ + url: NotificationApi.ListCluster, + }); +const listSpecificCluster = (clusterId: string) => + client.get({ url: NotificationApi.ListCluster, headers: { Cluster: clusterId, }, - } -); -const markSeen = (data: NotificationSeenRequest) => client.post({ - url: NotificationApi.Seen, - data, -}); + }); +const markSeen = (data: NotificationSeenRequest) => + client.post({ + url: NotificationApi.Seen, + data, + }); export default { listAll, diff --git a/src/api/services/pod-service.ts b/src/api/services/pod-service.ts index 6ad601a..7775cb7 100644 --- a/src/api/services/pod-service.ts +++ b/src/api/services/pod-service.ts @@ -16,7 +16,7 @@ export type Pod = { controlled_by: string; containers: Container[]; events: Event[]; -} +}; export type Container = { name: string; @@ -24,7 +24,7 @@ export type Container = { ready: boolean; state: string; restarts: number; -} +}; export type Event = { type: string; @@ -32,12 +32,12 @@ export type Event = { message: string; timestamp: number; source: string; -} +}; export type PodListResponse = { pods: Pod[]; success?: boolean; -} +}; export interface PodFindRequest { namespace: string; @@ -47,7 +47,7 @@ export interface PodFindRequest { export type PodFindResponse = { success: boolean; pod: Pod; -} +}; export interface PodDeleteRequest { namespace: string; @@ -56,7 +56,7 @@ export interface PodDeleteRequest { export type PodDeleteResponse = { success: boolean; -} +}; export interface PodLogRequest { namespace: string; @@ -67,7 +67,7 @@ export interface PodLogRequest { export type PodLogResponse = { success: boolean; logs: string; -} +}; export const PodApi = { List: "/pods/", @@ -76,27 +76,29 @@ export const PodApi = { Log: "/pod/log/", } as const; -const list = () => client.get({url: PodApi.List}); -const listCluster = (clusterId: string) => client.get( - { +const list = () => client.get({ url: PodApi.List }); +const listCluster = (clusterId: string) => + client.get({ url: PodApi.List, headers: { Cluster: clusterId, }, - } -); -const find = (data: PodFindRequest) => client.post({ - url: PodApi.Find, - data -}); -const remove = (data: PodDeleteRequest) => client.post({ - url: PodApi.Delete, - data -}); -const log = (data: PodLogRequest) => client.post({ - url: PodApi.Log, - data -}); + }); +const find = (data: PodFindRequest) => + client.post({ + url: PodApi.Find, + data, + }); +const remove = (data: PodDeleteRequest) => + client.post({ + url: PodApi.Delete, + data, + }); +const log = (data: PodLogRequest) => + client.post({ + url: PodApi.Log, + data, + }); export default { list, @@ -104,4 +106,4 @@ export default { find, remove, log, -}; \ No newline at end of file +}; diff --git a/src/api/services/replica-set-service.ts b/src/api/services/replica-set-service.ts index 7337844..fd0efd8 100644 --- a/src/api/services/replica-set-service.ts +++ b/src/api/services/replica-set-service.ts @@ -20,7 +20,7 @@ export type ReplicaSet = { conditions: Condition[]; events: Event[]; raw: string; -} +}; export type Condition = { type: string; @@ -28,7 +28,7 @@ export type Condition = { reason: string; message: string; last_transition: number; -} +}; export type Event = { type: string; @@ -36,12 +36,12 @@ export type Event = { message: string; timestamp: number; source: string; -} +}; export type ReplicaSetListResponse = { replica_sets: ReplicaSet[]; success?: boolean; -} +}; export interface ReplicaSetFindRequest { namespace: string; @@ -51,7 +51,7 @@ export interface ReplicaSetFindRequest { export type ReplicaSetFindResponse = { success: boolean; replica_set: ReplicaSet; -} +}; export interface ReplicaSetCreateRequest { raw: string; @@ -61,7 +61,7 @@ export type ReplicaSetCreateResponse = { success: boolean; namespace: string; replica_set: string; -} +}; export interface ReplicaSetDeleteRequest { namespace: string; @@ -70,7 +70,7 @@ export interface ReplicaSetDeleteRequest { export type ReplicaSetDeleteResponse = { success: boolean; -} +}; export interface ReplicaSetScaleRequest { namespace: string; @@ -80,7 +80,7 @@ export interface ReplicaSetScaleRequest { export type ReplicaSetScaleResponse = { success: boolean; -} +}; export interface ReplicaSetEditRequest { namespace: string; @@ -90,7 +90,7 @@ export interface ReplicaSetEditRequest { export type ReplicaSetEditResponse = { success: boolean; -} +}; export const ReplicaSetApi = { List: "/replica-sets/", @@ -101,35 +101,40 @@ export const ReplicaSetApi = { Edit: "/replica-set/edit/", } as const; -const list = () => client.get({url: ReplicaSetApi.List}); -const listCluster = (clusterId: string) => client.get( - { +const list = () => + client.get({ url: ReplicaSetApi.List }); +const listCluster = (clusterId: string) => + client.get({ url: ReplicaSetApi.List, headers: { Cluster: clusterId, }, - } -); -const find = (data: ReplicaSetFindRequest) => client.post({ - url: ReplicaSetApi.Find, - data -}); -const create = (data: ReplicaSetCreateRequest) => client.post({ - url: ReplicaSetApi.Create, - data -}); -const remove = (data: ReplicaSetDeleteRequest) => client.post({ - url: ReplicaSetApi.Delete, - data -}); -const scale = (data: ReplicaSetScaleRequest) => client.post({ - url: ReplicaSetApi.Scale, - data -}); -const edit = (data: ReplicaSetEditRequest) => client.post({ - url: ReplicaSetApi.Edit, - data -}); + }); +const find = (data: ReplicaSetFindRequest) => + client.post({ + url: ReplicaSetApi.Find, + data, + }); +const create = (data: ReplicaSetCreateRequest) => + client.post({ + url: ReplicaSetApi.Create, + data, + }); +const remove = (data: ReplicaSetDeleteRequest) => + client.post({ + url: ReplicaSetApi.Delete, + data, + }); +const scale = (data: ReplicaSetScaleRequest) => + client.post({ + url: ReplicaSetApi.Scale, + data, + }); +const edit = (data: ReplicaSetEditRequest) => + client.post({ + url: ReplicaSetApi.Edit, + data, + }); export default { list, @@ -138,5 +143,5 @@ export default { create, remove, scale, - edit -}; \ No newline at end of file + edit, +}; diff --git a/src/api/services/resource-service.ts b/src/api/services/resource-service.ts index 1773136..ee22693 100644 --- a/src/api/services/resource-service.ts +++ b/src/api/services/resource-service.ts @@ -6,17 +6,18 @@ export interface ResourceCreateRequest { export type ResourceCreateResponse = { success: boolean; -} +}; export const ResourceApi = { Create: "/resource/create/", } as const; -const create = (data: ResourceCreateRequest) => client.post({ - url: ResourceApi.Create, - data -}); +const create = (data: ResourceCreateRequest) => + client.post({ + url: ResourceApi.Create, + data, + }); export default { - create -}; \ No newline at end of file + create, +}; diff --git a/src/api/services/service-service.ts b/src/api/services/service-service.ts index f453973..1c4ff50 100644 --- a/src/api/services/service-service.ts +++ b/src/api/services/service-service.ts @@ -19,7 +19,7 @@ export type Service = { endpoints: ServiceEndpoint[]; events: Event[]; raw: string; -} +}; export type ServicePort = { name: string; @@ -27,12 +27,12 @@ export type ServicePort = { protocol: string; target_port: string; node_port: number; -} +}; export type ServiceEndpoint = { ip: string; port: number; -} +}; export type Event = { type: string; @@ -40,12 +40,12 @@ export type Event = { message: string; timestamp: number; source: string; -} +}; export type ServiceListResponse = { services: Service[]; success?: boolean; -} +}; export interface ServiceFindRequest { namespace: string; @@ -55,7 +55,7 @@ export interface ServiceFindRequest { export type ServiceFindResponse = { success: boolean; service: Service; -} +}; export interface ServiceCreateRequest { raw: string; @@ -65,7 +65,7 @@ export type ServiceCreateResponse = { success: boolean; namespace: string; service: string; -} +}; export interface ServiceDeleteRequest { namespace: string; @@ -74,41 +74,43 @@ export interface ServiceDeleteRequest { export type ServiceDeleteResponse = { success: boolean; -} +}; export const ServiceApi = { List: "/services/", Find: "/service/find/", Create: "/service/create/", - Delete: "/service/delete/" + Delete: "/service/delete/", } as const; -const list = () => client.get({url: ServiceApi.List}); -const listCluster = (clusterId: string) => client.get( - { +const list = () => client.get({ url: ServiceApi.List }); +const listCluster = (clusterId: string) => + client.get({ url: ServiceApi.List, headers: { Cluster: clusterId, }, - } -); -const find = (data: ServiceFindRequest) => client.post({ - url: ServiceApi.Find, - data -}); -const create = (data: ServiceCreateRequest) => client.post({ - url: ServiceApi.Create, - data -}); -const remove = (data: ServiceDeleteRequest) => client.post({ - url: ServiceApi.Delete, - data -}); + }); +const find = (data: ServiceFindRequest) => + client.post({ + url: ServiceApi.Find, + data, + }); +const create = (data: ServiceCreateRequest) => + client.post({ + url: ServiceApi.Create, + data, + }); +const remove = (data: ServiceDeleteRequest) => + client.post({ + url: ServiceApi.Delete, + data, + }); export default { list, listCluster, find, create, - remove -}; \ No newline at end of file + remove, +}; diff --git a/src/api/services/stateful-set-service.ts b/src/api/services/stateful-set-service.ts index e197fb2..50c1fa9 100644 --- a/src/api/services/stateful-set-service.ts +++ b/src/api/services/stateful-set-service.ts @@ -22,7 +22,7 @@ export type StatefulSet = { conditions: Condition[]; events: Event[]; raw: string; -} +}; export type Condition = { type: string; @@ -30,7 +30,7 @@ export type Condition = { reason: string; message: string; last_transition: number; -} +}; export type Event = { type: string; @@ -38,12 +38,12 @@ export type Event = { message: string; timestamp: number; source: string; -} +}; export type StatefulSetListResponse = { stateful_sets: StatefulSet[]; success?: boolean; -} +}; export interface StatefulSetFindRequest { namespace: string; @@ -53,7 +53,7 @@ export interface StatefulSetFindRequest { export type StatefulSetFindResponse = { success: boolean; stateful_set: StatefulSet; -} +}; export interface StatefulSetCreateRequest { raw: string; @@ -63,7 +63,7 @@ export type StatefulSetCreateResponse = { success: boolean; namespace: string; stateful_set: string; -} +}; export interface StatefulSetDeleteRequest { namespace: string; @@ -72,7 +72,7 @@ export interface StatefulSetDeleteRequest { export type StatefulSetDeleteResponse = { success: boolean; -} +}; export interface StatefulSetScaleRequest { namespace: string; @@ -82,7 +82,7 @@ export interface StatefulSetScaleRequest { export type StatefulSetScaleResponse = { success: boolean; -} +}; export interface StatefulSetRestartRequest { namespace: string; @@ -91,7 +91,7 @@ export interface StatefulSetRestartRequest { export type StatefulSetRestartResponse = { success: boolean; -} +}; export interface StatefulSetEditRequest { namespace: string; @@ -101,7 +101,7 @@ export interface StatefulSetEditRequest { export type StatefulSetEditResponse = { success: boolean; -} +}; export const StatefulSetApi = { List: "/stateful-sets/", @@ -113,39 +113,45 @@ export const StatefulSetApi = { Edit: "/stateful-set/edit/", } as const; -const list = () => client.get({url: StatefulSetApi.List}); -const listCluster = (clusterId: string) => client.get( - { +const list = () => + client.get({ url: StatefulSetApi.List }); +const listCluster = (clusterId: string) => + client.get({ url: StatefulSetApi.List, headers: { Cluster: clusterId, }, - } -); -const find = (data: StatefulSetFindRequest) => client.post({ - url: StatefulSetApi.Find, - data -}); -const create = (data: StatefulSetCreateRequest) => client.post({ - url: StatefulSetApi.Create, - data -}); -const remove = (data: StatefulSetDeleteRequest) => client.post({ - url: StatefulSetApi.Delete, - data -}); -const scale = (data: StatefulSetScaleRequest) => client.post({ - url: StatefulSetApi.Scale, - data -}); -const restart = (data: StatefulSetRestartRequest) => client.post({ - url: StatefulSetApi.Restart, - data -}); -const edit = (data: StatefulSetEditRequest) => client.post({ - url: StatefulSetApi.Edit, - data -}); + }); +const find = (data: StatefulSetFindRequest) => + client.post({ + url: StatefulSetApi.Find, + data, + }); +const create = (data: StatefulSetCreateRequest) => + client.post({ + url: StatefulSetApi.Create, + data, + }); +const remove = (data: StatefulSetDeleteRequest) => + client.post({ + url: StatefulSetApi.Delete, + data, + }); +const scale = (data: StatefulSetScaleRequest) => + client.post({ + url: StatefulSetApi.Scale, + data, + }); +const restart = (data: StatefulSetRestartRequest) => + client.post({ + url: StatefulSetApi.Restart, + data, + }); +const edit = (data: StatefulSetEditRequest) => + client.post({ + url: StatefulSetApi.Edit, + data, + }); export default { list, @@ -155,5 +161,5 @@ export default { remove, scale, restart, - edit -}; \ No newline at end of file + edit, +}; diff --git a/src/api/services/user-service.ts b/src/api/services/user-service.ts index eb211cc..3a0bb3f 100644 --- a/src/api/services/user-service.ts +++ b/src/api/services/user-service.ts @@ -13,7 +13,7 @@ export type LoginResponse = { refresh_token?: string; email?: string; name?: string; -} +}; export interface RefreshRequest { refresh_token: string; @@ -23,7 +23,7 @@ export type RefreshResponse = { success: boolean; authentication_token?: string; refresh_token?: string; -} +}; export const UserApi = { Login: "/authentication/login/", @@ -31,18 +31,20 @@ export const UserApi = { Logout: "/authentication/logout/", } as const; -const login = (data: LoginRequest) => client.post({ - url: UserApi.Login, - data -}); -const refresh = (data: RefreshRequest) => client.post({ - url: UserApi.Refresh, - data -}); -const logout = () => client.get({url: UserApi.Logout}); +const login = (data: LoginRequest) => + client.post({ + url: UserApi.Login, + data, + }); +const refresh = (data: RefreshRequest) => + client.post({ + url: UserApi.Refresh, + data, + }); +const logout = () => client.get({ url: UserApi.Logout }); export default { login, refresh, logout, -}; \ No newline at end of file +}; diff --git a/src/api/services/workload-service.ts b/src/api/services/workload-service.ts index c8bf4ec..eaf87ba 100644 --- a/src/api/services/workload-service.ts +++ b/src/api/services/workload-service.ts @@ -11,7 +11,7 @@ export type Metric = { used_storage: number; storage_ratio: number; timestamp: number; -} +}; export interface WorkloadRequest { node: string; @@ -22,17 +22,18 @@ export interface WorkloadRequest { export type WorkloadResponse = { workload: Metric[]; -} +}; export const WorkloadApi = { Find: "/workload/", } as const; -const find = (data: WorkloadRequest) => client.post({ - url: WorkloadApi.Find, - data -}); +const find = (data: WorkloadRequest) => + client.post({ + url: WorkloadApi.Find, + data, + }); export default { find, -}; \ No newline at end of file +}; diff --git a/src/components/age/age.tsx b/src/components/age/age.tsx index 2b03b15..3deb95f 100644 --- a/src/components/age/age.tsx +++ b/src/components/age/age.tsx @@ -1,4 +1,4 @@ -export function Age({age}: { age: number }) { +export function Age({ age }: { age: number }) { function convertTime(age: number) { const abs = Math.abs(age); if (abs < 1000 * 60) { @@ -12,7 +12,5 @@ export function Age({age}: { age: number }) { } return Math.round(age / (1000 * 60 * 60 * 24)) + "d"; } - return ( - {convertTime(age)} - ); -} \ No newline at end of file + return {convertTime(age)}; +} diff --git a/src/components/animate/motion-container.tsx b/src/components/animate/motion-container.tsx index 2c56dea..ab3ef99 100644 --- a/src/components/animate/motion-container.tsx +++ b/src/components/animate/motion-container.tsx @@ -1,5 +1,5 @@ -import {m, type MotionProps} from "motion/react"; -import {varContainer} from "./variants/container"; +import { m, type MotionProps } from "motion/react"; +import { varContainer } from "./variants/container"; interface Props extends MotionProps { className?: string; @@ -40,7 +40,7 @@ interface Props extends MotionProps { * - delayIn: 整体进入动画的延迟时间(默认:0.05s) * - staggerOut: 子元素退出动画的延迟时间(默认:0.05s) */ -export default function MotionContainer({children, className}: Props) { +export default function MotionContainer({ children, className }: Props) { return ( - {children} + {children} ); } diff --git a/src/components/animate/motion-viewport.tsx b/src/components/animate/motion-viewport.tsx index fa2b674..9528bf9 100644 --- a/src/components/animate/motion-viewport.tsx +++ b/src/components/animate/motion-viewport.tsx @@ -1,6 +1,6 @@ -import {m, type MotionProps} from "motion/react"; +import { m, type MotionProps } from "motion/react"; -import {varContainer} from "./variants"; +import { varContainer } from "./variants"; interface Props extends MotionProps { className?: string; @@ -24,12 +24,16 @@ interface Props extends MotionProps { * * @see https://www.framer.com/motion/scroll-animations/#scroll-triggered-animations */ -export default function MotionViewport({children, className, ...other}: Props) { +export default function MotionViewport({ + children, + className, + ...other +}: Props) { return ( (null); - const options = {container: elementRef}; + const options = { container: elementRef }; - const { - scrollYProgress, - scrollXProgress - } = useScroll(target === "container" ? options : undefined); + const { scrollYProgress, scrollXProgress } = useScroll( + target === "container" ? options : undefined, + ); const memoizedValue = useMemo( - () => ({elementRef, scrollXProgress, scrollYProgress}), + () => ({ elementRef, scrollXProgress, scrollYProgress }), [scrollXProgress, scrollYProgress], ); diff --git a/src/components/animate/variants/action.ts b/src/components/animate/variants/action.ts index 22b397e..caee72a 100644 --- a/src/components/animate/variants/action.ts +++ b/src/components/animate/variants/action.ts @@ -4,6 +4,6 @@ * @param tap */ export const varHover = (hover = 1.09, tap = 0.97) => ({ - hover: {scale: hover}, - tap: {scale: tap}, + hover: { scale: hover }, + tap: { scale: tap }, }); diff --git a/src/components/animate/variants/background.ts b/src/components/animate/variants/background.ts index 30776c6..0e83ade 100644 --- a/src/components/animate/variants/background.ts +++ b/src/components/animate/variants/background.ts @@ -1,4 +1,4 @@ -import type {BackgroundType} from "../types"; +import type { BackgroundType } from "../types"; export const varBgColor = (props?: BackgroundType) => { const colors = props?.colors || ["#19dcea", "#b22cff"]; @@ -8,7 +8,7 @@ export const varBgColor = (props?: BackgroundType) => { return { animate: { background: colors, - transition: {duration, ease}, + transition: { duration, ease }, }, }; }; @@ -25,7 +25,7 @@ export const varBgKenburns = (props?: BackgroundType) => { scale: [1, 1.25], y: [0, -15], transformOrigin: ["50% 16%", "50% top"], - transition: {duration, ease}, + transition: { duration, ease }, }, }, bottom: { @@ -33,7 +33,7 @@ export const varBgKenburns = (props?: BackgroundType) => { scale: [1, 1.25], y: [0, 15], transformOrigin: ["50% 84%", "50% bottom"], - transition: {duration, ease}, + transition: { duration, ease }, }, }, left: { @@ -42,7 +42,7 @@ export const varBgKenburns = (props?: BackgroundType) => { x: [0, 20], y: [0, 15], transformOrigin: ["16% 50%", "0% left"], - transition: {duration, ease}, + transition: { duration, ease }, }, }, right: { @@ -51,7 +51,7 @@ export const varBgKenburns = (props?: BackgroundType) => { x: [0, -20], y: [0, -15], transformOrigin: ["84% 50%", "0% right"], - transition: {duration, ease}, + transition: { duration, ease }, }, }, }; @@ -72,7 +72,7 @@ export const varBgPan = (props?: BackgroundType) => { backgroundImage: [gradient(0), gradient(0)], backgroundPosition: ["center 99%", "center 1%"], backgroundSize: ["100% 600%", "100% 600%"], - transition: {duration, ease}, + transition: { duration, ease }, }, }, right: { @@ -80,7 +80,7 @@ export const varBgPan = (props?: BackgroundType) => { backgroundPosition: ["1% center", "99% center"], backgroundImage: [gradient(270), gradient(270)], backgroundSize: ["600% 100%", "600% 100%"], - transition: {duration, ease}, + transition: { duration, ease }, }, }, bottom: { @@ -88,7 +88,7 @@ export const varBgPan = (props?: BackgroundType) => { backgroundImage: [gradient(0), gradient(0)], backgroundPosition: ["center 1%", "center 99%"], backgroundSize: ["100% 600%", "100% 600%"], - transition: {duration, ease}, + transition: { duration, ease }, }, }, left: { @@ -96,7 +96,7 @@ export const varBgPan = (props?: BackgroundType) => { backgroundPosition: ["99% center", "1% center"], backgroundImage: [gradient(270), gradient(270)], backgroundSize: ["600% 100%", "600% 100%"], - transition: {duration, ease}, + transition: { duration, ease }, }, }, }; diff --git a/src/components/animate/variants/bounce.ts b/src/components/animate/variants/bounce.ts index 3a4ca57..f69df5e 100644 --- a/src/components/animate/variants/bounce.ts +++ b/src/components/animate/variants/bounce.ts @@ -1,6 +1,6 @@ -import type {VariantsType} from "../types"; +import type { VariantsType } from "../types"; -import {varTranEnter, varTranExit} from "./transition"; +import { varTranEnter, varTranExit } from "./transition"; export const varBounce = (props?: VariantsType) => { const durationIn = props?.durationIn; @@ -15,7 +15,7 @@ export const varBounce = (props?: VariantsType) => { animate: { scale: [0.3, 1.1, 0.9, 1.03, 0.97, 1], opacity: [0, 1, 1, 1, 1, 1], - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { scale: [0.9, 1.1, 0.3], @@ -28,13 +28,13 @@ export const varBounce = (props?: VariantsType) => { y: [720, -24, 12, -4, 0], scaleY: [4, 0.9, 0.95, 0.985, 1], opacity: [0, 1, 1, 1, 1], - transition: {...varTranEnter({durationIn, easeIn})}, + transition: { ...varTranEnter({ durationIn, easeIn }) }, }, exit: { y: [12, -24, 720], scaleY: [0.985, 0.9, 3], opacity: [1, 1, 0], - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, inDown: { @@ -43,13 +43,13 @@ export const varBounce = (props?: VariantsType) => { y: [-720, 24, -12, 4, 0], scaleY: [4, 0.9, 0.95, 0.985, 1], opacity: [0, 1, 1, 1, 1], - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { y: [-12, 24, -720], scaleY: [0.985, 0.9, 3], opacity: [1, 1, 0], - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, inLeft: { @@ -58,13 +58,13 @@ export const varBounce = (props?: VariantsType) => { x: [-720, 24, -12, 4, 0], scaleX: [3, 1, 0.98, 0.995, 1], opacity: [0, 1, 1, 1, 1], - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { x: [0, 24, -720], scaleX: [1, 0.9, 2], opacity: [1, 1, 0], - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, inRight: { @@ -73,19 +73,19 @@ export const varBounce = (props?: VariantsType) => { x: [720, -24, 12, -4, 0], scaleX: [3, 1, 0.98, 0.995, 1], opacity: [0, 1, 1, 1, 1], - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { x: [0, -24, 720], scaleX: [1, 0.9, 2], opacity: [1, 1, 0], - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, // OUT out: { - animate: {scale: [0.9, 1.1, 0.3], opacity: [1, 1, 0]}, + animate: { scale: [0.9, 1.1, 0.3], opacity: [1, 1, 0] }, }, outUp: { animate: { @@ -102,10 +102,10 @@ export const varBounce = (props?: VariantsType) => { }, }, outLeft: { - animate: {x: [0, 24, -720], scaleX: [1, 0.9, 2], opacity: [1, 1, 0]}, + animate: { x: [0, 24, -720], scaleX: [1, 0.9, 2], opacity: [1, 1, 0] }, }, outRight: { - animate: {x: [0, -24, 720], scaleX: [1, 0.9, 2], opacity: [1, 1, 0]}, + animate: { x: [0, -24, 720], scaleX: [1, 0.9, 2], opacity: [1, 1, 0] }, }, }; }; diff --git a/src/components/animate/variants/fade.ts b/src/components/animate/variants/fade.ts index 09f4962..f0df037 100644 --- a/src/components/animate/variants/fade.ts +++ b/src/components/animate/variants/fade.ts @@ -1,7 +1,7 @@ -import type {VariantsType} from "../types"; +import type { VariantsType } from "../types"; // -import {varTranEnter, varTranExit} from "./transition"; +import { varTranEnter, varTranExit } from "./transition"; // ---------------------------------------------------------------------- @@ -15,119 +15,119 @@ export const varFade = (props?: VariantsType) => { return { // IN in: { - initial: {opacity: 0}, - animate: {opacity: 1, transition: varTranEnter}, - exit: {opacity: 0, transition: varTranExit}, + initial: { opacity: 0 }, + animate: { opacity: 1, transition: varTranEnter }, + exit: { opacity: 0, transition: varTranExit }, }, inUp: { - initial: {y: distance, opacity: 0}, + initial: { y: distance, opacity: 0 }, animate: { y: 0, opacity: 1, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { y: distance, opacity: 0, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, inDown: { - initial: {y: -distance, opacity: 0}, + initial: { y: -distance, opacity: 0 }, animate: { y: 0, opacity: 1, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { y: -distance, opacity: 0, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, inLeft: { - initial: {x: -distance, opacity: 0}, + initial: { x: -distance, opacity: 0 }, animate: { x: 0, opacity: 1, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { x: -distance, opacity: 0, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, inRight: { - initial: {x: distance, opacity: 0}, + initial: { x: distance, opacity: 0 }, animate: { x: 0, opacity: 1, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { x: distance, opacity: 0, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, // OUT out: { - initial: {opacity: 1}, - animate: {opacity: 0, transition: varTranEnter({durationIn, easeIn})}, - exit: {opacity: 1, transition: varTranExit({durationOut, easeOut})}, + initial: { opacity: 1 }, + animate: { opacity: 0, transition: varTranEnter({ durationIn, easeIn }) }, + exit: { opacity: 1, transition: varTranExit({ durationOut, easeOut }) }, }, outUp: { - initial: {y: 0, opacity: 1}, + initial: { y: 0, opacity: 1 }, animate: { y: -distance, opacity: 0, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { y: 0, opacity: 1, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, outDown: { - initial: {y: 0, opacity: 1}, + initial: { y: 0, opacity: 1 }, animate: { y: distance, opacity: 0, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { y: 0, opacity: 1, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, outLeft: { - initial: {x: 0, opacity: 1}, + initial: { x: 0, opacity: 1 }, animate: { x: -distance, opacity: 0, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { x: 0, opacity: 1, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, outRight: { - initial: {x: 0, opacity: 1}, + initial: { x: 0, opacity: 1 }, animate: { x: distance, opacity: 0, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { x: 0, opacity: 1, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, }; diff --git a/src/components/animate/variants/flip.ts b/src/components/animate/variants/flip.ts index 76150bf..6eef8f3 100644 --- a/src/components/animate/variants/flip.ts +++ b/src/components/animate/variants/flip.ts @@ -1,7 +1,7 @@ -import type {VariantsType} from "../types"; +import type { VariantsType } from "../types"; // -import {varTranEnter, varTranExit} from "./transition"; +import { varTranEnter, varTranExit } from "./transition"; // ---------------------------------------------------------------------- @@ -14,47 +14,47 @@ export const varFlip = (props?: VariantsType) => { return { // IN inX: { - initial: {rotateX: -180, opacity: 0}, + initial: { rotateX: -180, opacity: 0 }, animate: { rotateX: 0, opacity: 1, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { rotateX: -180, opacity: 0, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, inY: { - initial: {rotateY: -180, opacity: 0}, + initial: { rotateY: -180, opacity: 0 }, animate: { rotateY: 0, opacity: 1, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { rotateY: -180, opacity: 0, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, // OUT outX: { - initial: {rotateX: 0, opacity: 1}, + initial: { rotateX: 0, opacity: 1 }, animate: { rotateX: 70, opacity: 0, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, outY: { - initial: {rotateY: 0, opacity: 1}, + initial: { rotateY: 0, opacity: 1 }, animate: { rotateY: 70, opacity: 0, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, }; diff --git a/src/components/animate/variants/index.ts b/src/components/animate/variants/index.ts index 9ff7bf9..27498e5 100644 --- a/src/components/animate/variants/index.ts +++ b/src/components/animate/variants/index.ts @@ -1,11 +1,11 @@ -import {varBgColor, varBgKenburns, varBgPan} from "./background"; -import {varBounce} from "./bounce"; -import {varFade} from "./fade"; -import {varFlip} from "./flip"; -import {varRotate} from "./rotate"; -import {varScale} from "./scale"; -import {varSlide} from "./slide"; -import {varZoom} from "./zoom"; +import { varBgColor, varBgKenburns, varBgPan } from "./background"; +import { varBounce } from "./bounce"; +import { varFade } from "./fade"; +import { varFlip } from "./flip"; +import { varRotate } from "./rotate"; +import { varScale } from "./scale"; +import { varSlide } from "./slide"; +import { varZoom } from "./zoom"; export * from "./action"; export * from "./background"; @@ -43,11 +43,11 @@ export function getVariant(variant = "slideInUp") { fadeOutLeft: varFade().outLeft, fadeOutRight: varFade().outRight, // Zoom - zoomIn: varZoom({distance: 80}).in, - zoomInUp: varZoom({distance: 80}).inUp, - zoomInDown: varZoom({distance: 80}).inDown, - zoomInLeft: varZoom({distance: 240}).inLeft, - zoomInRight: varZoom({distance: 240}).inRight, + zoomIn: varZoom({ distance: 80 }).in, + zoomInUp: varZoom({ distance: 80 }).inUp, + zoomInDown: varZoom({ distance: 80 }).inDown, + zoomInLeft: varZoom({ distance: 240 }).inLeft, + zoomInRight: varZoom({ distance: 240 }).inRight, zoomOut: varZoom().out, zoomOutLeft: varZoom().outLeft, zoomOutRight: varZoom().outRight, @@ -87,7 +87,7 @@ export function getVariant(variant = "slideInUp") { panLeft: varBgPan().left, panRight: varBgPan().right, color2x: varBgColor(), - color3x: varBgColor({colors: ["#19dcea", "#b22cff", "#ea2222"]}), + color3x: varBgColor({ colors: ["#19dcea", "#b22cff", "#ea2222"] }), color4x: varBgColor({ colors: ["#19dcea", "#b22cff", "#ea2222", "#f5be10"], }), diff --git a/src/components/animate/variants/rotate.ts b/src/components/animate/variants/rotate.ts index d73bccb..1b66801 100644 --- a/src/components/animate/variants/rotate.ts +++ b/src/components/animate/variants/rotate.ts @@ -1,7 +1,7 @@ -import type {VariantsType} from "../types"; +import type { VariantsType } from "../types"; // -import {varTranEnter, varTranExit} from "./transition"; +import { varTranEnter, varTranExit } from "./transition"; // ---------------------------------------------------------------------- @@ -14,26 +14,26 @@ export const varRotate = (props?: VariantsType) => { return { // IN in: { - initial: {opacity: 0, rotate: -360}, + initial: { opacity: 0, rotate: -360 }, animate: { opacity: 1, rotate: 0, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { opacity: 0, rotate: -360, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, // OUT out: { - initial: {opacity: 1, rotate: 0}, + initial: { opacity: 1, rotate: 0 }, animate: { opacity: 0, rotate: -360, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, }; diff --git a/src/components/animate/variants/scale.ts b/src/components/animate/variants/scale.ts index a170e3c..354fb05 100644 --- a/src/components/animate/variants/scale.ts +++ b/src/components/animate/variants/scale.ts @@ -1,6 +1,6 @@ -import type {VariantsType} from "../types"; +import type { VariantsType } from "../types"; -import {varTranEnter, varTranExit} from "./transition"; +import { varTranEnter, varTranExit } from "./transition"; // ---------------------------------------------------------------------- @@ -13,47 +13,47 @@ export const varScale = (props?: VariantsType) => { return { // IN inX: { - initial: {scaleX: 0, opacity: 0}, + initial: { scaleX: 0, opacity: 0 }, animate: { scaleX: 1, opacity: 1, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { scaleX: 0, opacity: 0, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, inY: { - initial: {scaleY: 0, opacity: 0}, + initial: { scaleY: 0, opacity: 0 }, animate: { scaleY: 1, opacity: 1, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { scaleY: 0, opacity: 0, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, // OUT outX: { - initial: {scaleX: 1, opacity: 1}, + initial: { scaleX: 1, opacity: 1 }, animate: { scaleX: 0, opacity: 0, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, }, outY: { - initial: {scaleY: 1, opacity: 1}, + initial: { scaleY: 1, opacity: 1 }, animate: { scaleY: 0, opacity: 0, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, }, }; diff --git a/src/components/animate/variants/slide.ts b/src/components/animate/variants/slide.ts index a32e3ed..d53b150 100644 --- a/src/components/animate/variants/slide.ts +++ b/src/components/animate/variants/slide.ts @@ -1,7 +1,7 @@ -import type {VariantsType} from "../types"; +import type { VariantsType } from "../types"; // -import {varTranEnter, varTranExit} from "./transition"; +import { varTranEnter, varTranExit } from "./transition"; // ---------------------------------------------------------------------- @@ -15,58 +15,58 @@ export const varSlide = (props?: VariantsType) => { return { // IN inUp: { - initial: {y: distance}, - animate: {y: 0, transition: varTranEnter({durationIn, easeIn})}, - exit: {y: distance, transition: varTranExit({durationOut, easeOut})}, + initial: { y: distance }, + animate: { y: 0, transition: varTranEnter({ durationIn, easeIn }) }, + exit: { y: distance, transition: varTranExit({ durationOut, easeOut }) }, }, inDown: { - initial: {y: -distance}, - animate: {y: 0, transition: varTranEnter({durationIn, easeIn})}, - exit: {y: -distance, transition: varTranExit({durationOut, easeOut})}, + initial: { y: -distance }, + animate: { y: 0, transition: varTranEnter({ durationIn, easeIn }) }, + exit: { y: -distance, transition: varTranExit({ durationOut, easeOut }) }, }, inLeft: { - initial: {x: -distance}, - animate: {x: 0, transition: varTranEnter({durationIn, easeIn})}, - exit: {x: -distance, transition: varTranExit({durationOut, easeOut})}, + initial: { x: -distance }, + animate: { x: 0, transition: varTranEnter({ durationIn, easeIn }) }, + exit: { x: -distance, transition: varTranExit({ durationOut, easeOut }) }, }, inRight: { - initial: {x: distance}, - animate: {x: 0, transition: varTranEnter({durationIn, easeIn})}, - exit: {x: distance, transition: varTranExit({durationOut, easeOut})}, + initial: { x: distance }, + animate: { x: 0, transition: varTranEnter({ durationIn, easeIn }) }, + exit: { x: distance, transition: varTranExit({ durationOut, easeOut }) }, }, // OUT outUp: { - initial: {y: 0}, + initial: { y: 0 }, animate: { y: -distance, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, - exit: {y: 0, transition: varTranExit({durationOut, easeOut})}, + exit: { y: 0, transition: varTranExit({ durationOut, easeOut }) }, }, outDown: { - initial: {y: 0}, + initial: { y: 0 }, animate: { y: distance, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, - exit: {y: 0, transition: varTranExit({durationOut, easeOut})}, + exit: { y: 0, transition: varTranExit({ durationOut, easeOut }) }, }, outLeft: { - initial: {x: 0}, + initial: { x: 0 }, animate: { x: -distance, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, - exit: {x: 0, transition: varTranExit({durationOut, easeOut})}, + exit: { x: 0, transition: varTranExit({ durationOut, easeOut }) }, }, outRight: { - initial: {x: 0}, + initial: { x: 0 }, animate: { x: distance, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, - exit: {x: 0, transition: varTranExit({durationOut, easeOut})}, + exit: { x: 0, transition: varTranExit({ durationOut, easeOut }) }, }, }; }; diff --git a/src/components/animate/variants/transition.ts b/src/components/animate/variants/transition.ts index b435523..cb4bf1c 100644 --- a/src/components/animate/variants/transition.ts +++ b/src/components/animate/variants/transition.ts @@ -1,4 +1,4 @@ -import type {TranEnterType, TranExitType, TranHoverType} from "../types"; +import type { TranEnterType, TranExitType, TranHoverType } from "../types"; // https://www.framer.com/motion/transition/ // A transition defines how values animate from one state to another. @@ -7,19 +7,19 @@ export const varTranHover = (props?: TranHoverType) => { const duration = props?.duration || 0.32; const ease = props?.ease || [0.43, 0.13, 0.23, 0.96]; - return {duration, ease}; + return { duration, ease }; }; export const varTranEnter = (props?: TranEnterType) => { const duration = props?.durationIn || 0.64; const ease = props?.easeIn || [0.43, 0.13, 0.23, 0.96]; - return {duration, ease}; + return { duration, ease }; }; export const varTranExit = (props?: TranExitType) => { const duration = props?.durationOut || 0.48; const ease = props?.easeOut || [0.43, 0.13, 0.23, 0.96]; - return {duration, ease}; + return { duration, ease }; }; diff --git a/src/components/animate/variants/zoom.ts b/src/components/animate/variants/zoom.ts index a2fdcc2..4ad5352 100644 --- a/src/components/animate/variants/zoom.ts +++ b/src/components/animate/variants/zoom.ts @@ -1,7 +1,7 @@ -import type {VariantsType} from "../types"; +import type { VariantsType } from "../types"; // -import {varTranEnter, varTranExit} from "./transition"; +import { varTranEnter, varTranExit } from "./transition"; // ---------------------------------------------------------------------- @@ -15,122 +15,122 @@ export const varZoom = (props?: VariantsType) => { return { // IN in: { - initial: {scale: 0, opacity: 0}, + initial: { scale: 0, opacity: 0 }, animate: { scale: 1, opacity: 1, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { scale: 0, opacity: 0, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, inUp: { - initial: {scale: 0, opacity: 0, translateY: distance}, + initial: { scale: 0, opacity: 0, translateY: distance }, animate: { scale: 1, opacity: 1, translateY: 0, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { scale: 0, opacity: 0, translateY: distance, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, inDown: { - initial: {scale: 0, opacity: 0, translateY: -distance}, + initial: { scale: 0, opacity: 0, translateY: -distance }, animate: { scale: 1, opacity: 1, translateY: 0, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { scale: 0, opacity: 0, translateY: -distance, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, inLeft: { - initial: {scale: 0, opacity: 0, translateX: -distance}, + initial: { scale: 0, opacity: 0, translateX: -distance }, animate: { scale: 1, opacity: 1, translateX: 0, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { scale: 0, opacity: 0, translateX: -distance, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, inRight: { - initial: {scale: 0, opacity: 0, translateX: distance}, + initial: { scale: 0, opacity: 0, translateX: distance }, animate: { scale: 1, opacity: 1, translateX: 0, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, exit: { scale: 0, opacity: 0, translateX: distance, - transition: varTranExit({durationOut, easeOut}), + transition: varTranExit({ durationOut, easeOut }), }, }, // OUT out: { - initial: {scale: 1, opacity: 1}, + initial: { scale: 1, opacity: 1 }, animate: { scale: 0, opacity: 0, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, }, outUp: { - initial: {scale: 1, opacity: 1}, + initial: { scale: 1, opacity: 1 }, animate: { scale: 0, opacity: 0, translateY: -distance, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, }, outDown: { - initial: {scale: 1, opacity: 1}, + initial: { scale: 1, opacity: 1 }, animate: { scale: 0, opacity: 0, translateY: distance, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, }, outLeft: { - initial: {scale: 1, opacity: 1}, + initial: { scale: 1, opacity: 1 }, animate: { scale: 0, opacity: 0, translateX: -distance, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, }, outRight: { - initial: {scale: 1, opacity: 1}, + initial: { scale: 1, opacity: 1 }, animate: { scale: 0, opacity: 0, translateX: distance, - transition: varTranEnter({durationIn, easeIn}), + transition: varTranEnter({ durationIn, easeIn }), }, }, }; diff --git a/src/components/loading/index.tsx b/src/components/loading/index.tsx index 0091c3e..659ff12 100644 --- a/src/components/loading/index.tsx +++ b/src/components/loading/index.tsx @@ -1,2 +1,2 @@ -export {LineLoading} from "./line-loading"; -export {RouteLoading} from "./route-loading"; \ No newline at end of file +export { LineLoading } from "./line-loading"; +export { RouteLoading } from "./route-loading"; diff --git a/src/components/loading/line-loading.css b/src/components/loading/line-loading.css index 8fa8437..d919714 100644 --- a/src/components/loading/line-loading.css +++ b/src/components/loading/line-loading.css @@ -9,4 +9,4 @@ .animate-loading { animation: loading 1.5s ease-in-out infinite; -} \ No newline at end of file +} diff --git a/src/components/loading/line-loading.tsx b/src/components/loading/line-loading.tsx index e5a3dd2..56c4c2c 100644 --- a/src/components/loading/line-loading.tsx +++ b/src/components/loading/line-loading.tsx @@ -1,21 +1,20 @@ import "./line-loading.css"; -import {useTheme} from 'next-themes'; -import {cn} from "@/lib/utils" - +import { useTheme } from "next-themes"; +import { cn } from "@/lib/utils"; export function LineLoading() { - const {theme} = useTheme(); + const { theme } = useTheme(); return ( -
-
+
+
); -} \ No newline at end of file +} diff --git a/src/components/loading/route-loading.tsx b/src/components/loading/route-loading.tsx index 324ffe3..e4d1bcb 100644 --- a/src/components/loading/route-loading.tsx +++ b/src/components/loading/route-loading.tsx @@ -1,5 +1,5 @@ -import {Progress} from "@/components/ui/progress"; -import {useEffect, useState} from "react"; +import { Progress } from "@/components/ui/progress"; +import { useEffect, useState } from "react"; export function RouteLoading() { const [progress, setProgress] = useState(0); @@ -55,7 +55,7 @@ export function RouteLoading() { return progress > 0 ? (
- +
) : null; } diff --git a/src/components/table/body.tsx b/src/components/table/body.tsx index eb8ec5e..3d3f6ba 100644 --- a/src/components/table/body.tsx +++ b/src/components/table/body.tsx @@ -3,27 +3,25 @@ import { flexRender, type PaginationState, type Row, - type Table -} from '@tanstack/react-table' -import {TableBody, TableCell, TableRow} from '@/components/ui/table' -import {Skeleton} from "@/components/ui/skeleton" -import {Checkbox} from '@/components/ui/checkbox' -import {useTranslation} from "react-i18next"; -import {useState} from "react"; + type Table, +} from "@tanstack/react-table"; +import { TableBody, TableCell, TableRow } from "@/components/ui/table"; +import { Skeleton } from "@/components/ui/skeleton"; +import { Checkbox } from "@/components/ui/checkbox"; +import { useTranslation } from "react-i18next"; +import { useState } from "react"; -function DataRow( - { - row, - verticalSpacing, - horizontalSpacing, - onClick - }: { - row: Row, - verticalSpacing: number, - horizontalSpacing: number, - onClick?: (row: Row) => void - } -) { +function DataRow({ + row, + verticalSpacing, + horizontalSpacing, + onClick, +}: { + row: Row; + verticalSpacing: number; + horizontalSpacing: number; + onClick?: (row: Row) => void; +}) { const [disableGroup, setDisableGroup] = useState(false); const selected = row.getIsSelected(); const borderSize = 2; @@ -31,8 +29,8 @@ function DataRow( return ( { const target = event.target as HTMLElement; const tag = target.nodeName; @@ -45,15 +43,15 @@ function DataRow( className="!bg-transparent pointer-events-auto w-0" onMouseEnter={() => setDisableGroup(true)} onMouseLeave={() => setDisableGroup(false)} - onClick={e => e.stopPropagation()} + onClick={(e) => e.stopPropagation()} style={{ paddingRight: 20, - paddingLeft: 0 + paddingLeft: 0, }} > row.toggleSelected(!!value)} + onCheckedChange={(value) => row.toggleSelected(!!value)} aria-label="Select row" className="data-[state=checked]:border-blue-600 data-[state=checked]:bg-blue-600 data-[state=checked]:text-white dark:data-[state=checked]:border-blue-700 dark:data-[state=checked]:bg-blue-700" /> @@ -63,11 +61,20 @@ function DataRow( const isFirst = index === 0; const isLast = index === row.getVisibleCells().length - 1; const selectedEdgeClasses = selected - ? `border-t border-b border-blue-600` : ``; - const firstExtra = isFirst && selected ? `border-l rounded-l-xl` : - (isFirst ? 'rounded-l-xl' : ''); - const lastExtra = isLast && selected ? `border-r rounded-r-xl` : - (isLast ? 'rounded-r-xl' : ''); + ? `border-t border-b border-blue-600` + : ``; + const firstExtra = + isFirst && selected + ? `border-l rounded-l-xl` + : isFirst + ? "rounded-l-xl" + : ""; + const lastExtra = + isLast && selected + ? `border-r rounded-r-xl` + : isLast + ? "rounded-r-xl" + : ""; return ( ( borderRightWidth: selected && isLast ? borderSize : 0, paddingTop: verticalSpacing - (selected ? borderSize : 0), paddingBottom: verticalSpacing - (selected ? borderSize : 0), - paddingLeft: horizontalSpacing - (isFirst && selected ? borderSize : 0), - paddingRight: horizontalSpacing - (isLast && selected ? borderSize : 0) + paddingLeft: + horizontalSpacing - (isFirst && selected ? borderSize : 0), + paddingRight: + horizontalSpacing - (isLast && selected ? borderSize : 0), }} > {flexRender(cell.column.columnDef.cell, cell.getContext())} @@ -94,41 +103,38 @@ function DataRow( ); } - -export default function DataTableBody( - { - table, - columns, - isLoading, - pagination, - onClick - }: { - table: Table, - columns: ColumnDef[], - isLoading?: boolean, - pagination: PaginationState, - onClick?: (entry: T) => void - } -) { - const {t} = useTranslation(); +export default function DataTableBody({ + table, + columns, + isLoading, + pagination, + onClick, +}: { + table: Table; + columns: ColumnDef[]; + isLoading?: boolean; + pagination: PaginationState; + onClick?: (entry: T) => void; +}) { + const { t } = useTranslation(); const verticalSpacing = pagination.pageSize <= 5 ? 40 : 30; const horizontalSpacing = pagination.pageSize <= 5 ? 30 : 25; if (isLoading) { return ( - {Array.from({length: pagination.pageSize}).map((_, rowIndex) => ( + {Array.from({ length: pagination.pageSize }).map((_, rowIndex) => ( - + - {Array.from({length: columns.length}).map((_, cellIndex) => ( + {Array.from({ length: columns.length }).map((_, cellIndex) => ( ( paddingTop: verticalSpacing, paddingBottom: verticalSpacing, paddingLeft: horizontalSpacing, - paddingRight: horizontalSpacing + paddingRight: horizontalSpacing, }} > - + ))} ))} - ) + ); } - const rows = table.getRowModel().rows + const rows = table.getRowModel().rows; return ( - {rows.length ? rows.map(row => ( - onClick ? onClick(row.original) : {}} - /> - )) : ( + {rows.length ? ( + rows.map((row) => ( + (onClick ? onClick(row.original) : {})} + /> + )) + ) : ( {t("table.empty")} @@ -167,5 +175,5 @@ export default function DataTableBody( )} - ) + ); } diff --git a/src/components/table/bottom-bar.tsx b/src/components/table/bottom-bar.tsx index bcbde3e..a53c89b 100644 --- a/src/components/table/bottom-bar.tsx +++ b/src/components/table/bottom-bar.tsx @@ -1,29 +1,25 @@ -import type { - Table, -} from "@tanstack/react-table"; -import {useSidebar} from "@/components/ui/sidebar.tsx"; -import {useTranslation} from "react-i18next"; -import type {LucideIcon} from "lucide-react"; +import type { Table } from "@tanstack/react-table"; +import { useSidebar } from "@/components/ui/sidebar.tsx"; +import { useTranslation } from "react-i18next"; +import type { LucideIcon } from "lucide-react"; export interface DataTableBottomBarAction { name: string; icon: LucideIcon; - onClick?: (entries: T[]) => void + onClick?: (entries: T[]) => void; } -export default function DataTableBottomBar( - { - table, - actions, - }: { - table: Table - actions: DataTableBottomBarAction[] - } -) { +export default function DataTableBottomBar({ + table, + actions, +}: { + table: Table; + actions: DataTableBottomBarAction[]; +}) { const selectedRows = table.getSelectedRowModel().rows; const selectedCount = selectedRows.length; - const {t} = useTranslation(); - const {open} = useSidebar() + const { t } = useTranslation(); + const { open } = useSidebar(); return (
( >
@@ -49,7 +47,7 @@ export default function DataTableBottomBar( @@ -55,46 +53,53 @@ export default function DataTableColumnSelection(
setSearchQuery(e.target.value)} + onChange={(e) => setSearchQuery(e.target.value)} className="pl-8" placeholder={t("table.columns.search")} - onKeyDown={e => e.stopPropagation()} + onKeyDown={(e) => e.stopPropagation()} /> - +
- - {table.getAllColumns() + + {table + .getAllColumns() .filter((column) => column.getCanHide()) .filter((column) => { - if (!searchQuery) return true - const header = column.columnDef.header - if (typeof header !== "string") return false - return t(header).toLowerCase().includes(searchQuery.toLowerCase()) + if (!searchQuery) return true; + const header = column.columnDef.header; + if (typeof header !== "string") return false; + return t(header).toLowerCase().includes(searchQuery.toLowerCase()); }) .map((column) => ( column.toggleVisibility(value)} - onSelect={e => e.preventDefault()} + onCheckedChange={(value) => column.toggleVisibility(value)} + onSelect={(e) => e.preventDefault()} > - {typeof column.columnDef.header === "string" ? t(column.columnDef.header) : ""} + {typeof column.columnDef.header === "string" + ? t(column.columnDef.header) + : ""} ))} - - { - table.resetColumnVisibility(); - setSearchQuery("") - }}> - {t("table.columns.all")} + + { + table.resetColumnVisibility(); + setSearchQuery(""); + }} + > + {t("table.columns.all")} - { - table.setColumnVisibility(visibilityState ?? {}); - setSearchQuery("") - }}> - {t("table.columns.reset")} + { + table.setColumnVisibility(visibilityState ?? {}); + setSearchQuery(""); + }} + > + {t("table.columns.reset")} - ) -} \ No newline at end of file + ); +} diff --git a/src/components/table/filter.tsx b/src/components/table/filter.tsx index 128aa9c..79e8de1 100644 --- a/src/components/table/filter.tsx +++ b/src/components/table/filter.tsx @@ -1,22 +1,22 @@ -'use client' +"use client"; -import {useEffect, useState} from 'react'; -import {type Table} from '@tanstack/react-table'; -import {Button} from '@/components/ui/button'; +import { useEffect, useState } from "react"; +import { type Table } from "@tanstack/react-table"; +import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, - DropdownMenuTrigger -} from '@/components/ui/dropdown-menu'; + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; import { Select, SelectContent, SelectItem, SelectTrigger, - SelectValue -} from '@/components/ui/select'; -import {Filter} from 'lucide-react'; -import {useTranslation} from 'react-i18next'; + SelectValue, +} from "@/components/ui/select"; +import { Filter } from "lucide-react"; +import { useTranslation } from "react-i18next"; export interface DataTableFilterOption { column: string; @@ -27,35 +27,37 @@ interface DataTableFiltersProps { table: Table; name: string; filters: DataTableFilterOption[]; - defaultFilters?: Record + defaultFilters?: Record; } -export function DataTableFilters( - { - table, - name, - filters, - defaultFilters = {}, - }: DataTableFiltersProps -) { - const {t} = useTranslation(); +export function DataTableFilters({ + table, + name, + filters, + defaultFilters = {}, +}: DataTableFiltersProps) { + const { t } = useTranslation(); const loadFilters = (): Record => { - if (typeof window === 'undefined') return defaultFilters; + if (typeof window === "undefined") return defaultFilters; try { const stored = localStorage.getItem(`table_${name}_filters`); const saved = stored ? JSON.parse(stored) : {}; - return {...defaultFilters, ...saved}; + return { ...defaultFilters, ...saved }; } catch { return defaultFilters; } }; - const [selectedValues, setSelectedValues] = useState>(loadFilters); + const [selectedValues, setSelectedValues] = + useState>(loadFilters); useEffect(() => { - if (typeof window === 'undefined') return; - localStorage.setItem(`table_${name}_filters`, JSON.stringify(selectedValues)); + if (typeof window === "undefined") return; + localStorage.setItem( + `table_${name}_filters`, + JSON.stringify(selectedValues), + ); }, [selectedValues, name]); useEffect(() => { @@ -75,11 +77,11 @@ export function DataTableFilters( - {filters.map(filter => { + {filters.map((filter) => { const column = table.getColumn(filter.column); if (!column) { return null; @@ -87,18 +89,22 @@ export function DataTableFilters( return (
- {typeof column.columnDef.header === "string" ? - t(column.columnDef.header) : null} + {typeof column.columnDef.header === "string" + ? t(column.columnDef.header) + : null} setGlobalFilter(String(e.target.value))} + onChange={(e) => setGlobalFilter(String(e.target.value))} className="max-w-sm peer pl-9" />
- {filters && + {filters && ( - } + )} ( - + ( {!isLoading && ( - + )} - ) -} \ No newline at end of file + ); +} diff --git a/src/components/table/pagination.tsx b/src/components/table/pagination.tsx index c032db1..2615028 100644 --- a/src/components/table/pagination.tsx +++ b/src/components/table/pagination.tsx @@ -1,47 +1,50 @@ -'use client' +"use client"; -import {usePagination} from '@/hooks/use-pagination' -import {Button} from '@/components/ui/button' +import { usePagination } from "@/hooks/use-pagination"; +import { Button } from "@/components/ui/button"; import { Pagination, PaginationContent, PaginationEllipsis, - PaginationItem -} from '@/components/ui/pagination' + PaginationItem, +} from "@/components/ui/pagination"; import { Select, SelectContent, SelectItem, SelectTrigger, - SelectValue -} from '@/components/ui/select' -import {ChevronLeftIcon, ChevronRightIcon} from 'lucide-react' -import {useTranslation} from "react-i18next"; -import type {PaginationState, Table} from "@tanstack/react-table"; + SelectValue, +} from "@/components/ui/select"; +import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"; +import { useTranslation } from "react-i18next"; +import type { PaginationState, Table } from "@tanstack/react-table"; -export default function DataTablePagination( - { - table, - pagination - }: { - table: Table, - pagination: PaginationState - } -) { - const {t} = useTranslation(); - const {pages, showLeftEllipsis, showRightEllipsis} = usePagination({ +export default function DataTablePagination({ + table, + pagination, +}: { + table: Table; + pagination: PaginationState; +}) { + const { t } = useTranslation(); + const { pages, showLeftEllipsis, showRightEllipsis } = usePagination({ currentPage: table.getState().pagination.pageIndex + 1, totalPages: table.getPageCount(), - paginationItemsToDisplay: 5 - }) + paginationItemsToDisplay: 5, + }); return (
-

- {t("table.page")} {table.getState().pagination.pageIndex + 1} {t("table.of")}{' '} - {table.getPageCount()} +

+ {t("table.page")}{" "} + + {table.getState().pagination.pageIndex + 1} + {" "} + {t("table.of")}{" "} + {table.getPageCount()}

@@ -53,30 +56,36 @@ export default function DataTablePagination( onClick={() => table.previousPage()} disabled={!table.getCanPreviousPage()} > - + - {showLeftEllipsis && - } + {showLeftEllipsis && ( + + + + )} {pages.map((p: number) => { - const active = p === pagination.pageIndex + 1 + const active = p === pagination.pageIndex + 1; return ( - ) + ); })} - {showRightEllipsis && - } + {showRightEllipsis && ( + + + + )} - table.setPageSize(Number(v))} + > + + + - {[1, 5, 10, 25, 50].map(size => ( - + {[1, 5, 10, 25, 50].map((size) => ( + {size} / {t("table.page")} ))}
- ) + ); } diff --git a/src/components/ui/accordion.tsx b/src/components/ui/accordion.tsx index 7b3af97..720bff5 100644 --- a/src/components/ui/accordion.tsx +++ b/src/components/ui/accordion.tsx @@ -1,56 +1,55 @@ -import * as React from "react" -import * as AccordionPrimitive from "@radix-ui/react-accordion" -import {ChevronDownIcon} from "lucide-react" +import * as React from "react"; +import * as AccordionPrimitive from "@radix-ui/react-accordion"; +import { ChevronDownIcon } from "lucide-react"; -import {cn} from "@/lib/utils" +import { cn } from "@/lib/utils"; function Accordion({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function AccordionItem({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function AccordionTrigger({ - className, - children, - ...props - }: React.ComponentProps) { + className, + children, + ...props +}: React.ComponentProps) { return ( svg]:rotate-180", - className + className, )} {...props} > {children} - + - ) + ); } function AccordionContent({ - className, - children, - ...props - }: React.ComponentProps) { + className, + children, + ...props +}: React.ComponentProps) { return (
{children}
- ) + ); } -export {Accordion, AccordionItem, AccordionTrigger, AccordionContent} +export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }; diff --git a/src/components/ui/alert-dialog.tsx b/src/components/ui/alert-dialog.tsx index 3b9a09d..5284517 100644 --- a/src/components/ui/alert-dialog.tsx +++ b/src/components/ui/alert-dialog.tsx @@ -1,143 +1,143 @@ -import * as React from "react" -import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog" +import * as React from "react"; +import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"; -import {cn} from "@/lib/utils" -import {buttonVariants} from "@/components/ui/button" +import { cn } from "@/lib/utils"; +import { buttonVariants } from "@/components/ui/button"; function AlertDialog({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function AlertDialogTrigger({ - ...props - }: React.ComponentProps) { + ...props +}: React.ComponentProps) { return ( - ) + ); } function AlertDialogPortal({ - ...props - }: React.ComponentProps) { + ...props +}: React.ComponentProps) { return ( - ) + ); } function AlertDialogOverlay({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function AlertDialogContent({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - + - ) + ); } function AlertDialogHeader({ - className, - ...props - }: React.ComponentProps<"div">) { + className, + ...props +}: React.ComponentProps<"div">) { return (
- ) + ); } function AlertDialogFooter({ - className, - ...props - }: React.ComponentProps<"div">) { + className, + ...props +}: React.ComponentProps<"div">) { return (
- ) + ); } function AlertDialogTitle({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function AlertDialogDescription({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function AlertDialogAction({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function AlertDialogCancel({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } export { @@ -152,4 +152,4 @@ export { AlertDialogDescription, AlertDialogAction, AlertDialogCancel, -} +}; diff --git a/src/components/ui/alert.tsx b/src/components/ui/alert.tsx index bc8dd4f..aa7de24 100644 --- a/src/components/ui/alert.tsx +++ b/src/components/ui/alert.tsx @@ -1,7 +1,7 @@ -import * as React from "react" -import {cva, type VariantProps} from "class-variance-authority" +import * as React from "react"; +import { cva, type VariantProps } from "class-variance-authority"; -import {cn} from "@/lib/utils" +import { cn } from "@/lib/utils"; const alertVariants = cva( "relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current", @@ -16,51 +16,51 @@ const alertVariants = cva( defaultVariants: { variant: "default", }, - } -) + }, +); function Alert({ - className, - variant, - ...props - }: React.ComponentProps<"div"> & VariantProps) { + className, + variant, + ...props +}: React.ComponentProps<"div"> & VariantProps) { return (
- ) + ); } -function AlertTitle({className, ...props}: React.ComponentProps<"div">) { +function AlertTitle({ className, ...props }: React.ComponentProps<"div">) { return (
- ) + ); } function AlertDescription({ - className, - ...props - }: React.ComponentProps<"div">) { + className, + ...props +}: React.ComponentProps<"div">) { return (
- ) + ); } -export {Alert, AlertTitle, AlertDescription} +export { Alert, AlertTitle, AlertDescription }; diff --git a/src/components/ui/aspect-ratio.tsx b/src/components/ui/aspect-ratio.tsx index 39a4392..c16d6bc 100644 --- a/src/components/ui/aspect-ratio.tsx +++ b/src/components/ui/aspect-ratio.tsx @@ -1,11 +1,11 @@ -"use client" +"use client"; -import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio" +import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"; function AspectRatio({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } -export {AspectRatio} +export { AspectRatio }; diff --git a/src/components/ui/avatar.tsx b/src/components/ui/avatar.tsx index 840e14a..dc33372 100644 --- a/src/components/ui/avatar.tsx +++ b/src/components/ui/avatar.tsx @@ -1,51 +1,51 @@ -import * as React from "react" -import * as AvatarPrimitive from "@radix-ui/react-avatar" +import * as React from "react"; +import * as AvatarPrimitive from "@radix-ui/react-avatar"; -import {cn} from "@/lib/utils" +import { cn } from "@/lib/utils"; function Avatar({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function AvatarImage({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function AvatarFallback({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } -export {Avatar, AvatarImage, AvatarFallback} +export { Avatar, AvatarImage, AvatarFallback }; diff --git a/src/components/ui/badge.tsx b/src/components/ui/badge.tsx index 25593df..55f8352 100644 --- a/src/components/ui/badge.tsx +++ b/src/components/ui/badge.tsx @@ -1,8 +1,8 @@ -import * as React from "react" -import {Slot} from "@radix-ui/react-slot" -import {cva, type VariantProps} from "class-variance-authority" +import * as React from "react"; +import { Slot } from "@radix-ui/react-slot"; +import { cva, type VariantProps } from "class-variance-authority"; -import {cn} from "@/lib/utils" +import { cn } from "@/lib/utils"; const badgeVariants = cva( "inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden", @@ -22,25 +22,25 @@ const badgeVariants = cva( defaultVariants: { variant: "default", }, - } -) + }, +); function Badge({ - className, - variant, - asChild = false, - ...props - }: React.ComponentProps<"span"> & + className, + variant, + asChild = false, + ...props +}: React.ComponentProps<"span"> & VariantProps & { asChild?: boolean }) { - const Comp = asChild ? Slot : "span" + const Comp = asChild ? Slot : "span"; return ( - ) + ); } -export {Badge, badgeVariants} +export { Badge, badgeVariants }; diff --git a/src/components/ui/breadcrumb.tsx b/src/components/ui/breadcrumb.tsx index d7e38b3..f63ae19 100644 --- a/src/components/ui/breadcrumb.tsx +++ b/src/components/ui/breadcrumb.tsx @@ -1,44 +1,44 @@ -import * as React from "react" -import {Slot} from "@radix-ui/react-slot" -import {ChevronRight, MoreHorizontal} from "lucide-react" +import * as React from "react"; +import { Slot } from "@radix-ui/react-slot"; +import { ChevronRight, MoreHorizontal } from "lucide-react"; -import {cn} from "@/lib/utils" +import { cn } from "@/lib/utils"; -function Breadcrumb({...props}: React.ComponentProps<"nav">) { - return
- ) + ); }, ...components, }} {...props} /> - ) + ); } function CalendarDayButton({ - className, - day, - modifiers, - ...props - }: React.ComponentProps) { - const defaultClassNames = getDefaultClassNames() + className, + day, + modifiers, + ...props +}: React.ComponentProps) { + const defaultClassNames = getDefaultClassNames(); - const ref = React.useRef(null) + const ref = React.useRef(null); React.useEffect(() => { - if (modifiers.focused) ref.current?.focus() - }, [modifiers.focused]) + if (modifiers.focused) ref.current?.focus(); + }, [modifiers.focused]); return ( - ) + ); } function CarouselNext({ - className, - variant = "outline", - size = "icon", - ...props - }: React.ComponentProps) { - const {orientation, scrollNext, canScrollNext} = useCarousel() + className, + variant = "outline", + size = "icon", + ...props +}: React.ComponentProps) { + const { orientation, scrollNext, canScrollNext } = useCarousel(); return ( - ) + ); } export { @@ -241,4 +241,4 @@ export { CarouselItem, CarouselPrevious, CarouselNext, -} +}; diff --git a/src/components/ui/chart.tsx b/src/components/ui/chart.tsx index 00c1899..9137a2e 100644 --- a/src/components/ui/chart.tsx +++ b/src/components/ui/chart.tsx @@ -1,81 +1,81 @@ -"use client" +"use client"; -import * as React from "react" -import * as RechartsPrimitive from "recharts" +import * as React from "react"; +import * as RechartsPrimitive from "recharts"; -import {cn} from "@/lib/utils" +import { cn } from "@/lib/utils"; // Format: { THEME_NAME: CSS_SELECTOR } -const THEMES = {light: "", dark: ".dark"} as const +const THEMES = { light: "", dark: ".dark" } as const; export type ChartConfig = { [k in string]: { - label?: React.ReactNode - icon?: React.ComponentType -} & ( - | { color?: string; theme?: never } - | { color?: never; theme: Record } - ) -} + label?: React.ReactNode; + icon?: React.ComponentType; + } & ( + | { color?: string; theme?: never } + | { color?: never; theme: Record } + ); +}; type ChartContextProps = { - config: ChartConfig -} + config: ChartConfig; +}; -const ChartContext = React.createContext(null) +const ChartContext = React.createContext(null); function useChart() { - const context = React.useContext(ChartContext) + const context = React.useContext(ChartContext); if (!context) { - throw new Error("useChart must be used within a ") + throw new Error("useChart must be used within a "); } - return context + return context; } function ChartContainer({ - id, - className, - children, - config, - ...props - }: React.ComponentProps<"div"> & { - config: ChartConfig + id, + className, + children, + config, + ...props +}: React.ComponentProps<"div"> & { + config: ChartConfig; children: React.ComponentProps< typeof RechartsPrimitive.ResponsiveContainer - >["children"] + >["children"]; }) { - const uniqueId = React.useId() - const chartId = `chart-${id || uniqueId.replace(/:/g, "")}` + const uniqueId = React.useId(); + const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`; return ( - +
- + {children}
- ) + ); } -const ChartStyle = ({id, config}: { id: string; config: ChartConfig }) => { +const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => { const colorConfig = Object.entries(config).filter( - ([, config]) => config.theme || config.color - ) + ([, config]) => config.theme || config.color, + ); if (!colorConfig.length) { - return null + return null; } return ( @@ -86,74 +86,74 @@ const ChartStyle = ({id, config}: { id: string; config: ChartConfig }) => { ([theme, prefix]) => ` ${prefix} [data-chart=${id}] { ${colorConfig - .map(([key, itemConfig]) => { - const color = - itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || - itemConfig.color - return color ? ` --color-${key}: ${color};` : null - }) - .join("\n")} + .map(([key, itemConfig]) => { + const color = + itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || + itemConfig.color; + return color ? ` --color-${key}: ${color};` : null; + }) + .join("\n")} } -` +`, ) .join("\n"), }} /> - ) -} + ); +}; -const ChartTooltip = RechartsPrimitive.Tooltip +const ChartTooltip = RechartsPrimitive.Tooltip; function ChartTooltipContent({ - active, - payload, - className, - indicator = "dot", - hideLabel = false, - hideIndicator = false, - label, - labelFormatter, - labelClassName, - formatter, - color, - nameKey, - labelKey, - }: React.ComponentProps & + active, + payload, + className, + indicator = "dot", + hideLabel = false, + hideIndicator = false, + label, + labelFormatter, + labelClassName, + formatter, + color, + nameKey, + labelKey, +}: Partial & React.ComponentProps<"div"> & { - hideLabel?: boolean - hideIndicator?: boolean - indicator?: "line" | "dot" | "dashed" - nameKey?: string - labelKey?: string -}) { - const {config} = useChart() + hideLabel?: boolean; + hideIndicator?: boolean; + indicator?: "line" | "dot" | "dashed"; + nameKey?: string; + labelKey?: string; + }) { + const { config } = useChart(); const tooltipLabel = React.useMemo(() => { if (hideLabel || !payload?.length) { - return null + return null; } - const [item] = payload - const key = `${labelKey || item?.dataKey || item?.name || "value"}` - const itemConfig = getPayloadConfigFromPayload(config, item, key) + const [item] = payload; + const key = `${labelKey || item?.dataKey || item?.name || "value"}`; + const itemConfig = getPayloadConfigFromPayload(config, item, key); const value = !labelKey && typeof label === "string" ? config[label as keyof typeof config]?.label || label - : itemConfig?.label + : itemConfig?.label; if (labelFormatter) { return (
{labelFormatter(value, payload)}
- ) + ); } if (!value) { - return null + return null; } - return
{value}
+ return
{value}
; }, [ label, labelFormatter, @@ -162,19 +162,19 @@ function ChartTooltipContent({ labelClassName, config, labelKey, - ]) + ]); if (!active || !payload?.length) { - return null + return null; } - const nestLabel = payload.length === 1 && indicator !== "dot" + const nestLabel = payload.length === 1 && indicator !== "dot"; return (
{!nestLabel ? tooltipLabel : null} @@ -182,16 +182,16 @@ function ChartTooltipContent({ {payload .filter((item) => item.type !== "none") .map((item, index) => { - const key = `${nameKey || item.name || item.dataKey || "value"}` - const itemConfig = getPayloadConfigFromPayload(config, item, key) - const indicatorColor = color || item.payload.fill || item.color + const key = `${nameKey || item.name || item.dataKey || "value"}`; + const itemConfig = getPayloadConfigFromPayload(config, item, key); + const indicatorColor = color || item.payload.fill || item.color; return (
svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", - indicator === "dot" && "items-center" + indicator === "dot" && "items-center", )} > {formatter && item?.value !== undefined && item.name ? ( @@ -199,7 +199,7 @@ function ChartTooltipContent({ ) : ( <> {itemConfig?.icon ? ( - + ) : ( !hideIndicator && (
@@ -235,8 +235,7 @@ function ChartTooltipContent({
{item.value && ( - + {item.value.toLocaleString()} )} @@ -244,30 +243,31 @@ function ChartTooltipContent({ )}
- ) + ); })}
- ) + ); } -const ChartLegend = RechartsPrimitive.Legend +const ChartLegend = RechartsPrimitive.Legend; function ChartLegendContent({ - className, - hideIcon = false, - payload, - verticalAlign = "bottom", - nameKey, - }: React.ComponentProps<"div"> & - Pick & { - hideIcon?: boolean - nameKey?: string + className, + hideIcon = false, + payload, + verticalAlign = "bottom", + nameKey, +}: React.ComponentProps<"div"> & { + hideIcon?: boolean; + nameKey?: string; + payload?: RechartsPrimitive.LegendPayload[]; + verticalAlign?: RechartsPrimitive.LegendProps["verticalAlign"]; }) { - const {config} = useChart() + const { config } = useChart(); if (!payload?.length) { - return null + return null; } return ( @@ -275,24 +275,24 @@ function ChartLegendContent({ className={cn( "flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", - className + className, )} > {payload .filter((item) => item.type !== "none") .map((item) => { - const key = `${nameKey || item.dataKey || "value"}` - const itemConfig = getPayloadConfigFromPayload(config, item, key) + const key = `${nameKey || item.dataKey || "value"}`; + const itemConfig = getPayloadConfigFromPayload(config, item, key); return (
svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3" + "[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3", )} > {itemConfig?.icon && !hideIcon ? ( - + ) : (
- ) + ); })}
- ) + ); } // Helper to extract item config from a payload. function getPayloadConfigFromPayload( config: ChartConfig, payload: unknown, - key: string + key: string, ) { if (typeof payload !== "object" || payload === null) { - return undefined + return undefined; } const payloadPayload = @@ -324,15 +324,15 @@ function getPayloadConfigFromPayload( typeof payload.payload === "object" && payload.payload !== null ? payload.payload - : undefined + : undefined; - let configLabelKey: string = key + let configLabelKey: string = key; if ( key in payload && typeof payload[key as keyof typeof payload] === "string" ) { - configLabelKey = payload[key as keyof typeof payload] as string + configLabelKey = payload[key as keyof typeof payload] as string; } else if ( payloadPayload && key in payloadPayload && @@ -340,12 +340,12 @@ function getPayloadConfigFromPayload( ) { configLabelKey = payloadPayload[ key as keyof typeof payloadPayload - ] as string + ] as string; } return configLabelKey in config ? config[configLabelKey] - : config[key as keyof typeof config] + : config[key as keyof typeof config]; } export { @@ -355,4 +355,4 @@ export { ChartLegend, ChartLegendContent, ChartStyle, -} +}; diff --git a/src/components/ui/checkbox.tsx b/src/components/ui/checkbox.tsx index 6e84158..2b4d53b 100644 --- a/src/components/ui/checkbox.tsx +++ b/src/components/ui/checkbox.tsx @@ -1,21 +1,21 @@ -"use client" +"use client"; -import * as React from "react" -import * as CheckboxPrimitive from "@radix-ui/react-checkbox" -import {CheckIcon} from "lucide-react" +import * as React from "react"; +import * as CheckboxPrimitive from "@radix-ui/react-checkbox"; +import { CheckIcon } from "lucide-react"; -import {cn} from "@/lib/utils" +import { cn } from "@/lib/utils"; function Checkbox({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( @@ -23,10 +23,10 @@ function Checkbox({ data-slot="checkbox-indicator" className="grid place-content-center text-current transition-none" > - + - ) + ); } -export {Checkbox} +export { Checkbox }; diff --git a/src/components/ui/collapsible.tsx b/src/components/ui/collapsible.tsx index ee43b49..849e7b6 100644 --- a/src/components/ui/collapsible.tsx +++ b/src/components/ui/collapsible.tsx @@ -1,31 +1,31 @@ -import * as CollapsiblePrimitive from "@radix-ui/react-collapsible" +import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"; function Collapsible({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function CollapsibleTrigger({ - ...props - }: React.ComponentProps) { + ...props +}: React.ComponentProps) { return ( - ) + ); } function CollapsibleContent({ - ...props - }: React.ComponentProps) { + ...props +}: React.ComponentProps) { return ( - ) + ); } -export {Collapsible, CollapsibleTrigger, CollapsibleContent} +export { Collapsible, CollapsibleTrigger, CollapsibleContent }; diff --git a/src/components/ui/command.tsx b/src/components/ui/command.tsx index acbbc3e..c3ca4cb 100644 --- a/src/components/ui/command.tsx +++ b/src/components/ui/command.tsx @@ -1,44 +1,44 @@ -import * as React from "react" -import {Command as CommandPrimitive} from "cmdk" -import {SearchIcon} from "lucide-react" +import * as React from "react"; +import { Command as CommandPrimitive } from "cmdk"; +import { SearchIcon } from "lucide-react"; -import {cn} from "@/lib/utils" +import { cn } from "@/lib/utils"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, -} from "@/components/ui/dialog" +} from "@/components/ui/dialog"; function Command({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function CommandDialog({ - title = "Command Palette", - description = "Search for a command to run...", - children, - className, - showCloseButton = true, - ...props - }: React.ComponentProps & { - title?: string - description?: string - className?: string - showCloseButton?: boolean + title = "Command Palette", + description = "Search for a command to run...", + children, + className, + showCloseButton = true, + ...props +}: React.ComponentProps & { + title?: string; + description?: string; + className?: string; + showCloseButton?: boolean; }) { return ( @@ -50,124 +50,123 @@ function CommandDialog({ className={cn("overflow-hidden p-0", className)} showCloseButton={showCloseButton} > - + {children} - ) + ); } function CommandInput({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return (
- +
- ) + ); } function CommandList({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function CommandEmpty({ - ...props - }: React.ComponentProps) { + ...props +}: React.ComponentProps) { return ( - ) + ); } function CommandGroup({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function CommandSeparator({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function CommandItem({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function CommandShortcut({ - className, - ...props - }: React.ComponentProps<"span">) { + className, + ...props +}: React.ComponentProps<"span">) { return ( - ) + ); } export { @@ -180,4 +179,4 @@ export { CommandItem, CommandShortcut, CommandSeparator, -} +}; diff --git a/src/components/ui/context-menu.tsx b/src/components/ui/context-menu.tsx index 21a1c3a..ab7a5d0 100644 --- a/src/components/ui/context-menu.tsx +++ b/src/components/ui/context-menu.tsx @@ -1,65 +1,65 @@ -"use client" +"use client"; -import * as React from "react" -import * as ContextMenuPrimitive from "@radix-ui/react-context-menu" -import {CheckIcon, ChevronRightIcon, CircleIcon} from "lucide-react" +import * as React from "react"; +import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"; +import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"; -import {cn} from "@/lib/utils" +import { cn } from "@/lib/utils"; function ContextMenu({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function ContextMenuTrigger({ - ...props - }: React.ComponentProps) { + ...props +}: React.ComponentProps) { return ( - ) + ); } function ContextMenuGroup({ - ...props - }: React.ComponentProps) { + ...props +}: React.ComponentProps) { return ( - ) + ); } function ContextMenuPortal({ - ...props - }: React.ComponentProps) { + ...props +}: React.ComponentProps) { return ( - ) + ); } function ContextMenuSub({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function ContextMenuRadioGroup({ - ...props - }: React.ComponentProps) { + ...props +}: React.ComponentProps) { return ( - ) + ); } function ContextMenuSubTrigger({ - className, - inset, - children, - ...props - }: React.ComponentProps & { - inset?: boolean + className, + inset, + children, + ...props +}: React.ComponentProps & { + inset?: boolean; }) { return ( {children} - + - ) + ); } function ContextMenuSubContent({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function ContextMenuContent({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function ContextMenuItem({ - className, - inset, - variant = "default", - ...props - }: React.ComponentProps & { - inset?: boolean - variant?: "default" | "destructive" + className, + inset, + variant = "default", + ...props +}: React.ComponentProps & { + inset?: boolean; + variant?: "default" | "destructive"; }) { return ( - ) + ); } function ContextMenuCheckboxItem({ - className, - children, - checked, - ...props - }: React.ComponentProps) { + className, + children, + checked, + ...props +}: React.ComponentProps) { return ( - + - + {children} - ) + ); } function ContextMenuRadioItem({ - className, - children, - ...props - }: React.ComponentProps) { + className, + children, + ...props +}: React.ComponentProps) { return ( - + - + {children} - ) + ); } function ContextMenuLabel({ - className, - inset, - ...props - }: React.ComponentProps & { - inset?: boolean + className, + inset, + ...props +}: React.ComponentProps & { + inset?: boolean; }) { return ( - ) + ); } function ContextMenuSeparator({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function ContextMenuShortcut({ - className, - ...props - }: React.ComponentProps<"span">) { + className, + ...props +}: React.ComponentProps<"span">) { return ( - ) + ); } export { @@ -251,4 +249,4 @@ export { ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuRadioGroup, -} +}; diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx index cb5a053..9ff9990 100644 --- a/src/components/ui/dialog.tsx +++ b/src/components/ui/dialog.tsx @@ -1,65 +1,65 @@ -import * as React from "react" -import * as DialogPrimitive from "@radix-ui/react-dialog" -import {XIcon} from "lucide-react" +import * as React from "react"; +import * as DialogPrimitive from "@radix-ui/react-dialog"; +import { XIcon } from "lucide-react"; -import {cn} from "@/lib/utils" +import { cn } from "@/lib/utils"; function Dialog({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function DialogTrigger({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function DialogPortal({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function DialogClose({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function DialogOverlay({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function DialogContent({ - className, - children, - showCloseButton = true, - ...props - }: React.ComponentProps & { - showCloseButton?: boolean + className, + children, + showCloseButton = true, + ...props +}: React.ComponentProps & { + showCloseButton?: boolean; }) { return ( - + @@ -69,62 +69,62 @@ function DialogContent({ data-slot="dialog-close" className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4" > - + Close )} - ) + ); } -function DialogHeader({className, ...props}: React.ComponentProps<"div">) { +function DialogHeader({ className, ...props }: React.ComponentProps<"div">) { return (
- ) + ); } -function DialogFooter({className, ...props}: React.ComponentProps<"div">) { +function DialogFooter({ className, ...props }: React.ComponentProps<"div">) { return (
- ) + ); } function DialogTitle({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function DialogDescription({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } export { @@ -138,4 +138,4 @@ export { DialogPortal, DialogTitle, DialogTrigger, -} +}; diff --git a/src/components/ui/drawer.tsx b/src/components/ui/drawer.tsx index 50b4fda..8848866 100644 --- a/src/components/ui/drawer.tsx +++ b/src/components/ui/drawer.tsx @@ -1,58 +1,58 @@ -"use client" +"use client"; -import * as React from "react" -import {Drawer as DrawerPrimitive} from "vaul" +import * as React from "react"; +import { Drawer as DrawerPrimitive } from "vaul"; -import {cn} from "@/lib/utils" +import { cn } from "@/lib/utils"; function Drawer({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function DrawerTrigger({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function DrawerPortal({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function DrawerClose({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function DrawerOverlay({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function DrawerContent({ - className, - children, - ...props - }: React.ComponentProps) { + className, + children, + ...props +}: React.ComponentProps) { return ( - + -
+
{children} - ) + ); } -function DrawerHeader({className, ...props}: React.ComponentProps<"div">) { +function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) { return (
- ) + ); } -function DrawerFooter({className, ...props}: React.ComponentProps<"div">) { +function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) { return (
- ) + ); } function DrawerTitle({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function DrawerDescription({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } export { @@ -133,4 +132,4 @@ export { DrawerFooter, DrawerTitle, DrawerDescription, -} +}; diff --git a/src/components/ui/dropdown-menu.tsx b/src/components/ui/dropdown-menu.tsx index da1a4fb..dd59f4a 100644 --- a/src/components/ui/dropdown-menu.tsx +++ b/src/components/ui/dropdown-menu.tsx @@ -1,39 +1,39 @@ -import * as React from "react" -import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu" -import {CheckIcon, ChevronRightIcon, CircleIcon} from "lucide-react" +import * as React from "react"; +import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"; +import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"; -import {cn} from "@/lib/utils" +import { cn } from "@/lib/utils"; function DropdownMenu({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function DropdownMenuPortal({ - ...props - }: React.ComponentProps) { + ...props +}: React.ComponentProps) { return ( - ) + ); } function DropdownMenuTrigger({ - ...props - }: React.ComponentProps) { + ...props +}: React.ComponentProps) { return ( - ) + ); } function DropdownMenuContent({ - className, - sideOffset = 4, - ...props - }: React.ComponentProps) { + className, + sideOffset = 4, + ...props +}: React.ComponentProps) { return ( - ) + ); } function DropdownMenuGroup({ - ...props - }: React.ComponentProps) { + ...props +}: React.ComponentProps) { return ( - ) + ); } function DropdownMenuItem({ - className, - inset, - variant = "default", - ...props - }: React.ComponentProps & { - inset?: boolean - variant?: "default" | "destructive" + className, + inset, + variant = "default", + ...props +}: React.ComponentProps & { + inset?: boolean; + variant?: "default" | "destructive"; }) { return ( - ) + ); } function DropdownMenuCheckboxItem({ - className, - children, - checked, - ...props - }: React.ComponentProps) { + className, + children, + checked, + ...props +}: React.ComponentProps) { return ( - + - + {children} - ) + ); } function DropdownMenuRadioGroup({ - ...props - }: React.ComponentProps) { + ...props +}: React.ComponentProps) { return ( - ) + ); } function DropdownMenuRadioItem({ - className, - children, - ...props - }: React.ComponentProps) { + className, + children, + ...props +}: React.ComponentProps) { return ( - + - + {children} - ) + ); } function DropdownMenuLabel({ - className, - inset, - ...props - }: React.ComponentProps & { - inset?: boolean + className, + inset, + ...props +}: React.ComponentProps & { + inset?: boolean; }) { return ( - ) + ); } function DropdownMenuSeparator({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } function DropdownMenuShortcut({ - className, - ...props - }: React.ComponentProps<"span">) { + className, + ...props +}: React.ComponentProps<"span">) { return ( - ) + ); } function DropdownMenuSub({ - ...props - }: React.ComponentProps) { - return + ...props +}: React.ComponentProps) { + return ; } function DropdownMenuSubTrigger({ - className, - inset, - children, - ...props - }: React.ComponentProps & { - inset?: boolean + className, + inset, + children, + ...props +}: React.ComponentProps & { + inset?: boolean; }) { return ( {children} - + - ) + ); } function DropdownMenuSubContent({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return ( - ) + ); } export { @@ -254,4 +252,4 @@ export { DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, -} +}; diff --git a/src/components/ui/empty.tsx b/src/components/ui/empty.tsx index cad61bb..e4a0754 100644 --- a/src/components/ui/empty.tsx +++ b/src/components/ui/empty.tsx @@ -1,31 +1,31 @@ -import {cva, type VariantProps} from "class-variance-authority" +import { cva, type VariantProps } from "class-variance-authority"; -import {cn} from "@/lib/utils" +import { cn } from "@/lib/utils"; -function Empty({className, ...props}: React.ComponentProps<"div">) { +function Empty({ className, ...props }: React.ComponentProps<"div">) { return (
- ) + ); } -function EmptyHeader({className, ...props}: React.ComponentProps<"div">) { +function EmptyHeader({ className, ...props }: React.ComponentProps<"div">) { return (
- ) + ); } const emptyMediaVariants = cva( @@ -40,58 +40,58 @@ const emptyMediaVariants = cva( defaultVariants: { variant: "default", }, - } -) + }, +); function EmptyMedia({ - className, - variant = "default", - ...props - }: React.ComponentProps<"div"> & VariantProps) { + className, + variant = "default", + ...props +}: React.ComponentProps<"div"> & VariantProps) { return (
- ) + ); } -function EmptyTitle({className, ...props}: React.ComponentProps<"div">) { +function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) { return (
- ) + ); } -function EmptyDescription({className, ...props}: React.ComponentProps<"p">) { +function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) { return (
a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4", - className + className, )} {...props} /> - ) + ); } -function EmptyContent({className, ...props}: React.ComponentProps<"div">) { +function EmptyContent({ className, ...props }: React.ComponentProps<"div">) { return (
- ) + ); } export { @@ -101,4 +101,4 @@ export { EmptyDescription, EmptyContent, EmptyMedia, -} +}; diff --git a/src/components/ui/field.tsx b/src/components/ui/field.tsx index ae938a6..39ad59c 100644 --- a/src/components/ui/field.tsx +++ b/src/components/ui/field.tsx @@ -1,30 +1,30 @@ -import {useMemo} from "react" -import {cva, type VariantProps} from "class-variance-authority" +import { useMemo } from "react"; +import { cva, type VariantProps } from "class-variance-authority"; -import {cn} from "@/lib/utils" -import {Label} from "@/components/ui/label" -import {Separator} from "@/components/ui/separator" +import { cn } from "@/lib/utils"; +import { Label } from "@/components/ui/label"; +import { Separator } from "@/components/ui/separator"; -function FieldSet({className, ...props}: React.ComponentProps<"fieldset">) { +function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) { return (
[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", - className + className, )} {...props} /> - ) + ); } function FieldLegend({ - className, - variant = "legend", - ...props - }: React.ComponentProps<"legend"> & { - variant?: "legend" | "label" + className, + variant = "legend", + ...props +}: React.ComponentProps<"legend"> & { + variant?: "legend" | "label"; }) { return ( - ) + ); } -function FieldGroup({className, ...props}: React.ComponentProps<"div">) { +function FieldGroup({ className, ...props }: React.ComponentProps<"div">) { return (
[data-slot=field-group]]:gap-4", - className + className, )} {...props} /> - ) + ); } const fieldVariants = cva( @@ -75,42 +75,42 @@ const fieldVariants = cva( defaultVariants: { orientation: "vertical", }, - } -) + }, +); function Field({ - className, - orientation = "vertical", - ...props - }: React.ComponentProps<"div"> & VariantProps) { + className, + orientation = "vertical", + ...props +}: React.ComponentProps<"div"> & VariantProps) { return (
- ) + ); } -function FieldContent({className, ...props}: React.ComponentProps<"div">) { +function FieldContent({ className, ...props }: React.ComponentProps<"div">) { return (
- ) + ); } function FieldLabel({ - className, - ...props - }: React.ComponentProps) { + className, + ...props +}: React.ComponentProps) { return (
-
+
{children}