create-aiko 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +7 -0
- package/dist/create.d.ts +1 -0
- package/dist/create.js +174 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/scaffold.d.ts +7 -0
- package/dist/scaffold.js +310 -0
- package/package.json +37 -0
- package/template/README.md +63 -0
- package/template/docs/better-sqlite3-design.md +101 -0
- package/template/docs/shared-vs-shared-auth.md +54 -0
- package/template/package.json +23 -0
- package/template/packages/admin/.env.dev +1 -0
- package/template/packages/admin/.env.prod +4 -0
- package/template/packages/admin/.env.stage +4 -0
- package/template/packages/admin/Dockerfile +37 -0
- package/template/packages/admin/README.MD +27 -0
- package/template/packages/admin/components.json +21 -0
- package/template/packages/admin/eslint.config.js +28 -0
- package/template/packages/admin/index.html +50 -0
- package/template/packages/admin/package.json +100 -0
- package/template/packages/admin/public/vite.svg +1 -0
- package/template/packages/admin/src/App.css +82 -0
- package/template/packages/admin/src/App.tsx +128 -0
- package/template/packages/admin/src/app.config.ts +3 -0
- package/template/packages/admin/src/components/admin-ui/approval-flow.tsx +205 -0
- package/template/packages/admin/src/components/admin-ui/data-table/data-table-pagination.tsx +148 -0
- package/template/packages/admin/src/components/admin-ui/data-table/data-table-sorter.tsx +50 -0
- package/template/packages/admin/src/components/admin-ui/data-table/index.tsx +296 -0
- package/template/packages/admin/src/components/admin-ui/editable-table.tsx +292 -0
- package/template/packages/admin/src/components/admin-ui/form/input-password.tsx +38 -0
- package/template/packages/admin/src/components/admin-ui/form/sign-in-form.tsx +104 -0
- package/template/packages/admin/src/components/admin-ui/layout/error-component.tsx +71 -0
- package/template/packages/admin/src/components/admin-ui/layout/header.tsx +148 -0
- package/template/packages/admin/src/components/admin-ui/layout/language-switcher.tsx +47 -0
- package/template/packages/admin/src/components/admin-ui/layout/layout.tsx +42 -0
- package/template/packages/admin/src/components/admin-ui/layout/loading-overlay.tsx +36 -0
- package/template/packages/admin/src/components/admin-ui/layout/shell-bar.tsx +232 -0
- package/template/packages/admin/src/components/admin-ui/layout/sidebar.tsx +193 -0
- package/template/packages/admin/src/components/admin-ui/layout/user-avatar.tsx +31 -0
- package/template/packages/admin/src/components/admin-ui/list-report.tsx +313 -0
- package/template/packages/admin/src/components/admin-ui/master-detail.tsx +382 -0
- package/template/packages/admin/src/components/admin-ui/notification/toaster.tsx +23 -0
- package/template/packages/admin/src/components/admin-ui/notification/undoable-notification.tsx +84 -0
- package/template/packages/admin/src/components/admin-ui/object-page.tsx +539 -0
- package/template/packages/admin/src/components/admin-ui/process-stepper.tsx +204 -0
- package/template/packages/admin/src/components/admin-ui/theme/theme-provider.tsx +160 -0
- package/template/packages/admin/src/components/admin-ui/theme/theme-select.tsx +129 -0
- package/template/packages/admin/src/components/admin-ui/theme/theme-toggle.tsx +90 -0
- package/template/packages/admin/src/components/admin-ui/timeline.tsx +137 -0
- package/template/packages/admin/src/components/admin-ui/tree-navigator.tsx +243 -0
- package/template/packages/admin/src/components/ui/accordion.tsx +64 -0
- package/template/packages/admin/src/components/ui/alert-dialog.tsx +157 -0
- package/template/packages/admin/src/components/ui/alert.tsx +66 -0
- package/template/packages/admin/src/components/ui/aspect-ratio.tsx +9 -0
- package/template/packages/admin/src/components/ui/avatar.tsx +53 -0
- package/template/packages/admin/src/components/ui/badge.tsx +47 -0
- package/template/packages/admin/src/components/ui/breadcrumb.tsx +111 -0
- package/template/packages/admin/src/components/ui/button.tsx +59 -0
- package/template/packages/admin/src/components/ui/calendar.tsx +74 -0
- package/template/packages/admin/src/components/ui/card.tsx +92 -0
- package/template/packages/admin/src/components/ui/carousel.tsx +237 -0
- package/template/packages/admin/src/components/ui/chart.tsx +351 -0
- package/template/packages/admin/src/components/ui/checkbox.tsx +32 -0
- package/template/packages/admin/src/components/ui/collapsible.tsx +33 -0
- package/template/packages/admin/src/components/ui/command.tsx +182 -0
- package/template/packages/admin/src/components/ui/context-menu.tsx +252 -0
- package/template/packages/admin/src/components/ui/dialog.tsx +141 -0
- package/template/packages/admin/src/components/ui/drawer.tsx +130 -0
- package/template/packages/admin/src/components/ui/dropdown-menu.tsx +255 -0
- package/template/packages/admin/src/components/ui/form.tsx +166 -0
- package/template/packages/admin/src/components/ui/hover-card.tsx +42 -0
- package/template/packages/admin/src/components/ui/input-otp.tsx +77 -0
- package/template/packages/admin/src/components/ui/input.tsx +21 -0
- package/template/packages/admin/src/components/ui/label.tsx +22 -0
- package/template/packages/admin/src/components/ui/menubar.tsx +274 -0
- package/template/packages/admin/src/components/ui/navigation-menu.tsx +168 -0
- package/template/packages/admin/src/components/ui/pagination.tsx +127 -0
- package/template/packages/admin/src/components/ui/popover.tsx +48 -0
- package/template/packages/admin/src/components/ui/progress.tsx +29 -0
- package/template/packages/admin/src/components/ui/radio-group.tsx +45 -0
- package/template/packages/admin/src/components/ui/resizable.tsx +54 -0
- package/template/packages/admin/src/components/ui/scroll-area.tsx +58 -0
- package/template/packages/admin/src/components/ui/select.tsx +183 -0
- package/template/packages/admin/src/components/ui/separator.tsx +26 -0
- package/template/packages/admin/src/components/ui/sheet.tsx +139 -0
- package/template/packages/admin/src/components/ui/sidebar.tsx +740 -0
- package/template/packages/admin/src/components/ui/skeleton.tsx +13 -0
- package/template/packages/admin/src/components/ui/slider.tsx +63 -0
- package/template/packages/admin/src/components/ui/sonner.tsx +23 -0
- package/template/packages/admin/src/components/ui/switch.tsx +31 -0
- package/template/packages/admin/src/components/ui/table.tsx +114 -0
- package/template/packages/admin/src/components/ui/tabs.tsx +66 -0
- package/template/packages/admin/src/components/ui/textarea.tsx +18 -0
- package/template/packages/admin/src/components/ui/toggle-group.tsx +73 -0
- package/template/packages/admin/src/components/ui/toggle.tsx +45 -0
- package/template/packages/admin/src/components/ui/tooltip.tsx +59 -0
- package/template/packages/admin/src/hooks/use-mobile.ts +21 -0
- package/template/packages/admin/src/i18n.ts +20 -0
- package/template/packages/admin/src/index.tsx +18 -0
- package/template/packages/admin/src/layouts/menu-layout.tsx +211 -0
- package/template/packages/admin/src/layouts/tile-layout.tsx +355 -0
- package/template/packages/admin/src/lib/utils.ts +6 -0
- package/template/packages/admin/src/locales/en.json +68 -0
- package/template/packages/admin/src/locales/zh.json +68 -0
- package/template/packages/admin/src/pages/dashboard.tsx +12 -0
- package/template/packages/admin/src/pages/goods-receipt/CreatePage.tsx +302 -0
- package/template/packages/admin/src/pages/goods-receipt/EditPage.tsx +221 -0
- package/template/packages/admin/src/pages/goods-receipt/ListPage.tsx +283 -0
- package/template/packages/admin/src/pages/goods-receipt/ViewPage.tsx +280 -0
- package/template/packages/admin/src/pages/goods-receipt/index.ts +4 -0
- package/template/packages/admin/src/pages/home-page.tsx +244 -0
- package/template/packages/admin/src/pages/login-page.tsx +91 -0
- package/template/packages/admin/src/pages/master-data/cost-centers/index.tsx +461 -0
- package/template/packages/admin/src/pages/master-data/currencies/index.tsx +255 -0
- package/template/packages/admin/src/pages/master-data/materials/ListPage.tsx +271 -0
- package/template/packages/admin/src/pages/master-data/materials/ViewPage.tsx +240 -0
- package/template/packages/admin/src/pages/master-data/materials/index.ts +2 -0
- package/template/packages/admin/src/pages/master-data/plants/ListPage.tsx +279 -0
- package/template/packages/admin/src/pages/master-data/plants/ViewPage.tsx +380 -0
- package/template/packages/admin/src/pages/master-data/plants/index.ts +2 -0
- package/template/packages/admin/src/pages/master-data/purchase-organizations/index.tsx +341 -0
- package/template/packages/admin/src/pages/master-data/units-of-measure/index.tsx +295 -0
- package/template/packages/admin/src/pages/master-data/vendors/ListPage.tsx +266 -0
- package/template/packages/admin/src/pages/master-data/vendors/ViewPage.tsx +274 -0
- package/template/packages/admin/src/pages/master-data/vendors/index.ts +2 -0
- package/template/packages/admin/src/pages/placeholder-page.tsx +13 -0
- package/template/packages/admin/src/pages/purchase-orders/ListPage.tsx +289 -0
- package/template/packages/admin/src/pages/purchase-orders/ViewPage.tsx +343 -0
- package/template/packages/admin/src/pages/purchase-orders/index.ts +2 -0
- package/template/packages/admin/src/pages/purchase-requisitions/CreatePage.tsx +398 -0
- package/template/packages/admin/src/pages/purchase-requisitions/EditPage.tsx +473 -0
- package/template/packages/admin/src/pages/purchase-requisitions/ListPage.tsx +307 -0
- package/template/packages/admin/src/pages/purchase-requisitions/ViewPage.tsx +304 -0
- package/template/packages/admin/src/pages/purchase-requisitions/constants.ts +51 -0
- package/template/packages/admin/src/pages/purchase-requisitions/index.ts +4 -0
- package/template/packages/admin/src/pages/reports/PurchaseOrderReport.tsx +312 -0
- package/template/packages/admin/src/pages/reports/PurchaseRequisitionReport.tsx +303 -0
- package/template/packages/admin/src/pages/reports/index.ts +2 -0
- package/template/packages/admin/src/pages/settings-page.tsx +335 -0
- package/template/packages/admin/src/providers/app-config.tsx +50 -0
- package/template/packages/admin/src/routes/auth.ts +6 -0
- package/template/packages/admin/src/routes/index.ts +85 -0
- package/template/packages/admin/src/routes/menu.ts +176 -0
- package/template/packages/admin/src/routes/modules/goods-receipt.ts +31 -0
- package/template/packages/admin/src/routes/modules/master-data.ts +41 -0
- package/template/packages/admin/src/routes/modules/purchase-orders.ts +27 -0
- package/template/packages/admin/src/routes/modules/purchase-requisitions.ts +39 -0
- package/template/packages/admin/src/routes/modules/reports.ts +33 -0
- package/template/packages/admin/src/routes/modules/settings.ts +19 -0
- package/template/packages/admin/src/routes/withSuspense.tsx +21 -0
- package/template/packages/admin/src/theme/amber.css +27 -0
- package/template/packages/admin/src/theme/blue.css +27 -0
- package/template/packages/admin/src/theme/default.css +75 -0
- package/template/packages/admin/src/theme/fiori.css +180 -0
- package/template/packages/admin/src/theme/green.css +27 -0
- package/template/packages/admin/src/theme/index.css +12 -0
- package/template/packages/admin/src/theme/rose.css +27 -0
- package/template/packages/admin/src/theme/violet.css +27 -0
- package/template/packages/admin/src/vite-env.d.ts +1 -0
- package/template/packages/admin/tsconfig.json +28 -0
- package/template/packages/admin/tsconfig.node.json +21 -0
- package/template/packages/admin/vite.config.ts +26 -0
- package/template/packages/api/.eslintrc.json +6 -0
- package/template/packages/api/.swcrc +17 -0
- package/template/packages/api/app.config.ts +160 -0
- package/template/packages/api/docs/api-document.md +497 -0
- package/template/packages/api/examples/security/README.md +664 -0
- package/template/packages/api/examples/security/complete/.env.example +26 -0
- package/template/packages/api/examples/security/complete/PROJECT_STRUCTURE.md +220 -0
- package/template/packages/api/examples/security/complete/README.md +847 -0
- package/template/packages/api/examples/security/complete/app.config.ts +69 -0
- package/template/packages/api/examples/security/complete/app.ts +63 -0
- package/template/packages/api/examples/security/complete/controller/auth.controller.ts +131 -0
- package/template/packages/api/examples/security/complete/controller/index.ts +4 -0
- package/template/packages/api/examples/security/complete/controller/permission.controller.ts +41 -0
- package/template/packages/api/examples/security/complete/controller/role.controller.ts +53 -0
- package/template/packages/api/examples/security/complete/controller/user.controller.ts +53 -0
- package/template/packages/api/examples/security/complete/dto/change-password.dto.ts +10 -0
- package/template/packages/api/examples/security/complete/dto/create-permission.dto.ts +14 -0
- package/template/packages/api/examples/security/complete/dto/create-role.dto.ts +11 -0
- package/template/packages/api/examples/security/complete/dto/create-user.dto.ts +15 -0
- package/template/packages/api/examples/security/complete/dto/index.ts +7 -0
- package/template/packages/api/examples/security/complete/dto/login.dto.ts +10 -0
- package/template/packages/api/examples/security/complete/dto/oauth-profile.dto.ts +7 -0
- package/template/packages/api/examples/security/complete/dto/register.dto.ts +17 -0
- package/template/packages/api/examples/security/complete/entity/index.ts +6 -0
- package/template/packages/api/examples/security/complete/entity/oauth-account.entity.ts +39 -0
- package/template/packages/api/examples/security/complete/entity/permission.entity.ts +31 -0
- package/template/packages/api/examples/security/complete/entity/role-permission.entity.ts +19 -0
- package/template/packages/api/examples/security/complete/entity/role.entity.ts +25 -0
- package/template/packages/api/examples/security/complete/entity/user-role.entity.ts +19 -0
- package/template/packages/api/examples/security/complete/entity/user.entity.ts +46 -0
- package/template/packages/api/examples/security/complete/init.sql +81 -0
- package/template/packages/api/examples/security/complete/middleware/auth.interceptor.ts +39 -0
- package/template/packages/api/examples/security/complete/middleware/index.ts +2 -0
- package/template/packages/api/examples/security/complete/middleware/permission.interceptor.ts +61 -0
- package/template/packages/api/examples/security/complete/package.json +54 -0
- package/template/packages/api/examples/security/complete/seed.sql +42 -0
- package/template/packages/api/examples/security/complete/service/auth.service.ts +41 -0
- package/template/packages/api/examples/security/complete/service/index.ts +5 -0
- package/template/packages/api/examples/security/complete/service/oauth.service.ts +82 -0
- package/template/packages/api/examples/security/complete/service/permission.service.ts +113 -0
- package/template/packages/api/examples/security/complete/service/role.service.ts +85 -0
- package/template/packages/api/examples/security/complete/service/user.service.ts +132 -0
- package/template/packages/api/examples/security/complete/tests/TEST_REPORT.md +318 -0
- package/template/packages/api/examples/security/complete/tests/generate-report.js +335 -0
- package/template/packages/api/examples/security/complete/tests/helpers/api-helpers.ts +116 -0
- package/template/packages/api/examples/security/complete/tests/helpers/index.ts +2 -0
- package/template/packages/api/examples/security/complete/tests/helpers/test-helpers.ts +129 -0
- package/template/packages/api/examples/security/complete/tests/integration/auth.api.test.ts +429 -0
- package/template/packages/api/examples/security/complete/tests/integration/role.api.test.ts +400 -0
- package/template/packages/api/examples/security/complete/tests/integration/user.api.test.ts +459 -0
- package/template/packages/api/examples/security/complete/tests/jest.config.js +40 -0
- package/template/packages/api/examples/security/complete/tests/run-all-tests.js +135 -0
- package/template/packages/api/examples/security/complete/tests/run-tests.js +109 -0
- package/template/packages/api/examples/security/complete/tests/setup.ts +19 -0
- package/template/packages/api/examples/security/complete/tests/unit/auth.service.test.ts +199 -0
- package/template/packages/api/examples/security/complete/tests/unit/permission.service.test.ts +377 -0
- package/template/packages/api/examples/security/complete/tests/unit/user.service.test.ts +288 -0
- package/template/packages/api/examples/security/complete/tsconfig.json +35 -0
- package/template/packages/api/examples/security/jwt/README.md +424 -0
- package/template/packages/api/examples/security/local/README.md +499 -0
- package/template/packages/api/examples/security/oauth2/README.md +637 -0
- package/template/packages/api/examples/security/permission/README.md +943 -0
- package/template/packages/api/examples/security/session/README.md +753 -0
- package/template/packages/api/package.json +56 -0
- package/template/packages/api/src/controller/auth.controller.ts +127 -0
- package/template/packages/api/src/controller/cache.controller.ts +106 -0
- package/template/packages/api/src/controller/menu.controller.ts +46 -0
- package/template/packages/api/src/controller/mq.controller.ts +35 -0
- package/template/packages/api/src/controller/role.controller.ts +51 -0
- package/template/packages/api/src/controller/upload.controller.ts +85 -0
- package/template/packages/api/src/controller/user.controller.ts +57 -0
- package/template/packages/api/src/dto/auth.dto.ts +30 -0
- package/template/packages/api/src/dto/cache.dto.ts +24 -0
- package/template/packages/api/src/dto/menu.dto.ts +37 -0
- package/template/packages/api/src/dto/mq.dto.ts +16 -0
- package/template/packages/api/src/dto/role.dto.ts +16 -0
- package/template/packages/api/src/dto/user.dto.ts +35 -0
- package/template/packages/api/src/entity/menu.entity.ts +34 -0
- package/template/packages/api/src/entity/role-menu.entity.ts +13 -0
- package/template/packages/api/src/entity/role.entity.ts +22 -0
- package/template/packages/api/src/entity/user-role.entity.ts +13 -0
- package/template/packages/api/src/entity/user.entity.ts +31 -0
- package/template/packages/api/src/mapper/menu.mapper.ts +6 -0
- package/template/packages/api/src/mapper/role-menu.mapper.ts +6 -0
- package/template/packages/api/src/mapper/role.mapper.ts +6 -0
- package/template/packages/api/src/mapper/user-role.mapper.ts +6 -0
- package/template/packages/api/src/mapper/user.mapper.ts +11 -0
- package/template/packages/api/src/scripts/init-db.ts +185 -0
- package/template/packages/api/src/server.ts +76 -0
- package/template/packages/api/src/service/auth.service.ts +106 -0
- package/template/packages/api/src/service/cache.service.ts +80 -0
- package/template/packages/api/src/service/log.request.service.ts +158 -0
- package/template/packages/api/src/service/log.service.ts +123 -0
- package/template/packages/api/src/service/menu.service.ts +94 -0
- package/template/packages/api/src/service/mq.consumer.service.ts +26 -0
- package/template/packages/api/src/service/role.service.ts +88 -0
- package/template/packages/api/src/service/user.service.ts +170 -0
- package/template/packages/api/src/types/sqljs.d.ts +18 -0
- package/template/packages/api/src/utils/auth.utils.js +0 -0
- package/template/packages/api/src/utils/jwt.util.ts +29 -0
- package/template/packages/api/tsconfig.json +17 -0
- package/template/packages/api/tsup.config.ts +9 -0
- package/template/packages/api/uploads/.gitkeep +0 -0
- package/template/packages/core/package.json +31 -0
- package/template/packages/core/src/auth/auth-client-middleware.ts +22 -0
- package/template/packages/core/src/auth/auth-service.ts +65 -0
- package/template/packages/core/src/auth/default-auth-provider.ts +37 -0
- package/template/packages/core/src/auth/index.ts +10 -0
- package/template/packages/core/src/auth/types.ts +38 -0
- package/template/packages/core/src/authorization/authorization-client-middleware.ts +38 -0
- package/template/packages/core/src/authorization/authorization-config.ts +13 -0
- package/template/packages/core/src/authorization/authorization-provider.tsx +116 -0
- package/template/packages/core/src/authorization/default-authorization-provider.ts +26 -0
- package/template/packages/core/src/authorization/index.ts +15 -0
- package/template/packages/core/src/authorization/types.ts +42 -0
- package/template/packages/core/src/index.ts +3 -0
- package/template/packages/core/src/utils/promise-result-cache.ts +18 -0
- package/template/packages/core/tsconfig.json +19 -0
- package/template/packages/mobile/README.md +55 -0
- package/template/packages/mobile/index.html +13 -0
- package/template/packages/mobile/package.json +30 -0
- package/template/packages/mobile/postcss.config.mjs +7 -0
- package/template/packages/mobile/src/App.tsx +5 -0
- package/template/packages/mobile/src/app/globals.css +1 -0
- package/template/packages/mobile/src/components/LoginForm.tsx +76 -0
- package/template/packages/mobile/src/hooks/index.ts +5 -0
- package/template/packages/mobile/src/lib/utils.ts +7 -0
- package/template/packages/mobile/src/main.tsx +13 -0
- package/template/packages/mobile/src/pages/HomePage.tsx +35 -0
- package/template/packages/mobile/src/pages/LoginPage.tsx +35 -0
- package/template/packages/mobile/src/pages/index.ts +2 -0
- package/template/packages/mobile/src/routes/ProtectedRoute.tsx +29 -0
- package/template/packages/mobile/src/routes/index.tsx +24 -0
- package/template/packages/mobile/src/routes/routes.ts +11 -0
- package/template/packages/mobile/src/types/index.ts +5 -0
- package/template/packages/mobile/src/vite-env.d.ts +1 -0
- package/template/packages/mobile/tsconfig.json +23 -0
- package/template/packages/mobile/tsconfig.node.json +11 -0
- package/template/packages/mobile/vite.config.ts +19 -0
- package/template/packages/shared/package.json +20 -0
- package/template/packages/shared/src/constants.ts +8 -0
- package/template/packages/shared/src/index.ts +5 -0
- package/template/packages/shared/tsconfig.json +13 -0
- package/template/packages/shared-auth/package.json +29 -0
- package/template/packages/shared-auth/src/AuthContext.tsx +177 -0
- package/template/packages/shared-auth/src/AuthProviderWrapper.tsx +29 -0
- package/template/packages/shared-auth/src/index.ts +10 -0
- package/template/packages/shared-auth/tsconfig.json +14 -0
- package/template/pnpm-lock.yaml +16349 -0
- package/template/pnpm-workspace.yaml +3 -0
- package/template/scripts/postinstall.cjs +42 -0
- package/template/scripts/rebuild-sqlite.cjs +23 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { useEffect, useState } from "react"
|
|
2
|
+
import {
|
|
3
|
+
Navigate,
|
|
4
|
+
RouterProvider,
|
|
5
|
+
createBrowserRouter,
|
|
6
|
+
type RouteObject,
|
|
7
|
+
} from "react-router"
|
|
8
|
+
import { useTranslation } from "react-i18next"
|
|
9
|
+
import { AppConfigProvider } from "./providers/app-config"
|
|
10
|
+
|
|
11
|
+
import { ThemeProvider } from "./components/admin-ui/theme/theme-provider"
|
|
12
|
+
import { Toaster } from "./components/admin-ui/notification/toaster"
|
|
13
|
+
import { MenuLayout } from "./layouts/menu-layout"
|
|
14
|
+
import { TileLayout } from "./layouts/tile-layout"
|
|
15
|
+
import { HomePage } from "./pages/home-page"
|
|
16
|
+
import { getModulesContext } from "./routes"
|
|
17
|
+
import "./App.css"
|
|
18
|
+
import { SignInForm } from "./components/admin-ui/form/sign-in-form"
|
|
19
|
+
import { appAuth } from "@scaffold/core"
|
|
20
|
+
import { AuthorizationProvider, setAppAuthorizationConfig } from "@scaffold/core"
|
|
21
|
+
import { ErrorComponent } from "./components/admin-ui/layout/error-component"
|
|
22
|
+
import { withSuspense } from "./routes/withSuspense"
|
|
23
|
+
import { LOGIN_URL } from "./app.config"
|
|
24
|
+
|
|
25
|
+
const LAYOUT_STORAGE_KEY = "admin-layout-mode"
|
|
26
|
+
|
|
27
|
+
const defaultTitleIcon = (
|
|
28
|
+
<svg
|
|
29
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
30
|
+
width="24"
|
|
31
|
+
height="24"
|
|
32
|
+
viewBox="0 0 24 24"
|
|
33
|
+
fill="none"
|
|
34
|
+
stroke="currentColor"
|
|
35
|
+
strokeWidth="2"
|
|
36
|
+
strokeLinecap="round"
|
|
37
|
+
strokeLinejoin="round"
|
|
38
|
+
>
|
|
39
|
+
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
|
|
40
|
+
</svg>
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
/** 登录页:根据 auth state 同步渲染,已登录则重定向到首页 */
|
|
44
|
+
function LoginPageRoute() {
|
|
45
|
+
const result = appAuth.check()
|
|
46
|
+
if (result.isAuthenticated) {
|
|
47
|
+
return <Navigate to="/" replace />
|
|
48
|
+
}
|
|
49
|
+
return <SignInForm />
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** 根布局:负责 layoutMode 与基础布局切换(菜单 / Tile) */
|
|
53
|
+
function RootLayout() {
|
|
54
|
+
const [layoutMode, setLayoutMode] = useState<"menu" | "tile">(() => {
|
|
55
|
+
const saved = localStorage.getItem(LAYOUT_STORAGE_KEY)
|
|
56
|
+
return (saved === "menu" || saved === "tile" ? saved : "tile") as "menu" | "tile"
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
localStorage.setItem(LAYOUT_STORAGE_KEY, layoutMode)
|
|
61
|
+
}, [layoutMode])
|
|
62
|
+
|
|
63
|
+
const handleLayoutModeChange = (mode: "menu" | "tile") => {
|
|
64
|
+
setLayoutMode(mode)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const LayoutWrapper =
|
|
68
|
+
layoutMode === "menu" ? (
|
|
69
|
+
<MenuLayout onLayoutModeChange={handleLayoutModeChange} />
|
|
70
|
+
) : (
|
|
71
|
+
<TileLayout onLayoutModeChange={handleLayoutModeChange} />
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
{LayoutWrapper}
|
|
77
|
+
</>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
function AppShell() {
|
|
83
|
+
const { t } = useTranslation()
|
|
84
|
+
const { routes, middlewares } = getModulesContext()
|
|
85
|
+
const appRoutes: RouteObject[] = [
|
|
86
|
+
{
|
|
87
|
+
path: "/",
|
|
88
|
+
element: <RootLayout />,
|
|
89
|
+
children: [
|
|
90
|
+
{ index: true, middleware: [middlewares[0]], element: <HomePage /> } as RouteObject,
|
|
91
|
+
...(routes as RouteObject[]),
|
|
92
|
+
{ path: "*", element: <ErrorComponent /> },
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
// When LOGIN_URL is an internal path (e.g. "/login"), we register a local login route.
|
|
98
|
+
// For external login URLs (e.g. SSO like "https://sso.example.com/login"), routing is handled outside this app.
|
|
99
|
+
const isExternalLogin = LOGIN_URL.startsWith("http")
|
|
100
|
+
|
|
101
|
+
if (!isExternalLogin) {
|
|
102
|
+
appRoutes.unshift({
|
|
103
|
+
path: LOGIN_URL,
|
|
104
|
+
element: withSuspense(LoginPageRoute),
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const router = createBrowserRouter(appRoutes)
|
|
109
|
+
setAppAuthorizationConfig({
|
|
110
|
+
fallbackUrl: '/not-found',
|
|
111
|
+
})
|
|
112
|
+
return (
|
|
113
|
+
<ThemeProvider>
|
|
114
|
+
<AppConfigProvider
|
|
115
|
+
title={{ icon: defaultTitleIcon, text: t("common.appTitle") }}
|
|
116
|
+
>
|
|
117
|
+
<AuthorizationProvider>
|
|
118
|
+
<RouterProvider router={router} />
|
|
119
|
+
</AuthorizationProvider>
|
|
120
|
+
<Toaster />
|
|
121
|
+
</AppConfigProvider>
|
|
122
|
+
</ThemeProvider>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export default function App() {
|
|
127
|
+
return <AppShell />
|
|
128
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
import { CheckCircle2, Clock3, FileText, ShieldAlert, UserRound, XCircle } from "lucide-react";
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils";
|
|
7
|
+
import { Badge } from "@/components/ui/badge";
|
|
8
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
|
9
|
+
import { ProcessStepper, type ProcessStep } from "@/components/admin-ui/process-stepper";
|
|
10
|
+
import { Timeline, type TimelineItem } from "@/components/admin-ui/timeline";
|
|
11
|
+
|
|
12
|
+
export type ApprovalStepStatus =
|
|
13
|
+
| "approved"
|
|
14
|
+
| "current"
|
|
15
|
+
| "pending"
|
|
16
|
+
| "rejected"
|
|
17
|
+
| "returned"
|
|
18
|
+
| "skipped";
|
|
19
|
+
|
|
20
|
+
export interface ApprovalStep {
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
assignee?: string;
|
|
24
|
+
time?: string;
|
|
25
|
+
comment?: string;
|
|
26
|
+
reason?: string;
|
|
27
|
+
status: ApprovalStepStatus;
|
|
28
|
+
icon?: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ApprovalFlowProps {
|
|
32
|
+
title?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
steps: ApprovalStep[];
|
|
35
|
+
showStepper?: boolean;
|
|
36
|
+
className?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function toProcessStatus(status: ApprovalStepStatus): ProcessStep["status"] {
|
|
40
|
+
switch (status) {
|
|
41
|
+
case "approved":
|
|
42
|
+
return "completed";
|
|
43
|
+
case "current":
|
|
44
|
+
return "current";
|
|
45
|
+
case "rejected":
|
|
46
|
+
case "returned":
|
|
47
|
+
return "error";
|
|
48
|
+
case "skipped":
|
|
49
|
+
return "skipped";
|
|
50
|
+
case "pending":
|
|
51
|
+
default:
|
|
52
|
+
return "pending";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function getApprovalMeta(status: ApprovalStepStatus) {
|
|
57
|
+
switch (status) {
|
|
58
|
+
case "approved":
|
|
59
|
+
return {
|
|
60
|
+
label: "已通过",
|
|
61
|
+
variant: "default" as const,
|
|
62
|
+
icon: <CheckCircle2 className="size-4" />,
|
|
63
|
+
};
|
|
64
|
+
case "current":
|
|
65
|
+
return {
|
|
66
|
+
label: "处理中",
|
|
67
|
+
variant: "secondary" as const,
|
|
68
|
+
icon: <Clock3 className="size-4" />,
|
|
69
|
+
};
|
|
70
|
+
case "rejected":
|
|
71
|
+
return {
|
|
72
|
+
label: "已驳回",
|
|
73
|
+
variant: "destructive" as const,
|
|
74
|
+
icon: <XCircle className="size-4" />,
|
|
75
|
+
};
|
|
76
|
+
case "returned":
|
|
77
|
+
return {
|
|
78
|
+
label: "已退回",
|
|
79
|
+
variant: "secondary" as const,
|
|
80
|
+
icon: <ShieldAlert className="size-4" />,
|
|
81
|
+
};
|
|
82
|
+
case "skipped":
|
|
83
|
+
return {
|
|
84
|
+
label: "已跳过",
|
|
85
|
+
variant: "outline" as const,
|
|
86
|
+
icon: <FileText className="size-4" />,
|
|
87
|
+
};
|
|
88
|
+
case "pending":
|
|
89
|
+
default:
|
|
90
|
+
return {
|
|
91
|
+
label: "待处理",
|
|
92
|
+
variant: "outline" as const,
|
|
93
|
+
icon: <Clock3 className="size-4" />,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function getSummary(steps: ApprovalStep[]) {
|
|
99
|
+
const current =
|
|
100
|
+
steps.find((step) => step.status === "current") ??
|
|
101
|
+
steps.find((step) => step.status === "rejected" || step.status === "returned") ??
|
|
102
|
+
steps[steps.length - 1];
|
|
103
|
+
|
|
104
|
+
const approvedCount = steps.filter((step) => step.status === "approved").length;
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
current,
|
|
108
|
+
approvedCount,
|
|
109
|
+
totalCount: steps.length,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function ApprovalFlow({
|
|
114
|
+
title = "审批流程",
|
|
115
|
+
description = "展示当前审批阶段、责任人和留痕记录。",
|
|
116
|
+
steps,
|
|
117
|
+
showStepper = true,
|
|
118
|
+
className,
|
|
119
|
+
}: ApprovalFlowProps) {
|
|
120
|
+
if (steps.length === 0) return null;
|
|
121
|
+
|
|
122
|
+
const summary = getSummary(steps);
|
|
123
|
+
const currentMeta = getApprovalMeta(summary.current.status);
|
|
124
|
+
|
|
125
|
+
const processSteps: ProcessStep[] = steps.map((step) => ({
|
|
126
|
+
id: step.id,
|
|
127
|
+
title: step.title,
|
|
128
|
+
description: step.assignee,
|
|
129
|
+
meta: step.time,
|
|
130
|
+
badge: getApprovalMeta(step.status).label,
|
|
131
|
+
status: toProcessStatus(step.status),
|
|
132
|
+
icon: step.icon,
|
|
133
|
+
}));
|
|
134
|
+
|
|
135
|
+
const timelineItems: TimelineItem[] = steps.map((step) => {
|
|
136
|
+
const meta = getApprovalMeta(step.status);
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
id: step.id,
|
|
140
|
+
title: step.title,
|
|
141
|
+
description: step.assignee,
|
|
142
|
+
timestamp: step.time,
|
|
143
|
+
status:
|
|
144
|
+
step.status === "approved"
|
|
145
|
+
? "success"
|
|
146
|
+
: step.status === "current"
|
|
147
|
+
? "current"
|
|
148
|
+
: step.status === "pending"
|
|
149
|
+
? "muted"
|
|
150
|
+
: "danger",
|
|
151
|
+
badge: meta.label,
|
|
152
|
+
content:
|
|
153
|
+
step.comment || step.reason ? (
|
|
154
|
+
<div className="rounded-lg bg-muted/60 px-3 py-2 text-sm text-muted-foreground">
|
|
155
|
+
{step.comment && <p>{step.comment}</p>}
|
|
156
|
+
{step.reason && <p className={cn(step.comment && "mt-1")}>原因:{step.reason}</p>}
|
|
157
|
+
</div>
|
|
158
|
+
) : undefined,
|
|
159
|
+
meta: step.assignee ? (
|
|
160
|
+
<span className="inline-flex items-center gap-1">
|
|
161
|
+
<UserRound className="size-3.5" />
|
|
162
|
+
{step.assignee}
|
|
163
|
+
</span>
|
|
164
|
+
) : undefined,
|
|
165
|
+
icon: step.icon ?? meta.icon,
|
|
166
|
+
};
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<Card className={className}>
|
|
171
|
+
<CardHeader className="border-b">
|
|
172
|
+
<div className="flex flex-wrap items-start justify-between gap-3">
|
|
173
|
+
<div>
|
|
174
|
+
<CardTitle>{title}</CardTitle>
|
|
175
|
+
<CardDescription className="mt-1">{description}</CardDescription>
|
|
176
|
+
</div>
|
|
177
|
+
<div className="flex flex-wrap gap-2">
|
|
178
|
+
<Badge variant={currentMeta.variant}>{currentMeta.label}</Badge>
|
|
179
|
+
<Badge variant="outline">
|
|
180
|
+
{summary.approvedCount}/{summary.totalCount} 已完成
|
|
181
|
+
</Badge>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
</CardHeader>
|
|
185
|
+
<CardContent className="space-y-6">
|
|
186
|
+
{showStepper && <ProcessStepper steps={processSteps} className="pt-1" />}
|
|
187
|
+
<div className="rounded-xl bg-muted/30 p-4">
|
|
188
|
+
<div className="flex flex-wrap items-center justify-between gap-3">
|
|
189
|
+
<div>
|
|
190
|
+
<p className="text-xs text-muted-foreground">当前节点</p>
|
|
191
|
+
<p className="mt-1 text-sm font-medium">{summary.current.title}</p>
|
|
192
|
+
</div>
|
|
193
|
+
{summary.current.assignee && (
|
|
194
|
+
<div className="text-right">
|
|
195
|
+
<p className="text-xs text-muted-foreground">当前处理人</p>
|
|
196
|
+
<p className="mt-1 text-sm">{summary.current.assignee}</p>
|
|
197
|
+
</div>
|
|
198
|
+
)}
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
<Timeline items={timelineItems} dense />
|
|
202
|
+
</CardContent>
|
|
203
|
+
</Card>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
ChevronLeft,
|
|
5
|
+
ChevronRight,
|
|
6
|
+
ChevronsLeft,
|
|
7
|
+
ChevronsRight,
|
|
8
|
+
} from "lucide-react";
|
|
9
|
+
import { useMemo } from "react";
|
|
10
|
+
import { useTranslation } from "react-i18next";
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
Select,
|
|
14
|
+
SelectContent,
|
|
15
|
+
SelectItem,
|
|
16
|
+
SelectTrigger,
|
|
17
|
+
SelectValue,
|
|
18
|
+
} from "@/components/ui/select";
|
|
19
|
+
import { Button } from "@/components/ui/button";
|
|
20
|
+
import { cn } from "@/lib/utils";
|
|
21
|
+
|
|
22
|
+
type DataTablePaginationProps = {
|
|
23
|
+
currentPage: number;
|
|
24
|
+
pageCount: number;
|
|
25
|
+
setCurrentPage: (page: number) => void;
|
|
26
|
+
pageSize: number;
|
|
27
|
+
setPageSize: (size: number) => void;
|
|
28
|
+
total?: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export function DataTablePagination({
|
|
32
|
+
currentPage,
|
|
33
|
+
pageCount,
|
|
34
|
+
setCurrentPage,
|
|
35
|
+
pageSize,
|
|
36
|
+
setPageSize,
|
|
37
|
+
total,
|
|
38
|
+
}: DataTablePaginationProps) {
|
|
39
|
+
const { t } = useTranslation();
|
|
40
|
+
const pageSizeOptions = useMemo(() => {
|
|
41
|
+
const baseOptions = [10, 20, 30, 40, 50];
|
|
42
|
+
const optionsSet = new Set(baseOptions);
|
|
43
|
+
|
|
44
|
+
if (!optionsSet.has(pageSize)) {
|
|
45
|
+
optionsSet.add(pageSize);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return Array.from(optionsSet).sort((a, b) => a - b);
|
|
49
|
+
}, [pageSize]);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
className={cn(
|
|
54
|
+
"flex",
|
|
55
|
+
"items-center",
|
|
56
|
+
"justify-between",
|
|
57
|
+
"flex-wrap",
|
|
58
|
+
"px-2",
|
|
59
|
+
"w-full",
|
|
60
|
+
"gap-2"
|
|
61
|
+
)}
|
|
62
|
+
>
|
|
63
|
+
<div
|
|
64
|
+
className={cn(
|
|
65
|
+
"flex-1",
|
|
66
|
+
"text-sm",
|
|
67
|
+
"text-muted-foreground",
|
|
68
|
+
"whitespace-nowrap"
|
|
69
|
+
)}
|
|
70
|
+
>
|
|
71
|
+
{typeof total === "number" ? `${total} ${t("dataTable.rows")}` : null}
|
|
72
|
+
</div>
|
|
73
|
+
<div className={cn("flex", "items-center", "flex-wrap", "gap-2")}>
|
|
74
|
+
<div className={cn("flex", "items-center", "gap-2")}>
|
|
75
|
+
<span className={cn("text-sm", "font-medium")}>{t("dataTable.rowsPerPage")}</span>
|
|
76
|
+
<Select
|
|
77
|
+
value={`${pageSize}`}
|
|
78
|
+
onValueChange={(v) => setPageSize(Number(v))}
|
|
79
|
+
>
|
|
80
|
+
<SelectTrigger className={cn("h-8", "w-[70px]")}>
|
|
81
|
+
<SelectValue placeholder={pageSize} />
|
|
82
|
+
</SelectTrigger>
|
|
83
|
+
<SelectContent side="top">
|
|
84
|
+
{pageSizeOptions.map((size) => (
|
|
85
|
+
<SelectItem key={size} value={`${size}`}>
|
|
86
|
+
{size}
|
|
87
|
+
</SelectItem>
|
|
88
|
+
))}
|
|
89
|
+
</SelectContent>
|
|
90
|
+
</Select>
|
|
91
|
+
</div>
|
|
92
|
+
<div className={cn("flex", "items-center", "flex-wrap", "gap-2")}>
|
|
93
|
+
<div
|
|
94
|
+
className={cn(
|
|
95
|
+
"flex",
|
|
96
|
+
"items-center",
|
|
97
|
+
"justify-center",
|
|
98
|
+
"text-sm",
|
|
99
|
+
"font-medium"
|
|
100
|
+
)}
|
|
101
|
+
>
|
|
102
|
+
{t("dataTable.pageOf", { current: currentPage, total: pageCount })}
|
|
103
|
+
</div>
|
|
104
|
+
<div className={cn("flex", "items-center", "gap-2")}>
|
|
105
|
+
<Button
|
|
106
|
+
variant="outline"
|
|
107
|
+
className={cn("hidden", "h-8", "w-8", "p-0", "lg:flex")}
|
|
108
|
+
onClick={() => setCurrentPage(1)}
|
|
109
|
+
disabled={currentPage === 1}
|
|
110
|
+
aria-label={t("dataTable.goToFirstPage")}
|
|
111
|
+
>
|
|
112
|
+
<ChevronsLeft />
|
|
113
|
+
</Button>
|
|
114
|
+
<Button
|
|
115
|
+
variant="outline"
|
|
116
|
+
className={cn("h-8", "w-8", "p-0")}
|
|
117
|
+
onClick={() => setCurrentPage(currentPage - 1)}
|
|
118
|
+
disabled={currentPage === 1}
|
|
119
|
+
aria-label={t("dataTable.goToPreviousPage")}
|
|
120
|
+
>
|
|
121
|
+
<ChevronLeft />
|
|
122
|
+
</Button>
|
|
123
|
+
<Button
|
|
124
|
+
variant="outline"
|
|
125
|
+
className={cn("h-8", "w-8", "p-0")}
|
|
126
|
+
onClick={() => setCurrentPage(currentPage + 1)}
|
|
127
|
+
disabled={currentPage === pageCount}
|
|
128
|
+
aria-label={t("dataTable.goToNextPage")}
|
|
129
|
+
>
|
|
130
|
+
<ChevronRight />
|
|
131
|
+
</Button>
|
|
132
|
+
<Button
|
|
133
|
+
variant="outline"
|
|
134
|
+
className={cn("hidden", "h-8", "w-8", "p-0", "lg:flex")}
|
|
135
|
+
onClick={() => setCurrentPage(pageCount)}
|
|
136
|
+
disabled={currentPage === pageCount}
|
|
137
|
+
aria-label={t("dataTable.goToLastPage")}
|
|
138
|
+
>
|
|
139
|
+
<ChevronsRight />
|
|
140
|
+
</Button>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
DataTablePagination.displayName = "DataTablePagination";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { Column } from "@tanstack/react-table";
|
|
4
|
+
import { ArrowDown, ArrowUp, ChevronsUpDown } from "lucide-react";
|
|
5
|
+
import { Button } from "@/components/ui/button";
|
|
6
|
+
import { cn } from "@/lib/utils";
|
|
7
|
+
import { useTranslation } from "react-i18next";
|
|
8
|
+
|
|
9
|
+
export type DataTableSorterProps<TData> = {
|
|
10
|
+
column: Column<TData>;
|
|
11
|
+
} & React.ComponentProps<typeof Button>;
|
|
12
|
+
|
|
13
|
+
export function DataTableSorter<TData>({
|
|
14
|
+
column,
|
|
15
|
+
className,
|
|
16
|
+
...props
|
|
17
|
+
}: DataTableSorterProps<TData>) {
|
|
18
|
+
const { t } = useTranslation();
|
|
19
|
+
const id = column.id;
|
|
20
|
+
const title =
|
|
21
|
+
column.getIsSorted() === "desc"
|
|
22
|
+
? t("dataTable.sortDesc", { id })
|
|
23
|
+
: column.getIsSorted() === "asc"
|
|
24
|
+
? t("dataTable.sortAsc", { id })
|
|
25
|
+
: t("dataTable.sortBy", { id });
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Button
|
|
29
|
+
variant="ghost"
|
|
30
|
+
size="icon"
|
|
31
|
+
onClick={() => column.toggleSorting(undefined, true)}
|
|
32
|
+
title={title}
|
|
33
|
+
aria-label={title}
|
|
34
|
+
{...props}
|
|
35
|
+
className={cn("data-[state=open]:bg-accent", "w-5 h-5", className)}
|
|
36
|
+
>
|
|
37
|
+
{column.getIsSorted() === "desc" ? (
|
|
38
|
+
<ArrowDown className={cn("text-primary", "!w-3", "!h-3")} />
|
|
39
|
+
) : column.getIsSorted() === "asc" ? (
|
|
40
|
+
<ArrowUp className={cn("text-primary", "!w-3", "!h-3")} />
|
|
41
|
+
) : (
|
|
42
|
+
<ChevronsUpDown
|
|
43
|
+
className={cn("text-muted-foreground", "!w-3", "!h-3")}
|
|
44
|
+
/>
|
|
45
|
+
)}
|
|
46
|
+
</Button>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
DataTableSorter.displayName = "DataTableSorter";
|