@skyroc/scripts 2.5.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/LICENSE +21 -0
- package/README.md +508 -0
- package/dist/cli.mjs +78 -0
- package/dist/config-BKkdncJS.mjs +987 -0
- package/dist/index.mjs +14 -0
- package/package.json +83 -0
- package/templates/admin/.env +62 -0
- package/templates/admin/.env.prod +7 -0
- package/templates/admin/.env.test +7 -0
- package/templates/admin/.oxlintrc.json +6 -0
- package/templates/admin/README.md +508 -0
- package/templates/admin/index.html +14 -0
- package/templates/admin/package.json +105 -0
- package/templates/admin/public/favicon.svg +3 -0
- package/templates/admin/src/App.tsx +71 -0
- package/templates/admin/src/assets/audio/wechat-style-notification.wav +0 -0
- package/templates/admin/src/assets/imgs/skyroc.jpg +0 -0
- package/templates/admin/src/assets/svg-icon/activity.svg +1 -0
- package/templates/admin/src/assets/svg-icon/at-sign.svg +1 -0
- package/templates/admin/src/assets/svg-icon/avatar.svg +1 -0
- package/templates/admin/src/assets/svg-icon/banner.svg +1 -0
- package/templates/admin/src/assets/svg-icon/cast.svg +1 -0
- package/templates/admin/src/assets/svg-icon/chrome.svg +1 -0
- package/templates/admin/src/assets/svg-icon/copy.svg +1 -0
- package/templates/admin/src/assets/svg-icon/custom-icon.svg +1 -0
- package/templates/admin/src/assets/svg-icon/empty-data.svg +1 -0
- package/templates/admin/src/assets/svg-icon/error.svg +1 -0
- package/templates/admin/src/assets/svg-icon/expectation.svg +1 -0
- package/templates/admin/src/assets/svg-icon/heart.svg +1 -0
- package/templates/admin/src/assets/svg-icon/logo.svg +15 -0
- package/templates/admin/src/assets/svg-icon/network-error.svg +1 -0
- package/templates/admin/src/assets/svg-icon/no-icon.svg +1 -0
- package/templates/admin/src/assets/svg-icon/no-permission.svg +1 -0
- package/templates/admin/src/assets/svg-icon/not-found.svg +1 -0
- package/templates/admin/src/assets/svg-icon/service-error.svg +1 -0
- package/templates/admin/src/bootstrap.tsx +60 -0
- package/templates/admin/src/components/SkyrocAvatar.tsx +13 -0
- package/templates/admin/src/components/SystemLogo.tsx +7 -0
- package/templates/admin/src/config.ts +125 -0
- package/templates/admin/src/features/antd/AntdProvider.tsx +21 -0
- package/templates/admin/src/features/auth/components/UserAvatar.tsx +76 -0
- package/templates/admin/src/features/auth/use-auth-form-rules.ts +83 -0
- package/templates/admin/src/features/auth/use-auth.ts +96 -0
- package/templates/admin/src/features/auth/use-login.ts +72 -0
- package/templates/admin/src/features/effects/GlobalEffect.tsx +15 -0
- package/templates/admin/src/features/menus/dynamic-routes.ts +10 -0
- package/templates/admin/src/features/menus/extras.ts +3 -0
- package/templates/admin/src/features/menus/menu-category.ts +14 -0
- package/templates/admin/src/features/menus/menu-config.ts +5 -0
- package/templates/admin/src/features/router/RouterProvider.tsx +18 -0
- package/templates/admin/src/features/router/guard.ts +97 -0
- package/templates/admin/src/features/router/index.ts +52 -0
- package/templates/admin/src/features/router/routeTree.gen.ts +237 -0
- package/templates/admin/src/features/router/router-ref.ts +24 -0
- package/templates/admin/src/locales/antd.ts +8 -0
- package/templates/admin/src/locales/index.ts +22 -0
- package/templates/admin/src/locales/sync.ts +14 -0
- package/templates/admin/src/main.tsx +9 -0
- package/templates/admin/src/pages/(admin)/home/index.tsx +46 -0
- package/templates/admin/src/pages/(admin)/layout.tsx +44 -0
- package/templates/admin/src/pages/(auth)/login/index.tsx +102 -0
- package/templates/admin/src/pages/(auth)/login/layout.tsx +71 -0
- package/templates/admin/src/pages/(auth)/login-out.tsx +27 -0
- package/templates/admin/src/pages/(errors)/403.tsx +16 -0
- package/templates/admin/src/pages/(errors)/404.tsx +16 -0
- package/templates/admin/src/pages/(errors)/500.tsx +16 -0
- package/templates/admin/src/pages/__root.tsx +54 -0
- package/templates/admin/src/pages/error.tsx +19 -0
- package/templates/admin/src/pages/index.tsx +14 -0
- package/templates/admin/src/pages/loading.tsx +45 -0
- package/templates/admin/src/pages/not-found.tsx +9 -0
- package/templates/admin/src/plugins/app.tsx +47 -0
- package/templates/admin/src/plugins/assets.ts +4 -0
- package/templates/admin/src/plugins/index.ts +32 -0
- package/templates/admin/src/service/adapter.ts +63 -0
- package/templates/admin/src/service/api/auth/api.ts +31 -0
- package/templates/admin/src/service/api/auth/hooks.ts +28 -0
- package/templates/admin/src/service/api/auth/index.ts +10 -0
- package/templates/admin/src/service/api/auth/keys.ts +7 -0
- package/templates/admin/src/service/api/auth/urls.ts +7 -0
- package/templates/admin/src/service/api/index.ts +2 -0
- package/templates/admin/src/service/api/route/api.ts +7 -0
- package/templates/admin/src/service/api/route/hooks.ts +21 -0
- package/templates/admin/src/service/api/route/index.ts +10 -0
- package/templates/admin/src/service/api/route/keys.ts +3 -0
- package/templates/admin/src/service/api/route/urls.ts +5 -0
- package/templates/admin/src/service/queryClient.ts +13 -0
- package/templates/admin/src/service/request/index.ts +62 -0
- package/templates/admin/src/styles/scss/global.scss +1 -0
- package/templates/admin/src/styles/scss/scrollbar.scss +28 -0
- package/templates/admin/src/types/auto-imports.d.ts +186 -0
- package/templates/admin/src/types/global.d.ts +16 -0
- package/templates/admin/src/types/router.d.ts +14 -0
- package/templates/admin/src/types/storage.d.ts +17 -0
- package/templates/admin/src/types/vite-env.d.ts +117 -0
- package/templates/admin/src/utils/common.tsx +38 -0
- package/templates/admin/src/utils/icon.ts +9 -0
- package/templates/admin/src/utils/service.ts +75 -0
- package/templates/admin/src/utils/storage.ts +7 -0
- package/templates/admin/tsconfig.json +22 -0
- package/templates/admin/uno.config.ts +18 -0
- package/templates/admin/vite.config.ts +13 -0
- package/templates/admin-shell/i18n/atoms/lang.ts +20 -0
- package/templates/admin-shell/i18n/config/default.ts +11 -0
- package/templates/admin-shell/i18n/features/lang/LangEffect.tsx +25 -0
- package/templates/admin-shell/i18n/features/lang/LangSwitch.tsx +49 -0
- package/templates/admin-shell/i18n/hooks/use-lang.ts +47 -0
- package/templates/admin-shell/i18n/i18n.ts +116 -0
- package/templates/admin-shell/i18n/index.ts +23 -0
- package/templates/admin-shell/i18n/langs/en-us/common.json +49 -0
- package/templates/admin-shell/i18n/langs/en-us/datatable.json +8 -0
- package/templates/admin-shell/i18n/langs/en-us/dropdown.json +9 -0
- package/templates/admin-shell/i18n/langs/en-us/form.json +27 -0
- package/templates/admin-shell/i18n/langs/en-us/icon.json +13 -0
- package/templates/admin-shell/i18n/langs/en-us/notification.json +20 -0
- package/templates/admin-shell/i18n/langs/en-us/page.json +442 -0
- package/templates/admin-shell/i18n/langs/en-us/request.json +8 -0
- package/templates/admin-shell/i18n/langs/en-us/route.json +84 -0
- package/templates/admin-shell/i18n/langs/en-us/system.json +9 -0
- package/templates/admin-shell/i18n/langs/en-us/theme.json +173 -0
- package/templates/admin-shell/i18n/langs/index.ts +63 -0
- package/templates/admin-shell/i18n/langs/zh-cn/common.json +49 -0
- package/templates/admin-shell/i18n/langs/zh-cn/datatable.json +8 -0
- package/templates/admin-shell/i18n/langs/zh-cn/dropdown.json +9 -0
- package/templates/admin-shell/i18n/langs/zh-cn/form.json +27 -0
- package/templates/admin-shell/i18n/langs/zh-cn/icon.json +13 -0
- package/templates/admin-shell/i18n/langs/zh-cn/notification.json +20 -0
- package/templates/admin-shell/i18n/langs/zh-cn/page.json +442 -0
- package/templates/admin-shell/i18n/langs/zh-cn/request.json +8 -0
- package/templates/admin-shell/i18n/langs/zh-cn/route.json +84 -0
- package/templates/admin-shell/i18n/langs/zh-cn/system.json +9 -0
- package/templates/admin-shell/i18n/langs/zh-cn/theme.json +173 -0
- package/templates/admin-shell/i18n/types/i18n.ts +29 -0
- package/templates/admin-shell/i18n/types.ts +53 -0
- package/templates/admin-shell/i18n/utils/helpers.ts +18 -0
- package/templates/admin-shell/layouts/AdminLayout.tsx +161 -0
- package/templates/admin-shell/layouts/constant.ts +56 -0
- package/templates/admin-shell/layouts/context.tsx +101 -0
- package/templates/admin-shell/layouts/features/menus/MenuBadge.tsx +76 -0
- package/templates/admin-shell/layouts/features/menus/dynamic-routes.ts +146 -0
- package/templates/admin-shell/layouts/features/menus/menu-generator.tsx +444 -0
- package/templates/admin-shell/layouts/features/menus/menu-renderer.tsx +149 -0
- package/templates/admin-shell/layouts/features/menus/permissions.ts +28 -0
- package/templates/admin-shell/layouts/features/menus/use-menus.ts +98 -0
- package/templates/admin-shell/layouts/features/use-route.ts +30 -0
- package/templates/admin-shell/layouts/index.ts +44 -0
- package/templates/admin-shell/layouts/materials/index.ts +6 -0
- package/templates/admin-shell/layouts/materials/libs/admin-layout/index.module.css +63 -0
- package/templates/admin-shell/layouts/materials/libs/admin-layout/index.module.css.d.ts +18 -0
- package/templates/admin-shell/layouts/materials/libs/admin-layout/index.tsx +238 -0
- package/templates/admin-shell/layouts/materials/libs/admin-layout/shared.ts +67 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/ButtonTab.tsx +44 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/ChromeTab.tsx +54 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/ChromeTabBg.tsx +30 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/SliderTab.tsx +44 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/SvgClose.tsx +51 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/hook.ts +34 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/index.module.css +120 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/index.module.css.d.ts +18 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/index.tsx +76 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/shared.ts +32 -0
- package/templates/admin-shell/layouts/materials/types/index.ts +322 -0
- package/templates/admin-shell/layouts/modules/AdminContent.tsx +285 -0
- package/templates/admin-shell/layouts/modules/AdminFooter.tsx +13 -0
- package/templates/admin-shell/layouts/modules/AdminLogo.tsx +28 -0
- package/templates/admin-shell/layouts/modules/AdminSider.tsx +50 -0
- package/templates/admin-shell/layouts/modules/admin-header/AdminHeader.tsx +132 -0
- package/templates/admin-shell/layouts/modules/admin-header/components/Breadcrumb.tsx +62 -0
- package/templates/admin-shell/layouts/modules/admin-header/components/ThemeButton.tsx +24 -0
- package/templates/admin-shell/layouts/modules/admin-menu/AdminMenu.tsx +37 -0
- package/templates/admin-shell/layouts/modules/admin-menu/components/FirstLevelMenu.tsx +156 -0
- package/templates/admin-shell/layouts/modules/admin-menu/components/HorizontalMenu.tsx +88 -0
- package/templates/admin-shell/layouts/modules/admin-menu/components/MenuPortal.tsx +28 -0
- package/templates/admin-shell/layouts/modules/admin-menu/components/VerticalMenu.tsx +123 -0
- package/templates/admin-shell/layouts/modules/admin-menu/enum.ts +47 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/Horizontal.tsx +22 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/TopHybridHeaderFirst.tsx +15 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/TopHybridSidebarFirst.tsx +18 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/Vertical.tsx +14 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/VerticalHybridHeaderFirst.tsx +18 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/VerticalMix.tsx +132 -0
- package/templates/admin-shell/layouts/modules/admin-search/AdminSearch.tsx +36 -0
- package/templates/admin-shell/layouts/modules/admin-search/components/SearchFooter.tsx +38 -0
- package/templates/admin-shell/layouts/modules/admin-search/components/SearchModal.tsx +171 -0
- package/templates/admin-shell/layouts/modules/admin-search/components/SearchResult.tsx +43 -0
- package/templates/admin-shell/layouts/modules/admin-tab/AdminTab.tsx +125 -0
- package/templates/admin-shell/layouts/modules/admin-tab/components/TabContextMenu.tsx +107 -0
- package/templates/admin-shell/layouts/modules/admin-tab/hooks/useTabScroll.ts +86 -0
- package/templates/admin-shell/layouts/modules/shared/logo.ts +42 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/ThemeDrawer.tsx +68 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/components/AnimatedCollapse.tsx +36 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/components/AnimatedItem.tsx +35 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/components/LayoutModeCard.tsx +110 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/components/SettingItem.tsx +31 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/ConfigOperation.tsx +53 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/CustomPicker.tsx +105 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeColor.tsx +58 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeSchema.tsx +42 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeToken.tsx +44 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/index.tsx +23 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/GlobalSettings.tsx +57 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/ThemeGeneral.tsx +20 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/WatermarkSettings.tsx +103 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/ContentSettings.tsx +100 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/FooterSettings.tsx +71 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/HeaderSettings.tsx +63 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/LayoutMode.tsx +73 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/SiderSettings.tsx +124 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/TabSettings.tsx +95 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/ThemeLayout.tsx +32 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/preset/ThemePreset.tsx +132 -0
- package/templates/admin-shell/layouts/options.tsx +79 -0
- package/templates/admin-shell/layouts/setup.ts +102 -0
- package/templates/admin-shell/layouts/state/AdminEffect.tsx +56 -0
- package/templates/admin-shell/layouts/state/AdminTabEffect.tsx +28 -0
- package/templates/admin-shell/layouts/state/index.ts +3 -0
- package/templates/admin-shell/layouts/state/menus/MenuToggler.tsx +53 -0
- package/templates/admin-shell/layouts/state/menus/use-admin-menu-badges.ts +46 -0
- package/templates/admin-shell/layouts/state/menus/use-admin-menus.tsx +164 -0
- package/templates/admin-shell/layouts/state/tabs/index.ts +1 -0
- package/templates/admin-shell/layouts/state/tabs/shared.tsx +148 -0
- package/templates/admin-shell/layouts/state/tabs/use-admin-tab.ts +377 -0
- package/templates/admin-shell/layouts/state/use-admin-state.ts +118 -0
- package/templates/admin-shell/layouts/types/router.d.ts +10 -0
- package/templates/admin-shell/layouts/types/storage.ts +18 -0
- package/templates/admin-shell/notification/NotificationButton.tsx +91 -0
- package/templates/admin-shell/notification/NotificationContext.ts +8 -0
- package/templates/admin-shell/notification/NotificationPanel.tsx +194 -0
- package/templates/admin-shell/notification/NotificationProvider.tsx +59 -0
- package/templates/admin-shell/notification/index.ts +12 -0
- package/templates/admin-shell/notification/mock.ts +59 -0
- package/templates/admin-shell/notification/notification-store.ts +438 -0
- package/templates/admin-shell/notification/notification.css +60 -0
- package/templates/admin-shell/notification/types.ts +104 -0
- package/templates/admin-shell/notification/use-notification.ts +51 -0
- package/templates/admin-shell/notification/useNotificationContext.ts +14 -0
- package/templates/admin-shell/runtime/app-update.ts +156 -0
- package/templates/admin-shell/runtime/dayjs.ts +20 -0
- package/templates/admin-shell/runtime/iconify.ts +17 -0
- package/templates/admin-shell/runtime/index.ts +10 -0
- package/templates/admin-shell/runtime/nprogress.ts +25 -0
- package/templates/admin-shell/runtime/plugins.ts +62 -0
- package/templates/admin-shell/styles/global.css +54 -0
- package/templates/admin-shell/styles/nprogress.css +85 -0
- package/templates/admin-shell/styles/reset.css +378 -0
- package/templates/admin-shell/theme/antd/AntdProvider.tsx +106 -0
- package/templates/admin-shell/theme/antd/index.ts +23 -0
- package/templates/admin-shell/theme/antd/shared.ts +80 -0
- package/templates/admin-shell/theme/antd/ui.ts +250 -0
- package/templates/admin-shell/theme/antd-algorithm/algorithm/dark/colors.ts +99 -0
- package/templates/admin-shell/theme/antd-algorithm/algorithm/dark/index.ts +87 -0
- package/templates/admin-shell/theme/antd-algorithm/algorithm/default/colors.ts +91 -0
- package/templates/admin-shell/theme/antd-algorithm/algorithm/default/index.ts +77 -0
- package/templates/admin-shell/theme/antd-algorithm/index.ts +80 -0
- package/templates/admin-shell/theme/antd-algorithm/seed/index.ts +41 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/colorAlgorithm.ts +10 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genColorMapToken.ts +165 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genCommonMapToken.ts +23 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genControlHeight.ts +14 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genFontMapToken.ts +274 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genRadiusMapToken.ts +139 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genSizeMapToken.ts +114 -0
- package/templates/admin-shell/theme/antd-algorithm/types/index.ts +20 -0
- package/templates/admin-shell/theme/components/ThemeEffect.tsx +55 -0
- package/templates/admin-shell/theme/components/ThemeSchemaSegmented.tsx +27 -0
- package/templates/admin-shell/theme/components/ThemeSchemaSwitch.tsx +77 -0
- package/templates/admin-shell/theme/components/shared.ts +5 -0
- package/templates/admin-shell/theme/config/default.ts +108 -0
- package/templates/admin-shell/theme/config/index.ts +1 -0
- package/templates/admin-shell/theme/hooks/index.ts +2 -0
- package/templates/admin-shell/theme/hooks/use-theme.ts +244 -0
- package/templates/admin-shell/theme/index.ts +78 -0
- package/templates/admin-shell/theme/presets/azir.json +39 -0
- package/templates/admin-shell/theme/presets/compact.json +38 -0
- package/templates/admin-shell/theme/presets/dark.json +93 -0
- package/templates/admin-shell/theme/presets/default.json +95 -0
- package/templates/admin-shell/theme/presets/index.ts +29 -0
- package/templates/admin-shell/theme/presets/shadcn.json +99 -0
- package/templates/admin-shell/theme/setup.ts +115 -0
- package/templates/admin-shell/theme/types/index.ts +27 -0
- package/templates/admin-shell/theme/types/theme.d.ts +316 -0
- package/templates/admin-shell/theme/utils/dark-mode.ts +46 -0
- package/templates/admin-shell/theme/utils/filters.ts +20 -0
- package/templates/admin-shell/theme/utils/index.ts +3 -0
- package/templates/admin-shell/theme/utils/settings.ts +43 -0
- package/templates/admin-shell/types/api/auth.d.ts +148 -0
- package/templates/admin-shell/types/api/common.d.ts +54 -0
- package/templates/admin-shell/types/api/route.d.ts +104 -0
- package/templates/admin-shell/types/api/service.d.ts +51 -0
- package/templates/admin-shell/types/api/system-manage.d.ts +160 -0
- package/templates/admin-shell/types/app/common.d.ts +31 -0
- package/templates/admin-shell/types/app/global.d.ts +71 -0
- package/templates/admin-shell/types/app/menu.d.ts +57 -0
- package/templates/admin-shell/types/app/router.d.ts +201 -0
- package/templates/admin-shell/types/app/storage.d.ts +10 -0
- package/templates/admin-shell/types/app/union-key.d.ts +156 -0
- package/templates/admin-shell/types/locales/i18n.d.ts +135 -0
- package/templates/admin-shell/ui/antd/components/AppTree.tsx +62 -0
- package/templates/admin-shell/ui/antd/components/BeyondHiding.tsx +42 -0
- package/templates/admin-shell/ui/antd/components/ButtonIcon.tsx +123 -0
- package/templates/admin-shell/ui/antd/components/ButtonLink.tsx +30 -0
- package/templates/admin-shell/ui/antd/components/ErrorBoundary.tsx +45 -0
- package/templates/admin-shell/ui/antd/components/ExceptionBase.tsx +69 -0
- package/templates/admin-shell/ui/antd/components/FullScreen.tsx +33 -0
- package/templates/admin-shell/ui/antd/components/PinToggler.tsx +35 -0
- package/templates/admin-shell/ui/antd/components/ReloadButton.tsx +20 -0
- package/templates/admin-shell/ui/antd/components/index.ts +12 -0
- package/templates/admin-shell/ui/antd/components/styles/button-icon-animations.css +246 -0
- package/templates/admin-shell/ui/antd/index.ts +1 -0
- package/templates/admin-shell/ui/antd/styles.d.ts +1 -0
- package/templates/admin-shell/ui/compose/animate-feature.ts +5 -0
- package/templates/admin-shell/ui/compose/components/BetterScroll.tsx +51 -0
- package/templates/admin-shell/ui/compose/components/DarkModeContainer.tsx +22 -0
- package/templates/admin-shell/ui/compose/components/FlipText.tsx +41 -0
- package/templates/admin-shell/ui/compose/components/I18nLabel.tsx +18 -0
- package/templates/admin-shell/ui/compose/components/LazyAnimate.tsx +10 -0
- package/templates/admin-shell/ui/compose/components/LookForward.tsx +24 -0
- package/templates/admin-shell/ui/compose/components/NumberTicker.tsx +105 -0
- package/templates/admin-shell/ui/compose/components/Portal.tsx +74 -0
- package/templates/admin-shell/ui/compose/components/SvgIcon.tsx +39 -0
- package/templates/admin-shell/ui/compose/components/TypingAnimation.tsx +83 -0
- package/templates/admin-shell/ui/compose/components/WaveBg.tsx +56 -0
- package/templates/admin-shell/ui/compose/components/index.ts +11 -0
- package/templates/admin-shell/ui/compose/index.ts +2 -0
- package/templates/admin-shell/ui/compose/table/DragContent.tsx +239 -0
- package/templates/admin-shell/ui/compose/table/TableHeaderOperation.tsx +210 -0
- package/templates/admin-shell/ui/compose/table/hooks.ts +196 -0
- package/templates/admin-shell/ui/compose/table/index.ts +16 -0
- package/templates/admin-shell/ui/compose/table/types.ts +244 -0
- package/templates/admin-shell/ui/compose/table/use-table-operate.ts +136 -0
- package/templates/admin-shell/ui/compose/table/use-table-scroll.ts +49 -0
- package/templates/admin-shell/ui/compose/table/use-table.ts +303 -0
- package/templates/admin.meta.json +756 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ExceptionBase } from '@shell/ui/antd';
|
|
2
|
+
import { createFileRoute } from '@tanstack/react-router';
|
|
3
|
+
|
|
4
|
+
const NotFound = () => {
|
|
5
|
+
const { t } = useTranslation();
|
|
6
|
+
|
|
7
|
+
return <ExceptionBase buttonText={t('common.backToHome')} type="404" />;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Route = createFileRoute('/(errors)/404')({
|
|
11
|
+
component: NotFound,
|
|
12
|
+
staticData: {
|
|
13
|
+
title: '404',
|
|
14
|
+
i18nKey: 'route.404'
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ExceptionBase } from '@shell/ui/antd';
|
|
2
|
+
import { createFileRoute } from '@tanstack/react-router';
|
|
3
|
+
|
|
4
|
+
const GeneralError = () => {
|
|
5
|
+
const { t } = useTranslation();
|
|
6
|
+
|
|
7
|
+
return <ExceptionBase buttonText={t('common.backToHome')} type="500" />;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Route = createFileRoute('/(errors)/500')({
|
|
11
|
+
component: GeneralError,
|
|
12
|
+
staticData: {
|
|
13
|
+
title: '500',
|
|
14
|
+
i18nKey: 'route.500'
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Outlet, createRootRouteWithContext, useLocation, useMatches } from '@tanstack/react-router';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
|
|
4
|
+
import ErrorPage from './error';
|
|
5
|
+
import NotFound from './not-found';
|
|
6
|
+
import GlobalLoading from './loading';
|
|
7
|
+
|
|
8
|
+
interface RouteMatchWithStaticData {
|
|
9
|
+
/** Route metadata used by global document side effects. */
|
|
10
|
+
staticData?: Router.Meta;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getCurrentRouteMeta(matches: RouteMatchWithStaticData[]) {
|
|
14
|
+
return matches.findLast(match => match.staticData?.i18nKey || match.staticData?.title)?.staticData ?? null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const Root = () => {
|
|
18
|
+
const { pathname } = useLocation();
|
|
19
|
+
const matches = useMatches();
|
|
20
|
+
const { t } = useTranslation();
|
|
21
|
+
const routeMeta = getCurrentRouteMeta(matches);
|
|
22
|
+
const documentTitle = routeMeta?.i18nKey ? t(routeMeta.i18nKey) : routeMeta?.title;
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (documentTitle) {
|
|
26
|
+
document.title = documentTitle;
|
|
27
|
+
}
|
|
28
|
+
}, [documentTitle]);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
globalConfig.nprogress.done();
|
|
32
|
+
|
|
33
|
+
return () => {
|
|
34
|
+
globalConfig.nprogress.start();
|
|
35
|
+
};
|
|
36
|
+
}, [pathname]);
|
|
37
|
+
|
|
38
|
+
return <Outlet />;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Route = createRootRouteWithContext<Router.RouterContext>()({
|
|
42
|
+
component: Root,
|
|
43
|
+
notFoundComponent: NotFound,
|
|
44
|
+
beforeLoad: async ({ context }) => {
|
|
45
|
+
if (!context.isAuthInitialized && context.isLoggedIn) {
|
|
46
|
+
await context.initAuth();
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
staticData: {
|
|
50
|
+
title: 'SkyrocAdmin'
|
|
51
|
+
},
|
|
52
|
+
errorComponent: ErrorPage,
|
|
53
|
+
pendingComponent: GlobalLoading
|
|
54
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ErrorBoundary } from '@shell/ui/antd';
|
|
2
|
+
import type { ErrorComponentProps } from '@tanstack/react-router';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
|
|
5
|
+
const ErrorPage = (props: ErrorComponentProps) => {
|
|
6
|
+
const { error, reset } = props;
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<ErrorBoundary
|
|
11
|
+
error={error}
|
|
12
|
+
errorHint={t('common.errorHint')}
|
|
13
|
+
resetErrorBoundary={reset}
|
|
14
|
+
retryText={t('common.tryAlign')}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default ErrorPage;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createFileRoute, redirect } from '@tanstack/react-router';
|
|
2
|
+
|
|
3
|
+
export const Route = createFileRoute('/')({
|
|
4
|
+
beforeLoad: ({ context }) => {
|
|
5
|
+
if (context.isLoggedIn) {
|
|
6
|
+
throw redirect({ to: context.getHomeRoute() });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
throw redirect({ to: '/login' });
|
|
10
|
+
},
|
|
11
|
+
staticData: {
|
|
12
|
+
title: 'SkyrocAdmin'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// @unocss-include
|
|
2
|
+
import { getHsl } from '@skyroc/color';
|
|
3
|
+
import { toggleCssDarkMode } from '@shell/theme';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
|
|
6
|
+
import SystemLogo from '@/components/SystemLogo';
|
|
7
|
+
import { globalConfig } from '@/config';
|
|
8
|
+
|
|
9
|
+
const GlobalLoading = memo(() => {
|
|
10
|
+
const { t } = useTranslation();
|
|
11
|
+
|
|
12
|
+
const { defaultDarkMode, defaultThemeColor } = globalConfig;
|
|
13
|
+
|
|
14
|
+
if (defaultDarkMode) {
|
|
15
|
+
toggleCssDarkMode(true);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { h, l, s } = getHsl(defaultThemeColor);
|
|
19
|
+
|
|
20
|
+
const loadingClasses = [
|
|
21
|
+
'left-0 top-0',
|
|
22
|
+
'left-0 bottom-0 animate-delay-500',
|
|
23
|
+
'right-0 top-0 animate-delay-1000',
|
|
24
|
+
'right-0 bottom-0 animate-delay-1500'
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
className="fixed-center flex-col bg-layout"
|
|
30
|
+
style={{ '--primary-color': `${h} ${s}% ${l}%` } as React.CSSProperties}
|
|
31
|
+
>
|
|
32
|
+
<SystemLogo className="size-128px text-primary" />
|
|
33
|
+
<div className="my-4xl size-4xl">
|
|
34
|
+
<div className="relative h-full animate-spin">
|
|
35
|
+
{loadingClasses.map(item => {
|
|
36
|
+
return <div className={clsx('absolute size-md animate-pulse rounded-lg bg-primary', item)} key={item} />;
|
|
37
|
+
})}
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<h2 className="text-2xl text-primary font-500">{t('system.title')}</h2>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export default GlobalLoading;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { SetupAppVersionNotificationOptions } from '@shell/runtime';
|
|
2
|
+
|
|
3
|
+
import { destroyNotification, globalConfig, showNotification } from '@/config';
|
|
4
|
+
import { router } from '@/features/router';
|
|
5
|
+
|
|
6
|
+
import { $t } from '../locales';
|
|
7
|
+
|
|
8
|
+
const UPDATE_NOTIFICATION_KEY = 'update-notification';
|
|
9
|
+
|
|
10
|
+
export function createAdminAppVersionNotificationPluginOptions(): SetupAppVersionNotificationOptions {
|
|
11
|
+
return {
|
|
12
|
+
baseUrl: import.meta.env.VITE_BASE_URL || '/',
|
|
13
|
+
currentBuildTime: BUILD_TIME,
|
|
14
|
+
enabled: globalConfig.automaticallyDetectUpdate && import.meta.env.PROD,
|
|
15
|
+
onError(error) {
|
|
16
|
+
// oxlint-disable-next-line no-console
|
|
17
|
+
console.error('Failed to get HTML build time:', error);
|
|
18
|
+
},
|
|
19
|
+
onUpdateAvailable({ markPromptClosed }) {
|
|
20
|
+
const handleCancel = () => {
|
|
21
|
+
destroyNotification(UPDATE_NOTIFICATION_KEY);
|
|
22
|
+
markPromptClosed();
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const handleOk = () => {
|
|
26
|
+
router.navigate({ to: '.' });
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
showNotification({
|
|
30
|
+
actions: (
|
|
31
|
+
<div className="w-325px flex justify-end gap-3">
|
|
32
|
+
<AButton key="cancel" onClick={handleCancel}>
|
|
33
|
+
{$t('system.updateCancel')}
|
|
34
|
+
</AButton>
|
|
35
|
+
<AButton key="ok" type="primary" onClick={handleOk}>
|
|
36
|
+
{$t('system.updateConfirm')}
|
|
37
|
+
</AButton>
|
|
38
|
+
</div>
|
|
39
|
+
),
|
|
40
|
+
description: $t('system.updateContent'),
|
|
41
|
+
key: UPDATE_NOTIFICATION_KEY,
|
|
42
|
+
onClose: markPromptClosed,
|
|
43
|
+
title: $t('system.updateTitle')
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { setupAdminRuntimePlugins } from '@shell/runtime';
|
|
2
|
+
import type { SetupDayjsOptions, SetupIconifyOfflineOptions, SetupNProgressOptions } from '@shell/runtime';
|
|
3
|
+
|
|
4
|
+
import { initNProgress } from '@/config';
|
|
5
|
+
|
|
6
|
+
import { createAdminAppVersionNotificationPluginOptions } from './app';
|
|
7
|
+
|
|
8
|
+
export * from './app';
|
|
9
|
+
|
|
10
|
+
const adminDayjsPluginOptions = {
|
|
11
|
+
withLocaleData: true
|
|
12
|
+
} satisfies SetupDayjsOptions;
|
|
13
|
+
|
|
14
|
+
const adminIconifyOfflinePluginOptions = {
|
|
15
|
+
apiUrl: import.meta.env.VITE_ICONIFY_URL
|
|
16
|
+
} satisfies SetupIconifyOfflineOptions;
|
|
17
|
+
|
|
18
|
+
const adminNProgressPluginOptions = {
|
|
19
|
+
easing: 'ease',
|
|
20
|
+
onReady: initNProgress,
|
|
21
|
+
parent: '.root',
|
|
22
|
+
speed: 500
|
|
23
|
+
} satisfies SetupNProgressOptions;
|
|
24
|
+
|
|
25
|
+
export function setupAdminPlugins() {
|
|
26
|
+
return setupAdminRuntimePlugins({
|
|
27
|
+
dayjs: adminDayjsPluginOptions,
|
|
28
|
+
appVersionNotification: createAdminAppVersionNotificationPluginOptions(),
|
|
29
|
+
iconifyOffline: adminIconifyOfflinePluginOptions,
|
|
30
|
+
nprogress: adminNProgressPluginOptions
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { RequestAdapter } from '@skyroc/service';
|
|
2
|
+
|
|
3
|
+
import { setAuth } from '@/features/auth/use-auth';
|
|
4
|
+
import { getRouter } from '@/features/router/router-ref';
|
|
5
|
+
import { $t } from '@/locales';
|
|
6
|
+
import { localStg } from '@/utils/storage';
|
|
7
|
+
|
|
8
|
+
import { fetchRefreshToken } from './api/auth/api';
|
|
9
|
+
import { AUTH_URLS } from './api/auth/urls';
|
|
10
|
+
|
|
11
|
+
function showRequestErrorMessage(msg: string, onClose?: () => void) {
|
|
12
|
+
if (onClose) {
|
|
13
|
+
showErrorMessage({ content: msg, onClose });
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
showErrorMessage(msg);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function showRequestErrorModal(options: Parameters<RequestAdapter['showErrorModal']>[0]) {
|
|
21
|
+
showErrorModal({
|
|
22
|
+
content: options.content,
|
|
23
|
+
keyboard: false,
|
|
24
|
+
maskClosable: options.maskClosable ?? false,
|
|
25
|
+
okText: $t('common.confirm'),
|
|
26
|
+
onCancel() {
|
|
27
|
+
options.onConfirm();
|
|
28
|
+
},
|
|
29
|
+
onOk() {
|
|
30
|
+
options.onConfirm();
|
|
31
|
+
},
|
|
32
|
+
title: options.title
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const antdAdapter: RequestAdapter = {
|
|
37
|
+
fetchRefreshToken,
|
|
38
|
+
getCurrentPath() {
|
|
39
|
+
return getRouter().state.location.href;
|
|
40
|
+
},
|
|
41
|
+
getRefreshToken() {
|
|
42
|
+
return localStg.get('refreshToken') || null;
|
|
43
|
+
},
|
|
44
|
+
getToken() {
|
|
45
|
+
return localStg.get('token') || null;
|
|
46
|
+
},
|
|
47
|
+
redirectToLogin(redirectPath?: string) {
|
|
48
|
+
getRouter().navigate({ search: { redirect: redirectPath }, to: '/login-out' });
|
|
49
|
+
},
|
|
50
|
+
refreshTokenUrl: AUTH_URLS.REFRESH_TOKEN,
|
|
51
|
+
resetAuth() {
|
|
52
|
+
localStg.remove('token');
|
|
53
|
+
localStg.remove('refreshToken');
|
|
54
|
+
},
|
|
55
|
+
setAuth(tokens) {
|
|
56
|
+
setAuth({ refreshToken: tokens.refreshToken, token: tokens.token });
|
|
57
|
+
},
|
|
58
|
+
showErrorMessage: showRequestErrorMessage,
|
|
59
|
+
showErrorModal: showRequestErrorModal,
|
|
60
|
+
t(key: string) {
|
|
61
|
+
return $t(key);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getToken } from '@/features/auth/use-auth';
|
|
2
|
+
|
|
3
|
+
import { request } from '../../request';
|
|
4
|
+
|
|
5
|
+
import { AUTH_URLS } from './urls';
|
|
6
|
+
|
|
7
|
+
export function fetchLogin(params: Api.Auth.LoginParams) {
|
|
8
|
+
return request<Api.Auth.LoginResponse>({
|
|
9
|
+
data: params,
|
|
10
|
+
method: 'post',
|
|
11
|
+
url: AUTH_URLS.LOGIN
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function fetchGetUserInfo() {
|
|
16
|
+
if (!getToken()) {
|
|
17
|
+
return Promise.resolve(null);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return request<Api.Auth.UserInfo>({ url: AUTH_URLS.GET_USER_INFO });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function fetchRefreshToken(refreshToken: string) {
|
|
24
|
+
return request<Api.Auth.LoginToken>({
|
|
25
|
+
data: {
|
|
26
|
+
refreshToken
|
|
27
|
+
},
|
|
28
|
+
method: 'post',
|
|
29
|
+
url: AUTH_URLS.REFRESH_TOKEN
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { queryOptions, useMutation, useQuery } from '@tanstack/react-query';
|
|
2
|
+
|
|
3
|
+
import { fetchGetUserInfo, fetchLogin } from './api';
|
|
4
|
+
import { AUTH_MUTATION_KEYS, AUTH_QUERY_KEYS } from './keys';
|
|
5
|
+
|
|
6
|
+
export function queryUserInfoOptions() {
|
|
7
|
+
return queryOptions({
|
|
8
|
+
gcTime: Infinity,
|
|
9
|
+
queryFn: fetchGetUserInfo,
|
|
10
|
+
queryKey: AUTH_QUERY_KEYS.USER_INFO,
|
|
11
|
+
retry: false,
|
|
12
|
+
staleTime: Infinity
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function useLoginMutation() {
|
|
17
|
+
return useMutation({
|
|
18
|
+
mutationFn: (params: Api.Auth.LoginParams) => fetchLogin(params),
|
|
19
|
+
mutationKey: AUTH_MUTATION_KEYS.LOGIN,
|
|
20
|
+
retry: false
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function useUserInfoQuery() {
|
|
25
|
+
const query = queryUserInfoOptions();
|
|
26
|
+
|
|
27
|
+
return useQuery(query);
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { queryOptions } from '@tanstack/react-query';
|
|
2
|
+
|
|
3
|
+
import { queryClient } from '@/service/queryClient';
|
|
4
|
+
|
|
5
|
+
import { AUTH_QUERY_KEYS } from '../auth/keys';
|
|
6
|
+
|
|
7
|
+
import { fetchGetBackendRoutes } from './api';
|
|
8
|
+
import { ROUTE_QUERY_KEYS } from './keys';
|
|
9
|
+
|
|
10
|
+
export function queryMenusOptions() {
|
|
11
|
+
const enabled = Boolean(queryClient.getQueryData<Api.Auth.UserInfo>(AUTH_QUERY_KEYS.USER_INFO));
|
|
12
|
+
const isDev = import.meta.env.DEV;
|
|
13
|
+
|
|
14
|
+
return queryOptions({
|
|
15
|
+
enabled,
|
|
16
|
+
gcTime: isDev ? 1000 * 60 * 5 : Infinity,
|
|
17
|
+
queryFn: fetchGetBackendRoutes,
|
|
18
|
+
queryKey: ROUTE_QUERY_KEYS.USER_ROUTES,
|
|
19
|
+
staleTime: isDev ? 1000 * 10 : Infinity
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createQueryClient } from '@skyroc/service/query';
|
|
2
|
+
|
|
3
|
+
function handleError(error: unknown) {
|
|
4
|
+
if (import.meta.env.DEV) {
|
|
5
|
+
// oxlint-disable-next-line no-console
|
|
6
|
+
console.error('Query/Mutation error:', error);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const queryClient = createQueryClient({
|
|
11
|
+
mutationCache: { onError: handleError },
|
|
12
|
+
queryCache: { onError: handleError }
|
|
13
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { AxiosResponse } from 'axios';
|
|
2
|
+
import { BACKEND_ERROR_CODE, createFlatRequest } from '@skyroc/axios';
|
|
3
|
+
import { createAppRequest } from '@skyroc/service';
|
|
4
|
+
|
|
5
|
+
import { getServiceBaseURL } from '@/utils/service';
|
|
6
|
+
import { localStg } from '@/utils/storage';
|
|
7
|
+
|
|
8
|
+
import { antdAdapter } from '../adapter';
|
|
9
|
+
|
|
10
|
+
const isHttpProxy = import.meta.env.DEV && import.meta.env.VITE_HTTP_PROXY === 'Y';
|
|
11
|
+
const { baseURL, otherBaseURL } = getServiceBaseURL(import.meta.env, isHttpProxy);
|
|
12
|
+
|
|
13
|
+
export const request = createAppRequest({
|
|
14
|
+
adapter: antdAdapter,
|
|
15
|
+
axiosConfig: {
|
|
16
|
+
baseURL,
|
|
17
|
+
headers: {
|
|
18
|
+
apifoxToken: 'XL299LiMEDZ0H5h3A29PxwQXdMJqWyY2'
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
codes: {
|
|
22
|
+
expiredToken: import.meta.env.VITE_SERVICE_EXPIRED_TOKEN_CODES?.split(',') || [],
|
|
23
|
+
logout: import.meta.env.VITE_SERVICE_LOGOUT_CODES?.split(',') || [],
|
|
24
|
+
modalLogout: import.meta.env.VITE_SERVICE_MODAL_LOGOUT_CODES?.split(',') || [],
|
|
25
|
+
success: import.meta.env.VITE_SERVICE_SUCCESS_CODE
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const demoRequest = createFlatRequest(
|
|
30
|
+
{
|
|
31
|
+
baseURL: otherBaseURL.demo
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
transform(response: AxiosResponse<Api.Service.DemoResponse>) {
|
|
35
|
+
return response.data.result;
|
|
36
|
+
},
|
|
37
|
+
isBackendSuccess(response) {
|
|
38
|
+
return response.data.status === '200';
|
|
39
|
+
},
|
|
40
|
+
async onBackendFail(_response) {
|
|
41
|
+
// when the backend response code is not "200", it means the request is fail
|
|
42
|
+
},
|
|
43
|
+
onError(error) {
|
|
44
|
+
let message = error.message;
|
|
45
|
+
|
|
46
|
+
if (error.code === BACKEND_ERROR_CODE) {
|
|
47
|
+
message = error.response?.data?.message || message;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
showErrorMessage(message);
|
|
51
|
+
},
|
|
52
|
+
async onRequest(config) {
|
|
53
|
+
const { headers } = config;
|
|
54
|
+
|
|
55
|
+
const token = localStg.get('token');
|
|
56
|
+
const Authorization = token ? `Bearer ${token}` : null;
|
|
57
|
+
Object.assign(headers, { Authorization });
|
|
58
|
+
|
|
59
|
+
return config;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@forward 'scrollbar';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@mixin scrollbar($size: 7px, $color: rgba(0, 0, 0, 0.5), $dark-color: rgba(255, 255, 255, 0.5)) {
|
|
2
|
+
scrollbar-width: thin;
|
|
3
|
+
scrollbar-color: $color transparent;
|
|
4
|
+
|
|
5
|
+
// Dark theme override
|
|
6
|
+
.dark & {
|
|
7
|
+
// guide safari use light color scrollbar
|
|
8
|
+
color-scheme: dark;
|
|
9
|
+
scrollbar-color: $dark-color transparent;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&::-webkit-scrollbar-thumb {
|
|
13
|
+
background-color: $color;
|
|
14
|
+
border-radius: $size;
|
|
15
|
+
}
|
|
16
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
17
|
+
background-color: $color;
|
|
18
|
+
border-radius: $size;
|
|
19
|
+
}
|
|
20
|
+
&::-webkit-scrollbar {
|
|
21
|
+
width: $size;
|
|
22
|
+
height: $size;
|
|
23
|
+
}
|
|
24
|
+
&::-webkit-scrollbar-track-piece {
|
|
25
|
+
background-color: rgba(0, 0, 0, 0);
|
|
26
|
+
border-radius: 0;
|
|
27
|
+
}
|
|
28
|
+
}
|