@qlover/create-app 0.7.15 → 0.9.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/CHANGELOG.md +21 -0
- package/dist/configs/_common/.github/workflows/general-check.yml +1 -1
- package/dist/configs/_common/.github/workflows/release.yml +2 -2
- package/dist/configs/_common/.gitignore.template +6 -0
- package/dist/configs/_common/.prettierignore +17 -5
- package/dist/configs/_common/.vscode/settings.json +6 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/next-app/.env.template +1 -1
- package/dist/templates/next-app/README.en.md +0 -1
- package/dist/templates/next-app/README.md +0 -1
- package/dist/templates/next-app/config/Identifier/api.ts +5 -5
- package/dist/templates/next-app/config/Identifier/common/admint.table.ts +69 -0
- package/dist/templates/next-app/config/Identifier/common/common.ts +76 -0
- package/dist/templates/next-app/config/Identifier/common/index.ts +3 -0
- package/dist/templates/next-app/config/Identifier/{validator.ts → common/validators.ts} +5 -5
- package/dist/templates/next-app/config/Identifier/index.ts +2 -12
- package/dist/templates/next-app/config/Identifier/pages/index.ts +6 -0
- package/dist/templates/next-app/config/Identifier/pages/page.admin.home.ts +27 -0
- package/dist/templates/next-app/config/Identifier/pages/page.admin.locales.ts +266 -0
- package/dist/templates/next-app/config/Identifier/pages/page.admin.user.ts +293 -0
- package/dist/templates/{react-app/config/Identifier → next-app/config/Identifier/pages}/page.home.ts +15 -22
- package/dist/templates/next-app/config/Identifier/{page.login.ts → pages/page.login.ts} +28 -34
- package/dist/templates/next-app/config/Identifier/{page.register.ts → pages/page.register.ts} +30 -29
- package/dist/templates/next-app/config/adminNavs.ts +19 -0
- package/dist/templates/next-app/config/common.ts +22 -13
- package/dist/templates/next-app/config/i18n/HomeI18n.ts +5 -5
- package/dist/templates/next-app/config/i18n/admin18n.ts +61 -19
- package/dist/templates/next-app/config/i18n/i18nConfig.ts +2 -0
- package/dist/templates/next-app/config/i18n/i18nKeyScheam.ts +36 -0
- package/dist/templates/next-app/config/i18n/loginI18n.ts +22 -22
- package/dist/templates/next-app/config/i18n/register18n.ts +23 -24
- package/dist/templates/next-app/docs/en/index.md +0 -1
- package/dist/templates/next-app/docs/en/project-structure.md +0 -1
- package/dist/templates/next-app/docs/zh/index.md +0 -1
- package/dist/templates/next-app/docs/zh/project-structure.md +0 -1
- package/dist/templates/next-app/make/generateLocales.ts +19 -12
- package/dist/templates/next-app/migrations/schema/LocalesSchema.ts +15 -0
- package/dist/templates/next-app/migrations/sql/1694244000000.sql +11 -0
- package/dist/templates/next-app/package.json +7 -3
- package/dist/templates/next-app/public/locales/en.json +172 -207
- package/dist/templates/next-app/public/locales/zh.json +172 -207
- package/dist/templates/next-app/src/app/[locale]/admin/locales/page.tsx +153 -0
- package/dist/templates/next-app/src/app/[locale]/admin/users/page.tsx +48 -50
- package/dist/templates/next-app/src/app/[locale]/login/LoginForm.tsx +2 -2
- package/dist/templates/next-app/src/app/api/admin/locales/create/route.ts +34 -0
- package/dist/templates/next-app/src/app/api/admin/locales/import/route.ts +40 -0
- package/dist/templates/next-app/src/app/api/admin/locales/route.ts +42 -0
- package/dist/templates/next-app/src/app/api/admin/locales/update/route.ts +32 -0
- package/dist/templates/next-app/src/app/api/locales/json/route.ts +44 -0
- package/dist/templates/next-app/src/base/cases/AdminPageManager.ts +1 -13
- package/dist/templates/next-app/src/base/cases/Datetime.ts +18 -0
- package/dist/templates/next-app/src/base/cases/DialogErrorPlugin.ts +12 -6
- package/dist/templates/next-app/src/base/cases/ResourceState.ts +17 -0
- package/dist/templates/next-app/src/base/cases/TranslateI18nInterface.ts +25 -0
- package/dist/templates/next-app/src/base/cases/ZodColumnBuilder.ts +200 -0
- package/dist/templates/next-app/src/base/port/ZodBuilderInterface.ts +8 -0
- package/dist/templates/next-app/src/base/services/AdminLocalesService.ts +20 -0
- package/dist/templates/next-app/src/base/services/AdminPageEvent.ts +26 -0
- package/dist/templates/next-app/src/base/services/AdminPageScheduler.ts +42 -0
- package/dist/templates/next-app/src/base/services/ResourceService.ts +122 -0
- package/dist/templates/next-app/src/base/services/adminApi/AdminLocalesApi.ts +104 -0
- package/dist/templates/next-app/src/base/services/adminApi/AdminUserApi.ts +38 -5
- package/dist/templates/next-app/src/base/services/appApi/AppApiPlugin.ts +1 -1
- package/dist/templates/next-app/src/i18n/request.ts +30 -1
- package/dist/templates/next-app/src/server/PageParams.ts +2 -10
- package/dist/templates/next-app/src/server/port/DBBridgeInterface.ts +5 -0
- package/dist/templates/next-app/src/server/port/DBTableInterface.ts +2 -0
- package/dist/templates/next-app/src/server/port/LocalesRepositoryInterface.ts +43 -0
- package/dist/templates/next-app/src/server/repositorys/LocalesRepository.ts +197 -0
- package/dist/templates/next-app/src/server/services/ApiLocaleService.ts +122 -0
- package/dist/templates/next-app/src/server/sqlBridges/SupabaseBridge.ts +60 -11
- package/dist/templates/next-app/src/server/validators/ExtendedExecutorError.ts +6 -0
- package/dist/templates/next-app/src/server/validators/LocalesValidator.ts +131 -0
- package/dist/templates/next-app/src/server/validators/LoginValidator.ts +2 -5
- package/dist/templates/next-app/src/server/validators/PaginationValidator.ts +32 -16
- package/dist/templates/next-app/src/styles/css/antd-themes/pagination/_default.css +2 -1
- package/dist/templates/next-app/src/styles/css/antd-themes/pagination/dark.css +28 -29
- package/dist/templates/next-app/src/styles/css/antd-themes/pagination/pink.css +2 -1
- package/dist/templates/next-app/src/uikit/components/AdminLayout.tsx +17 -3
- package/dist/templates/next-app/src/uikit/components/BaseHeader.tsx +5 -4
- package/dist/templates/next-app/src/uikit/components/BaseLayout.tsx +5 -4
- package/dist/templates/next-app/src/uikit/components/BootstrapsProvider.tsx +3 -2
- package/dist/templates/next-app/src/uikit/components/ComboProvider.tsx +1 -1
- package/dist/templates/next-app/src/uikit/components/EditableCell.tsx +118 -0
- package/dist/templates/next-app/src/uikit/components/LogoutButton.tsx +5 -6
- package/dist/templates/next-app/src/uikit/components/ThemeSwitcher.tsx +1 -1
- package/dist/templates/next-app/src/uikit/components/With.tsx +2 -2
- package/dist/templates/next-app/src/uikit/components/localesImportButton/LocalesImportButton.tsx +62 -0
- package/dist/templates/next-app/src/uikit/components/localesImportButton/LocalesImportEvent.ts +28 -0
- package/dist/templates/next-app/src/uikit/components/localesImportButton/import.module.css +6 -0
- package/dist/templates/next-app/src/uikit/hook/useI18nInterface.ts +8 -14
- package/dist/templates/next-app/src/uikit/hook/useWarnTranslations.ts +25 -0
- package/dist/templates/react-app/.prettierignore +17 -0
- package/dist/templates/react-app/README.en.md +71 -54
- package/dist/templates/react-app/README.md +35 -18
- package/dist/templates/react-app/__tests__/__mocks__/BootstrapTest.ts +14 -0
- package/dist/templates/react-app/__tests__/__mocks__/MockAppConfit.ts +1 -1
- package/dist/templates/react-app/__tests__/__mocks__/MockDialogHandler.ts +2 -2
- package/dist/templates/react-app/__tests__/__mocks__/MockLogger.ts +1 -1
- package/dist/templates/react-app/__tests__/__mocks__/components/TestApp.tsx +45 -0
- package/dist/templates/react-app/__tests__/__mocks__/components/TestBootstrapsProvider.tsx +34 -0
- package/dist/templates/react-app/__tests__/__mocks__/components/TestRouter.tsx +46 -0
- package/dist/templates/react-app/__tests__/__mocks__/components/index.ts +12 -0
- package/dist/templates/react-app/__tests__/__mocks__/createMockGlobals.ts +1 -2
- package/dist/templates/react-app/__tests__/__mocks__/testIOC/TestIOC.ts +51 -0
- package/dist/templates/react-app/__tests__/__mocks__/testIOC/TestIOCRegister.ts +69 -0
- package/dist/templates/react-app/__tests__/setup/index.ts +1 -51
- package/dist/templates/react-app/__tests__/setup/setupGlobal.ts +51 -0
- package/dist/templates/react-app/__tests__/src/App.structure.test.tsx +115 -0
- package/dist/templates/react-app/__tests__/src/base/cases/AppConfig.test.ts +2 -2
- package/dist/templates/react-app/__tests__/src/base/cases/AppError.test.ts +1 -1
- package/dist/templates/react-app/__tests__/src/base/cases/DialogHandler.test.ts +3 -5
- package/dist/templates/react-app/__tests__/src/base/cases/I18nKeyErrorPlugin.test.ts +13 -2
- package/dist/templates/react-app/__tests__/src/base/cases/InversifyContainer.test.ts +1 -1
- package/dist/templates/react-app/__tests__/src/base/cases/PublicAssetsPath.test.ts +1 -1
- package/dist/templates/react-app/__tests__/src/base/cases/RequestLogger.test.ts +5 -5
- package/dist/templates/react-app/__tests__/src/base/cases/RequestStatusCatcher.test.ts +1 -2
- package/dist/templates/react-app/__tests__/src/base/cases/RouterLoader.test.ts +25 -15
- package/dist/templates/react-app/__tests__/src/base/services/I18nService.test.ts +29 -15
- package/dist/templates/react-app/__tests__/src/core/IOC.test.ts +19 -9
- package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapClient.test.ts +153 -0
- package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapsApp.test.ts +9 -7
- package/dist/templates/react-app/__tests__/src/main.integration.test.tsx +4 -5
- package/dist/templates/react-app/__tests__/src/main.test.tsx +4 -4
- package/dist/templates/react-app/__tests__/src/uikit/components/BaseHeader.test.tsx +68 -59
- package/dist/templates/react-app/__tests__/src/uikit/components/chatMessage/ChatRoot.test.tsx +274 -0
- package/dist/templates/react-app/config/IOCIdentifier.ts +11 -8
- package/dist/templates/react-app/config/Identifier/{common.error.ts → common/common.error.ts} +5 -5
- package/dist/templates/react-app/config/Identifier/{common.ts → common/common.ts} +9 -9
- package/dist/templates/react-app/config/Identifier/common/index.ts +2 -0
- package/dist/templates/react-app/config/Identifier/components/component.chatMessage.ts +56 -0
- package/dist/templates/react-app/config/Identifier/components/component.messageBaseList.ts +103 -0
- package/dist/templates/react-app/config/Identifier/index.ts +1 -9
- package/dist/templates/react-app/config/Identifier/pages/index.ts +9 -0
- package/dist/templates/react-app/config/Identifier/{page.about.ts → pages/page.about.ts} +34 -26
- package/dist/templates/react-app/config/Identifier/{page.executor.ts → pages/page.executor.ts} +47 -39
- package/dist/templates/{next-app/config/Identifier → react-app/config/Identifier/pages}/page.home.ts +24 -23
- package/dist/templates/react-app/config/Identifier/pages/page.identifiter.ts +102 -0
- package/dist/templates/react-app/config/Identifier/{page.jsonStorage.ts → pages/page.jsonStorage.ts} +18 -11
- package/dist/templates/react-app/config/Identifier/{page.login.ts → pages/page.login.ts} +37 -27
- package/dist/templates/react-app/config/Identifier/pages/page.message.ts +20 -0
- package/dist/templates/react-app/config/Identifier/{page.register.ts → pages/page.register.ts} +37 -25
- package/dist/templates/react-app/config/Identifier/{page.request.ts → pages/page.request.ts} +34 -44
- package/dist/templates/react-app/config/app.router.ts +81 -61
- package/dist/templates/react-app/config/i18n/PageI18nInterface.ts +51 -0
- package/dist/templates/react-app/config/i18n/aboutI18n.ts +42 -0
- package/dist/templates/react-app/config/i18n/chatMessageI18n.ts +17 -0
- package/dist/templates/react-app/config/i18n/executorI18n.ts +51 -0
- package/dist/templates/react-app/config/i18n/homeI18n.ts +24 -0
- package/dist/templates/react-app/config/i18n/i18nConfig.ts +30 -0
- package/dist/templates/react-app/config/i18n/identifiter18n.ts +30 -0
- package/dist/templates/react-app/config/i18n/jsonStorage18n.ts +27 -0
- package/dist/templates/react-app/config/i18n/login18n.ts +42 -0
- package/dist/templates/react-app/config/i18n/messageBaseListI18n.ts +22 -0
- package/dist/templates/react-app/config/i18n/messageI18n.ts +14 -0
- package/dist/templates/react-app/config/i18n/notFoundI18n.ts +34 -0
- package/dist/templates/react-app/config/i18n/register18n.ts +40 -0
- package/dist/templates/react-app/config/i18n/request18n.ts +41 -0
- package/dist/templates/react-app/config/theme.ts +14 -4
- package/dist/templates/react-app/docs/en/bootstrap.md +1670 -341
- package/dist/templates/react-app/docs/en/components/chat-message-component.md +314 -0
- package/dist/templates/react-app/docs/en/components/chat-message-refactor.md +270 -0
- package/dist/templates/react-app/docs/en/components/message-base-list-component.md +172 -0
- package/dist/templates/react-app/docs/en/development-guide.md +1021 -345
- package/dist/templates/react-app/docs/en/env.md +1132 -278
- package/dist/templates/react-app/docs/en/i18n.md +858 -147
- package/dist/templates/react-app/docs/en/index.md +733 -104
- package/dist/templates/react-app/docs/en/ioc.md +1228 -287
- package/dist/templates/react-app/docs/en/playwright/e2e-tests.md +321 -0
- package/dist/templates/react-app/docs/en/playwright/index.md +19 -0
- package/dist/templates/react-app/docs/en/playwright/installation-summary.md +332 -0
- package/dist/templates/react-app/docs/en/playwright/overview.md +222 -0
- package/dist/templates/react-app/docs/en/playwright/quickstart.md +325 -0
- package/dist/templates/react-app/docs/en/playwright/reorganization-notes.md +340 -0
- package/dist/templates/react-app/docs/en/playwright/setup-complete.md +290 -0
- package/dist/templates/react-app/docs/en/playwright/testing-guide.md +565 -0
- package/dist/templates/react-app/docs/en/store.md +1194 -184
- package/dist/templates/react-app/docs/en/why-no-globals.md +797 -0
- package/dist/templates/react-app/docs/zh/bootstrap.md +1670 -341
- package/dist/templates/react-app/docs/zh/components/chat-message-component.md +314 -0
- package/dist/templates/react-app/docs/zh/components/chat-message-refactor.md +270 -0
- package/dist/templates/react-app/docs/zh/components/message-base-list-component.md +172 -0
- package/dist/templates/react-app/docs/zh/development-guide.md +1021 -345
- package/dist/templates/react-app/docs/zh/env.md +1132 -275
- package/dist/templates/react-app/docs/zh/i18n.md +858 -147
- package/dist/templates/react-app/docs/zh/index.md +717 -104
- package/dist/templates/react-app/docs/zh/ioc.md +1229 -287
- package/dist/templates/react-app/docs/zh/playwright/e2e-tests.md +321 -0
- package/dist/templates/react-app/docs/zh/playwright/index.md +19 -0
- package/dist/templates/react-app/docs/zh/playwright/installation-summary.md +332 -0
- package/dist/templates/react-app/docs/zh/playwright/overview.md +222 -0
- package/dist/templates/react-app/docs/zh/playwright/quickstart.md +325 -0
- package/dist/templates/react-app/docs/zh/playwright/reorganization-notes.md +340 -0
- package/dist/templates/react-app/docs/zh/playwright/setup-complete.md +290 -0
- package/dist/templates/react-app/docs/zh/playwright/testing-guide.md +565 -0
- package/dist/templates/react-app/docs/zh/store.md +1192 -184
- package/dist/templates/react-app/docs/zh/why-no-globals.md +797 -0
- package/dist/templates/react-app/e2e/App.spec.ts +319 -0
- package/dist/templates/react-app/e2e/fixtures/base.fixture.ts +40 -0
- package/dist/templates/react-app/e2e/main.spec.ts +20 -0
- package/dist/templates/react-app/e2e/utils/test-helpers.ts +19 -0
- package/dist/templates/react-app/eslint.config.mjs +247 -0
- package/dist/templates/react-app/makes/eslint-utils.mjs +195 -0
- package/dist/templates/react-app/makes/generateTs2LocalesOptions.ts +26 -0
- package/dist/templates/react-app/package.json +31 -3
- package/dist/templates/react-app/playwright.config.ts +79 -0
- package/dist/templates/react-app/public/locales/en/common.json +233 -179
- package/dist/templates/react-app/public/locales/zh/common.json +233 -179
- package/dist/templates/react-app/src/App.tsx +15 -42
- package/dist/templates/react-app/src/base/apis/AiApi.ts +5 -5
- package/dist/templates/react-app/src/base/apis/feApi/FeApi.ts +1 -1
- package/dist/templates/react-app/src/base/apis/feApi/FeApiAdapter.ts +1 -1
- package/dist/templates/react-app/src/base/apis/feApi/FeApiBootstarp.ts +8 -8
- package/dist/templates/react-app/src/base/apis/feApi/FeApiType.ts +1 -1
- package/dist/templates/react-app/src/base/apis/userApi/UserApi.ts +6 -6
- package/dist/templates/react-app/src/base/apis/userApi/UserApiAdapter.ts +1 -1
- package/dist/templates/react-app/src/base/apis/userApi/UserApiBootstarp.ts +12 -14
- package/dist/templates/react-app/src/base/apis/userApi/UserApiType.ts +1 -1
- package/dist/templates/react-app/src/base/cases/DialogHandler.ts +5 -2
- package/dist/templates/react-app/src/base/cases/I18nKeyErrorPlugin.ts +3 -3
- package/dist/templates/react-app/src/base/cases/InversifyContainer.ts +3 -3
- package/dist/templates/react-app/src/base/cases/RequestLanguages.ts +2 -2
- package/dist/templates/react-app/src/base/cases/RequestLogger.ts +4 -4
- package/dist/templates/react-app/src/base/cases/RequestStatusCatcher.ts +1 -1
- package/dist/templates/react-app/src/base/cases/ResourceState.ts +23 -0
- package/dist/templates/react-app/src/base/cases/RouterLoader.ts +4 -4
- package/dist/templates/react-app/src/base/cases/TranslateI18nInterface.ts +26 -0
- package/dist/templates/react-app/src/base/port/ExecutorPageBridgeInterface.ts +2 -3
- package/dist/templates/react-app/src/base/port/I18nServiceInterface.ts +1 -1
- package/dist/templates/react-app/src/base/port/IOCInterface.ts +36 -0
- package/dist/templates/react-app/src/base/port/JSONStoragePageBridgeInterface.ts +2 -1
- package/dist/templates/react-app/src/base/port/ProcesserExecutorInterface.ts +1 -1
- package/dist/templates/react-app/src/base/port/RequestPageBridgeInterface.ts +2 -2
- package/dist/templates/react-app/src/base/port/RouteServiceInterface.ts +9 -5
- package/dist/templates/react-app/src/base/port/UserServiceInterface.ts +1 -1
- package/dist/templates/react-app/src/base/services/I18nService.ts +29 -29
- package/dist/templates/react-app/src/base/services/IdentifierService.ts +143 -0
- package/dist/templates/react-app/src/base/services/ProcesserExecutor.ts +3 -3
- package/dist/templates/react-app/src/base/services/RouteService.ts +27 -8
- package/dist/templates/react-app/src/base/services/UserService.ts +8 -8
- package/dist/templates/react-app/src/base/types/Page.ts +14 -2
- package/dist/templates/react-app/src/base/types/global.d.ts +1 -1
- package/dist/templates/react-app/src/core/IOC.ts +5 -46
- package/dist/templates/react-app/src/core/bootstraps/{BootstrapApp.ts → BootstrapClient.ts} +44 -17
- package/dist/templates/react-app/src/core/bootstraps/BootstrapsRegistry.ts +14 -7
- package/dist/templates/react-app/src/core/bootstraps/IocIdentifierTest.ts +1 -1
- package/dist/templates/react-app/src/core/bootstraps/PrintBootstrap.ts +1 -1
- package/dist/templates/react-app/src/core/clientIoc/ClientIOC.ts +40 -0
- package/dist/templates/react-app/src/core/{IocRegisterImpl.ts → clientIoc/ClientIOCRegister.ts} +35 -24
- package/dist/templates/react-app/src/core/globals.ts +9 -9
- package/dist/templates/react-app/src/main.tsx +4 -4
- package/dist/templates/react-app/src/pages/404.tsx +6 -3
- package/dist/templates/react-app/src/pages/500.tsx +5 -2
- package/dist/templates/react-app/src/pages/NoRouteFound.tsx +5 -0
- package/dist/templates/react-app/src/pages/auth/Layout.tsx +9 -6
- package/dist/templates/react-app/src/pages/auth/LoginPage.tsx +46 -56
- package/dist/templates/react-app/src/pages/auth/RegisterPage.tsx +46 -58
- package/dist/templates/react-app/src/pages/base/AboutPage.tsx +35 -40
- package/dist/templates/react-app/src/pages/base/ExecutorPage.tsx +51 -51
- package/dist/templates/react-app/src/pages/base/HomePage.tsx +14 -15
- package/dist/templates/react-app/src/pages/base/IdentifierPage.tsx +70 -11
- package/dist/templates/react-app/src/pages/base/JSONStoragePage.tsx +24 -25
- package/dist/templates/react-app/src/pages/base/Layout.tsx +2 -2
- package/dist/templates/react-app/src/pages/base/MessagePage.tsx +40 -0
- package/dist/templates/react-app/src/pages/base/RedirectPathname.tsx +3 -2
- package/dist/templates/react-app/src/pages/base/RequestPage.tsx +41 -59
- package/dist/templates/react-app/src/styles/css/antd-themes/{_default.css → _common/_default.css} +85 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/{dark.css → _common/dark.css} +99 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/_common/index.css +3 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/{pink.css → _common/pink.css} +86 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/index.css +4 -3
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/_default.css +108 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/dark.css +67 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/index.css +3 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/menu/pink.css +67 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/_default.css +34 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/dark.css +31 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/index.css +3 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/pagination/pink.css +36 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/table/_default.css +44 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/table/dark.css +43 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/table/index.css +3 -0
- package/dist/templates/react-app/src/styles/css/antd-themes/table/pink.css +43 -0
- package/dist/templates/react-app/src/styles/css/page.css +4 -3
- package/dist/templates/react-app/src/styles/css/themes/_default.css +1 -0
- package/dist/templates/react-app/src/styles/css/themes/dark.css +1 -0
- package/dist/templates/react-app/src/styles/css/themes/pink.css +1 -0
- package/dist/templates/react-app/src/styles/css/zIndex.css +1 -1
- package/dist/templates/react-app/src/uikit/bridges/ExecutorPageBridge.ts +3 -3
- package/dist/templates/react-app/src/uikit/bridges/JSONStoragePageBridge.ts +2 -2
- package/dist/templates/react-app/src/uikit/bridges/NavigateBridge.ts +1 -1
- package/dist/templates/react-app/src/uikit/bridges/RequestPageBridge.ts +3 -3
- package/dist/templates/react-app/src/uikit/components/AppRouterProvider.tsx +35 -0
- package/dist/templates/react-app/src/uikit/components/BaseHeader.tsx +15 -11
- package/dist/templates/react-app/src/uikit/components/BaseRouteProvider.tsx +14 -11
- package/dist/templates/react-app/src/uikit/components/BaseRouteSeo.tsx +18 -0
- package/dist/templates/react-app/src/uikit/components/BootstrapsProvider.tsx +13 -0
- package/dist/templates/react-app/src/uikit/components/ClientSeo.tsx +62 -0
- package/dist/templates/react-app/src/uikit/components/ComboProvider.tsx +38 -0
- package/dist/templates/react-app/src/uikit/components/LanguageSwitcher.tsx +48 -27
- package/dist/templates/react-app/src/uikit/components/Loading.tsx +4 -2
- package/dist/templates/react-app/src/uikit/components/LocaleLink.tsx +4 -5
- package/dist/templates/react-app/src/uikit/components/LogoutButton.tsx +34 -11
- package/dist/templates/react-app/src/uikit/components/MessageBaseList.tsx +240 -0
- package/dist/templates/react-app/src/uikit/components/ProcessExecutorProvider.tsx +9 -5
- package/dist/templates/react-app/src/uikit/components/RouterRenderComponent.tsx +6 -3
- package/dist/templates/react-app/src/uikit/components/ThemeSwitcher.tsx +97 -40
- package/dist/templates/react-app/src/uikit/components/UserAuthProvider.tsx +5 -5
- package/dist/templates/react-app/src/uikit/components/With.tsx +17 -0
- package/dist/templates/react-app/src/uikit/components/chatMessage/ChatMessageBridge.ts +176 -0
- package/dist/templates/react-app/src/uikit/components/chatMessage/ChatRoot.tsx +21 -0
- package/dist/templates/react-app/src/uikit/components/chatMessage/FocusBar.tsx +106 -0
- package/dist/templates/react-app/src/uikit/components/chatMessage/MessageApi.ts +271 -0
- package/dist/templates/react-app/src/uikit/components/chatMessage/MessageItem.tsx +102 -0
- package/dist/templates/react-app/src/uikit/components/chatMessage/MessagesList.tsx +86 -0
- package/dist/templates/react-app/src/uikit/contexts/BaseRouteContext.ts +17 -11
- package/dist/templates/react-app/src/uikit/contexts/IOCContext.ts +13 -0
- package/dist/templates/react-app/src/uikit/hooks/useAppTranslation.ts +26 -0
- package/dist/templates/react-app/src/uikit/hooks/useI18nGuard.ts +8 -11
- package/dist/templates/react-app/src/uikit/hooks/useI18nInterface.ts +25 -0
- package/dist/templates/react-app/src/uikit/hooks/useIOC.ts +35 -0
- package/dist/templates/react-app/src/uikit/hooks/useNavigateBridge.ts +3 -3
- package/dist/templates/react-app/src/uikit/hooks/useStrictEffect.ts +0 -1
- package/dist/templates/react-app/tsconfig.e2e.json +21 -0
- package/dist/templates/react-app/tsconfig.json +8 -1
- package/dist/templates/react-app/tsconfig.node.json +1 -1
- package/dist/templates/react-app/tsconfig.test.json +3 -1
- package/dist/templates/react-app/vite.config.ts +50 -34
- package/package.json +2 -1
- package/dist/configs/react-app/eslint.config.js +0 -94
- package/dist/templates/next-app/config/Identifier/common.error.ts +0 -41
- package/dist/templates/next-app/config/Identifier/common.ts +0 -69
- package/dist/templates/next-app/config/Identifier/page.about.ts +0 -181
- package/dist/templates/next-app/config/Identifier/page.admin.ts +0 -48
- package/dist/templates/next-app/config/Identifier/page.executor.ts +0 -272
- package/dist/templates/next-app/config/Identifier/page.identifiter.ts +0 -39
- package/dist/templates/next-app/config/Identifier/page.jsonStorage.ts +0 -72
- package/dist/templates/next-app/config/Identifier/page.request.ts +0 -182
- package/dist/templates/next-app/src/base/cases/ChatAction.ts +0 -21
- package/dist/templates/next-app/src/base/cases/FocusBarAction.ts +0 -36
- package/dist/templates/next-app/src/base/cases/RequestState.ts +0 -20
- package/dist/templates/next-app/src/base/port/AdminPageInterface.ts +0 -85
- package/dist/templates/next-app/src/base/port/AsyncStateInterface.ts +0 -7
- package/dist/templates/next-app/src/base/services/AdminUserService.ts +0 -45
- package/dist/templates/next-app/src/uikit/components/ChatRoot.tsx +0 -17
- package/dist/templates/next-app/src/uikit/components/chat/ChatActionInterface.ts +0 -30
- package/dist/templates/next-app/src/uikit/components/chat/ChatFocusBar.tsx +0 -65
- package/dist/templates/next-app/src/uikit/components/chat/ChatMessages.tsx +0 -59
- package/dist/templates/next-app/src/uikit/components/chat/ChatWrap.tsx +0 -28
- package/dist/templates/next-app/src/uikit/components/chat/FocusBarActionInterface.ts +0 -19
- package/dist/templates/next-app/src/uikit/hook/useMountedClient.ts +0 -17
- package/dist/templates/next-app/src/uikit/hook/useStore.ts +0 -15
- package/dist/templates/react-app/__tests__/__mocks__/I18nService.ts +0 -13
- package/dist/templates/react-app/__tests__/src/App.test.tsx +0 -139
- package/dist/templates/react-app/config/Identifier/page.identifiter.ts +0 -39
- package/dist/templates/react-app/config/i18n.ts +0 -15
- package/dist/templates/react-app/docs/en/project-structure.md +0 -434
- package/dist/templates/react-app/docs/zh/project-structure.md +0 -434
- package/dist/templates/react-app/src/base/cases/RequestState.ts +0 -20
- package/dist/templates/react-app/src/base/port/AsyncStateInterface.ts +0 -7
- package/dist/templates/react-app/src/uikit/hooks/useDocumentTitle.ts +0 -15
- package/dist/templates/react-app/src/uikit/hooks/useStore.ts +0 -15
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { useStore } from '@brain-toolkit/react-kit/hooks/useStore';
|
|
2
|
+
import { executorI18n } from '@config/i18n/executorI18n';
|
|
3
|
+
import * as i18nKeys from '@config/Identifier/pages/page.executor';
|
|
4
|
+
import { IOCIdentifier } from '@config/IOCIdentifier';
|
|
1
5
|
import { Button, Progress, Tag, Space, Card, Input, Select } from 'antd';
|
|
2
|
-
import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
|
|
3
6
|
import { useState, useEffect } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import { IOCIdentifier } from '@config/IOCIdentifier';
|
|
7
|
+
import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
|
|
8
|
+
import { useI18nInterface } from '@/uikit/hooks/useI18nInterface';
|
|
9
|
+
import { useIOC } from '@/uikit/hooks/useIOC';
|
|
8
10
|
|
|
9
11
|
interface Task {
|
|
10
12
|
id: string;
|
|
@@ -20,16 +22,19 @@ interface Task {
|
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export default function ExecutorPage() {
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
25
|
+
const pageBridge = useIOC(IOCIdentifier.ExecutorPageBridgeInterface);
|
|
26
|
+
const jspBridge = useIOC(IOCIdentifier.JSONStoragePageInterface);
|
|
27
|
+
const dialogHandler = useIOC(IOCIdentifier.DialogHandler);
|
|
28
|
+
const jsonSerializer = useIOC(IOCIdentifier.JSONSerializer);
|
|
26
29
|
const requestTimeout = useStore(jspBridge, jspBridge.selector.requestTimeout);
|
|
27
30
|
const helloState = useStore(pageBridge, pageBridge.selector.helloState);
|
|
31
|
+
const { t } = useBaseRoutePage();
|
|
32
|
+
const tt = useI18nInterface(executorI18n);
|
|
28
33
|
|
|
29
34
|
const [tasks, setTasks] = useState<Task[]>([
|
|
30
35
|
{
|
|
31
36
|
id: '1',
|
|
32
|
-
name:
|
|
37
|
+
name: tt.testPluginTitle,
|
|
33
38
|
status: 'pending',
|
|
34
39
|
progress: 0,
|
|
35
40
|
type: 'data-sync',
|
|
@@ -39,7 +44,7 @@ export default function ExecutorPage() {
|
|
|
39
44
|
},
|
|
40
45
|
{
|
|
41
46
|
id: '2',
|
|
42
|
-
name:
|
|
47
|
+
name: tt.taskTypeDataSync,
|
|
43
48
|
status: 'pending',
|
|
44
49
|
progress: 0,
|
|
45
50
|
type: 'data-sync',
|
|
@@ -49,7 +54,7 @@ export default function ExecutorPage() {
|
|
|
49
54
|
},
|
|
50
55
|
{
|
|
51
56
|
id: '3',
|
|
52
|
-
name:
|
|
57
|
+
name: tt.taskTypeMaintenance,
|
|
53
58
|
status: 'pending',
|
|
54
59
|
progress: 0,
|
|
55
60
|
type: 'system-maintenance',
|
|
@@ -59,7 +64,7 @@ export default function ExecutorPage() {
|
|
|
59
64
|
},
|
|
60
65
|
{
|
|
61
66
|
id: '4',
|
|
62
|
-
name:
|
|
67
|
+
name: tt.taskTypeBackup,
|
|
63
68
|
status: 'pending',
|
|
64
69
|
progress: 0,
|
|
65
70
|
type: 'backup',
|
|
@@ -80,9 +85,7 @@ export default function ExecutorPage() {
|
|
|
80
85
|
// 监听 helloState 变化,更新任务状态
|
|
81
86
|
useEffect(() => {
|
|
82
87
|
if (helloState.result) {
|
|
83
|
-
|
|
84
|
-
t(i18nKeys.PAGE_EXECUTOR_PLUGIN_TEST_SUCCESS)
|
|
85
|
-
);
|
|
88
|
+
dialogHandler.success(tt.pluginTestSuccess);
|
|
86
89
|
// 更新任务状态
|
|
87
90
|
setTasks((prevTasks) =>
|
|
88
91
|
prevTasks.map((task) =>
|
|
@@ -97,7 +100,7 @@ export default function ExecutorPage() {
|
|
|
97
100
|
)
|
|
98
101
|
);
|
|
99
102
|
} else if (helloState.error) {
|
|
100
|
-
|
|
103
|
+
dialogHandler.error(tt.pluginTestFailure);
|
|
101
104
|
// 更新任务状态
|
|
102
105
|
setTasks((prevTasks) =>
|
|
103
106
|
prevTasks.map((task) =>
|
|
@@ -107,7 +110,7 @@ export default function ExecutorPage() {
|
|
|
107
110
|
)
|
|
108
111
|
);
|
|
109
112
|
}
|
|
110
|
-
}, [helloState.result, helloState.error,
|
|
113
|
+
}, [helloState.result, helloState.error, tt]);
|
|
111
114
|
|
|
112
115
|
const getStatusColor = (status: Task['status']) => {
|
|
113
116
|
switch (status) {
|
|
@@ -142,7 +145,7 @@ export default function ExecutorPage() {
|
|
|
142
145
|
const end = endTime || new Date();
|
|
143
146
|
const duration = end.getTime() - startTime.getTime();
|
|
144
147
|
const minutes = Math.floor(duration / (1000 * 60));
|
|
145
|
-
return `${minutes} ${
|
|
148
|
+
return `${minutes} ${tt.taskDurationUnit}`;
|
|
146
149
|
};
|
|
147
150
|
|
|
148
151
|
const handleStartTask = async (taskId: string) => {
|
|
@@ -166,7 +169,7 @@ export default function ExecutorPage() {
|
|
|
166
169
|
)
|
|
167
170
|
);
|
|
168
171
|
|
|
169
|
-
|
|
172
|
+
dialogHandler.success(
|
|
170
173
|
t(i18nKeys.PAGE_EXECUTOR_TASK_SUCCESS, { name: task.name })
|
|
171
174
|
);
|
|
172
175
|
} catch {
|
|
@@ -176,7 +179,7 @@ export default function ExecutorPage() {
|
|
|
176
179
|
)
|
|
177
180
|
);
|
|
178
181
|
|
|
179
|
-
|
|
182
|
+
dialogHandler.error(
|
|
180
183
|
t(i18nKeys.PAGE_EXECUTOR_TASK_FAILURE, { name: task.name })
|
|
181
184
|
);
|
|
182
185
|
}
|
|
@@ -194,9 +197,7 @@ export default function ExecutorPage() {
|
|
|
194
197
|
|
|
195
198
|
const handleCreateTask = () => {
|
|
196
199
|
if (!customUrl) {
|
|
197
|
-
|
|
198
|
-
t(i18nKeys.PAGE_EXECUTOR_CUSTOM_TASK_URL_REQUIRED)
|
|
199
|
-
);
|
|
200
|
+
dialogHandler.error(tt.customTaskUrlRequired);
|
|
200
201
|
return;
|
|
201
202
|
}
|
|
202
203
|
|
|
@@ -221,35 +222,36 @@ export default function ExecutorPage() {
|
|
|
221
222
|
};
|
|
222
223
|
|
|
223
224
|
return (
|
|
224
|
-
<div
|
|
225
|
+
<div
|
|
226
|
+
data-testid="ExecutorPage"
|
|
227
|
+
className="min-h-screen bg-primary py-8 px-4 sm:px-6 lg:px-8"
|
|
228
|
+
>
|
|
225
229
|
<div className="max-w-6xl mx-auto space-y-6">
|
|
226
230
|
{/* Header Section */}
|
|
227
231
|
<section className="py-8">
|
|
228
232
|
<div className="text-center">
|
|
229
233
|
<h1 className="text-4xl md:text-5xl font-bold mb-6 text-text">
|
|
230
|
-
{
|
|
234
|
+
{tt.mainTitle}
|
|
231
235
|
</h1>
|
|
232
|
-
<p className="text-xl text-text-secondary mb-8">
|
|
233
|
-
{t(i18nKeys.PAGE_EXECUTOR_DESCRIPTION)}
|
|
234
|
-
</p>
|
|
236
|
+
<p className="text-xl text-text-secondary mb-8">{tt.description}</p>
|
|
235
237
|
</div>
|
|
236
238
|
</section>
|
|
237
239
|
|
|
238
240
|
{/* Test Plugin Section */}
|
|
239
241
|
<section className="bg-secondary shadow sm:rounded-lg p-6 border border-border">
|
|
240
242
|
<h2 className="text-xl font-medium text-text mb-4">
|
|
241
|
-
{
|
|
243
|
+
{tt.testPluginTitle}
|
|
242
244
|
</h2>
|
|
243
245
|
<div className="space-y-4">
|
|
244
246
|
<div className="text-text-secondary">
|
|
245
|
-
{
|
|
247
|
+
{tt.requestTimeout}: {requestTimeout}
|
|
246
248
|
</div>
|
|
247
249
|
<div>
|
|
248
250
|
{helloState.loading ? (
|
|
249
251
|
<div className="text-text-secondary">Loading...</div>
|
|
250
252
|
) : (
|
|
251
253
|
<Button type="primary" onClick={pageBridge.onTestPlugins}>
|
|
252
|
-
{
|
|
254
|
+
{tt.testPluginTitle}
|
|
253
255
|
</Button>
|
|
254
256
|
)}
|
|
255
257
|
</div>
|
|
@@ -258,7 +260,7 @@ export default function ExecutorPage() {
|
|
|
258
260
|
<div className="text-red-500">{helloState.error.message}</div>
|
|
259
261
|
) : (
|
|
260
262
|
<pre className="text-text-secondary">
|
|
261
|
-
{
|
|
263
|
+
{jsonSerializer.stringify(helloState.result?.data)}
|
|
262
264
|
</pre>
|
|
263
265
|
)}
|
|
264
266
|
</div>
|
|
@@ -268,12 +270,12 @@ export default function ExecutorPage() {
|
|
|
268
270
|
{/* Create Task Section */}
|
|
269
271
|
<section className="bg-secondary shadow sm:rounded-lg p-6 border border-border">
|
|
270
272
|
<h2 className="text-xl font-medium text-text mb-4">
|
|
271
|
-
{
|
|
273
|
+
{tt.createTaskTitle}
|
|
272
274
|
</h2>
|
|
273
275
|
<div className="space-y-4">
|
|
274
276
|
<div className="flex items-center space-x-4">
|
|
275
277
|
<Input
|
|
276
|
-
placeholder={
|
|
278
|
+
placeholder={tt.enterUrl}
|
|
277
279
|
value={customUrl}
|
|
278
280
|
onChange={(e) => setCustomUrl(e.target.value)}
|
|
279
281
|
className="flex-1"
|
|
@@ -298,7 +300,7 @@ export default function ExecutorPage() {
|
|
|
298
300
|
<Select.Option value="blob">Blob</Select.Option>
|
|
299
301
|
</Select>
|
|
300
302
|
<Button type="primary" onClick={handleCreateTask}>
|
|
301
|
-
{
|
|
303
|
+
{tt.createButton}
|
|
302
304
|
</Button>
|
|
303
305
|
</div>
|
|
304
306
|
</div>
|
|
@@ -310,7 +312,7 @@ export default function ExecutorPage() {
|
|
|
310
312
|
<div className="text-center">
|
|
311
313
|
<div className="text-2xl font-bold text-text">{tasks.length}</div>
|
|
312
314
|
<div className="text-sm text-text-secondary">
|
|
313
|
-
{
|
|
315
|
+
{tt.taskStatsTotal}
|
|
314
316
|
</div>
|
|
315
317
|
</div>
|
|
316
318
|
</Card>
|
|
@@ -320,7 +322,7 @@ export default function ExecutorPage() {
|
|
|
320
322
|
{tasks.filter((t) => t.status === 'running').length}
|
|
321
323
|
</div>
|
|
322
324
|
<div className="text-sm text-text-secondary">
|
|
323
|
-
{
|
|
325
|
+
{tt.taskStatsRunning}
|
|
324
326
|
</div>
|
|
325
327
|
</div>
|
|
326
328
|
</Card>
|
|
@@ -330,7 +332,7 @@ export default function ExecutorPage() {
|
|
|
330
332
|
{tasks.filter((t) => t.status === 'completed').length}
|
|
331
333
|
</div>
|
|
332
334
|
<div className="text-sm text-text-secondary">
|
|
333
|
-
{
|
|
335
|
+
{tt.taskStatsCompleted}
|
|
334
336
|
</div>
|
|
335
337
|
</div>
|
|
336
338
|
</Card>
|
|
@@ -340,7 +342,7 @@ export default function ExecutorPage() {
|
|
|
340
342
|
{tasks.filter((t) => t.status === 'failed').length}
|
|
341
343
|
</div>
|
|
342
344
|
<div className="text-sm text-text-secondary">
|
|
343
|
-
{
|
|
345
|
+
{tt.taskStatsFailed}
|
|
344
346
|
</div>
|
|
345
347
|
</div>
|
|
346
348
|
</Card>
|
|
@@ -349,11 +351,12 @@ export default function ExecutorPage() {
|
|
|
349
351
|
{/* Task List Section */}
|
|
350
352
|
<section className="bg-secondary shadow sm:rounded-lg p-6 border border-border">
|
|
351
353
|
<h2 className="text-xl font-medium text-text mb-4">
|
|
352
|
-
{
|
|
354
|
+
{tt.taskListTitle}
|
|
353
355
|
</h2>
|
|
354
356
|
<div className="space-y-4">
|
|
355
357
|
{tasks.map((task) => (
|
|
356
358
|
<Card
|
|
359
|
+
data-testid={`ExecutorPageCard-${task.id}`}
|
|
357
360
|
key={task.id}
|
|
358
361
|
className="bg-elevated border-border"
|
|
359
362
|
title={
|
|
@@ -395,7 +398,7 @@ export default function ExecutorPage() {
|
|
|
395
398
|
type="primary"
|
|
396
399
|
onClick={() => handleStartTask(task.id)}
|
|
397
400
|
>
|
|
398
|
-
{
|
|
401
|
+
{tt.taskStart}
|
|
399
402
|
</Button>
|
|
400
403
|
)}
|
|
401
404
|
{task.status === 'running' && (
|
|
@@ -404,7 +407,7 @@ export default function ExecutorPage() {
|
|
|
404
407
|
danger
|
|
405
408
|
onClick={() => handleStopTask(task.id)}
|
|
406
409
|
>
|
|
407
|
-
{
|
|
410
|
+
{tt.taskStop}
|
|
408
411
|
</Button>
|
|
409
412
|
)}
|
|
410
413
|
</div>
|
|
@@ -417,7 +420,7 @@ export default function ExecutorPage() {
|
|
|
417
420
|
{/* Task History */}
|
|
418
421
|
<section className="bg-secondary shadow sm:rounded-lg p-6 border border-border">
|
|
419
422
|
<h2 className="text-xl font-medium text-text mb-4">
|
|
420
|
-
{
|
|
423
|
+
{tt.taskHistoryTitle}
|
|
421
424
|
</h2>
|
|
422
425
|
<div className="space-y-2">
|
|
423
426
|
{tasks
|
|
@@ -427,6 +430,7 @@ export default function ExecutorPage() {
|
|
|
427
430
|
)
|
|
428
431
|
.map((task) => (
|
|
429
432
|
<div
|
|
433
|
+
data-testid={`ExecutorPageHistory-${task.id}`}
|
|
430
434
|
key={task.id}
|
|
431
435
|
className="flex items-center justify-between p-2 bg-elevated rounded"
|
|
432
436
|
>
|
|
@@ -444,19 +448,15 @@ export default function ExecutorPage() {
|
|
|
444
448
|
|
|
445
449
|
{/* Call to Action Section */}
|
|
446
450
|
<section className="py-8 text-center">
|
|
447
|
-
<h2 className="text-2xl font-bold mb-4 text-text">
|
|
448
|
-
{t(i18nKeys.PAGE_EXECUTOR_HELP_TITLE)}
|
|
449
|
-
</h2>
|
|
451
|
+
<h2 className="text-2xl font-bold mb-4 text-text">{tt.helpTitle}</h2>
|
|
450
452
|
<p className="text-lg text-text-secondary mb-6">
|
|
451
|
-
{
|
|
453
|
+
{tt.helpDescription}
|
|
452
454
|
</p>
|
|
453
455
|
<Space>
|
|
454
456
|
<Button type="primary" size="large">
|
|
455
|
-
{
|
|
456
|
-
</Button>
|
|
457
|
-
<Button size="large">
|
|
458
|
-
{t(i18nKeys.PAGE_EXECUTOR_CONTACT_SUPPORT)}
|
|
457
|
+
{tt.viewGuide}
|
|
459
458
|
</Button>
|
|
459
|
+
<Button size="large">{tt.contactSupport}</Button>
|
|
460
460
|
</Space>
|
|
461
461
|
</section>
|
|
462
462
|
</div>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import { baseRoutes } from '@config/app.router';
|
|
1
2
|
import { Button } from 'antd';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { LocaleLink } from '@/uikit/components/LocaleLink';
|
|
2
5
|
import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
|
|
3
|
-
import
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
import * as i18nKeys from '@config/Identifier';
|
|
6
|
-
import { baseRoutes } from '@config/app.router';
|
|
6
|
+
import type { HomeI18nInterface } from '@config/i18n/homeI18n';
|
|
7
7
|
|
|
8
8
|
const layoutRoutes = baseRoutes.filter(
|
|
9
9
|
(route) => route.element === 'base/Layout'
|
|
10
10
|
);
|
|
11
11
|
|
|
12
12
|
const navigationItems = layoutRoutes[0]!
|
|
13
|
-
.children!.filter((route) => !route.index)
|
|
13
|
+
.children!.filter((route) => route.path !== '*' && !route.index)
|
|
14
14
|
.map((route) => ({
|
|
15
15
|
href: `/${route.path}`,
|
|
16
16
|
titleKey: route.meta!.title!,
|
|
@@ -18,19 +18,17 @@ const navigationItems = layoutRoutes[0]!
|
|
|
18
18
|
}));
|
|
19
19
|
|
|
20
20
|
export default function HomePage() {
|
|
21
|
-
const { t } = useBaseRoutePage();
|
|
21
|
+
const { t, tt } = useBaseRoutePage<HomeI18nInterface>();
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
|
-
<div className="min-h-screen bg-primary">
|
|
24
|
+
<div data-testid="HomePage" className="min-h-screen bg-primary">
|
|
25
25
|
{/* Hero Section */}
|
|
26
26
|
<section className="py-16 px-4">
|
|
27
27
|
<div className="max-w-4xl mx-auto text-center">
|
|
28
28
|
<h1 className="text-4xl md:text-5xl font-bold mb-6 text-text">
|
|
29
|
-
{
|
|
29
|
+
{tt.welcome}
|
|
30
30
|
</h1>
|
|
31
|
-
<p className="text-xl text-text-secondary mb-8">
|
|
32
|
-
{t(i18nKeys.HOME_DESCRIPTION)}
|
|
33
|
-
</p>
|
|
31
|
+
<p className="text-xl text-text-secondary mb-8">{tt.description2}</p>
|
|
34
32
|
</div>
|
|
35
33
|
</section>
|
|
36
34
|
|
|
@@ -39,6 +37,7 @@ export default function HomePage() {
|
|
|
39
37
|
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-8">
|
|
40
38
|
{navigationItems.map((item) => (
|
|
41
39
|
<LocaleLink
|
|
40
|
+
data-testid={`HomePage-NavLink-${item.href.replace('/', '')}`}
|
|
42
41
|
key={item.href}
|
|
43
42
|
href={item.href}
|
|
44
43
|
className={clsx(
|
|
@@ -56,7 +55,7 @@ export default function HomePage() {
|
|
|
56
55
|
{t(item.descriptionKey)}
|
|
57
56
|
</p>
|
|
58
57
|
<Button type="primary" className="w-full">
|
|
59
|
-
{
|
|
58
|
+
{tt.explore}
|
|
60
59
|
</Button>
|
|
61
60
|
</LocaleLink>
|
|
62
61
|
))}
|
|
@@ -67,13 +66,13 @@ export default function HomePage() {
|
|
|
67
66
|
<section className="py-16 px-4 bg-elevated">
|
|
68
67
|
<div className="max-w-4xl mx-auto text-center">
|
|
69
68
|
<h2 className="text-3xl font-bold mb-4 text-text">
|
|
70
|
-
{
|
|
69
|
+
{tt.getStartedTitle}
|
|
71
70
|
</h2>
|
|
72
71
|
<p className="text-lg text-text-secondary mb-8">
|
|
73
|
-
{
|
|
72
|
+
{tt.getStartedDescription}
|
|
74
73
|
</p>
|
|
75
74
|
<Button type="primary" size="large" className="px-8">
|
|
76
|
-
{
|
|
75
|
+
{tt.getStartedButton}
|
|
77
76
|
</Button>
|
|
78
77
|
</div>
|
|
79
78
|
</section>
|
|
@@ -1,22 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ResourceEvent,
|
|
3
|
+
ResourceTable
|
|
4
|
+
} from '@brain-toolkit/antd-blocks/resourceTable';
|
|
5
|
+
import { useFactory, useLifecycle } from '@brain-toolkit/react-kit';
|
|
6
|
+
import * as ErrorIdentifierList from '@config/Identifier/common/common.error';
|
|
1
7
|
import { Button } from 'antd';
|
|
8
|
+
import { IdentifierService } from '@/base/services/IdentifierService';
|
|
2
9
|
import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
10
|
+
import { useIOC } from '@/uikit/hooks/useIOC';
|
|
11
|
+
import type { Identifiter18nInterface } from '@config/i18n/identifiter18n';
|
|
12
|
+
import type { ResourceTableOption } from '@brain-toolkit/antd-blocks/resourceTable';
|
|
5
13
|
|
|
6
14
|
export default function IdentifierPage() {
|
|
7
|
-
const { t } = useBaseRoutePage();
|
|
15
|
+
const { t, tt } = useBaseRoutePage<Identifiter18nInterface>();
|
|
16
|
+
const identifierService = useIOC(IdentifierService);
|
|
17
|
+
const tableEvent = useFactory(ResourceEvent, 'identifier', identifierService);
|
|
18
|
+
|
|
19
|
+
useLifecycle(tableEvent);
|
|
20
|
+
|
|
21
|
+
const columns: ResourceTableOption<any>[] = [
|
|
22
|
+
{
|
|
23
|
+
title: tt.iTableIndex,
|
|
24
|
+
dataIndex: 'index',
|
|
25
|
+
key: 'index'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
title: tt.iTableId,
|
|
29
|
+
dataIndex: 'id',
|
|
30
|
+
key: 'id'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
title: tt.iTableLabel,
|
|
34
|
+
dataIndex: 'locale',
|
|
35
|
+
key: 'locale'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
title: tt.iTableLocaleValue,
|
|
39
|
+
dataIndex: 'localeValue',
|
|
40
|
+
key: 'localeValue'
|
|
41
|
+
}
|
|
42
|
+
] as ResourceTableOption<any>[];
|
|
8
43
|
|
|
9
44
|
return (
|
|
10
|
-
<div
|
|
45
|
+
<div
|
|
46
|
+
data-testid="IdentifierPage"
|
|
47
|
+
className="min-h-screen bg-primary py-8 px-4 sm:px-6 lg:px-8"
|
|
48
|
+
>
|
|
11
49
|
<div className="max-w-4xl mx-auto space-y-6">
|
|
12
50
|
{/* Header Section */}
|
|
13
51
|
<section className="py-8">
|
|
14
52
|
<div className="text-center">
|
|
15
53
|
<h1 className="text-4xl md:text-5xl font-bold mb-6 text-text">
|
|
16
|
-
{
|
|
54
|
+
{tt.title}
|
|
17
55
|
</h1>
|
|
18
56
|
<p className="text-xl text-text-secondary mb-8">
|
|
19
|
-
{
|
|
57
|
+
{tt.sourceDescription}
|
|
20
58
|
</p>
|
|
21
59
|
</div>
|
|
22
60
|
</section>
|
|
@@ -25,6 +63,7 @@ export default function IdentifierPage() {
|
|
|
25
63
|
<div className="grid gap-4">
|
|
26
64
|
{Object.entries(ErrorIdentifierList).map(([key, value]) => (
|
|
27
65
|
<div
|
|
66
|
+
data-testid={`IdentifierPage-${key}`}
|
|
28
67
|
key={key}
|
|
29
68
|
className="bg-secondary shadow sm:rounded-lg p-6 border border-border hover:bg-elevated transition-colors duration-200"
|
|
30
69
|
>
|
|
@@ -40,16 +79,36 @@ export default function IdentifierPage() {
|
|
|
40
79
|
))}
|
|
41
80
|
</div>
|
|
42
81
|
|
|
43
|
-
|
|
44
|
-
<section className="py-8 text-center">
|
|
82
|
+
<div className="space-y-4">
|
|
45
83
|
<h2 className="text-2xl font-bold mb-4 text-text">
|
|
46
|
-
{
|
|
84
|
+
{tt.iTableTitle}
|
|
47
85
|
</h2>
|
|
86
|
+
<div className="text-lg text-text-secondary mb-6">
|
|
87
|
+
{tt.iTableDescription}
|
|
88
|
+
</div>
|
|
89
|
+
<ResourceTable
|
|
90
|
+
columns={columns}
|
|
91
|
+
tableEvent={tableEvent}
|
|
92
|
+
actionProps={false}
|
|
93
|
+
// use antd default pagination
|
|
94
|
+
pagination={{
|
|
95
|
+
pageSizeOptions: [20, 50, 100],
|
|
96
|
+
current: undefined,
|
|
97
|
+
pageSize: undefined,
|
|
98
|
+
total: undefined,
|
|
99
|
+
onChange: undefined
|
|
100
|
+
}}
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
{/* Call to Action Section */}
|
|
105
|
+
<section className="py-8 text-center">
|
|
106
|
+
<h2 className="text-2xl font-bold mb-4 text-text">{tt.helpTitle}</h2>
|
|
48
107
|
<p className="text-lg text-text-secondary mb-6">
|
|
49
|
-
{
|
|
108
|
+
{tt.helpDescription}
|
|
50
109
|
</p>
|
|
51
110
|
<Button type="primary" size="large">
|
|
52
|
-
{
|
|
111
|
+
{tt.contactSupport}
|
|
53
112
|
</Button>
|
|
54
113
|
</section>
|
|
55
114
|
</div>
|
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import template from 'lodash/template';
|
|
4
|
-
import { useStore } from '@/uikit/hooks/useStore';
|
|
5
|
-
import { Button, Input } from 'antd';
|
|
6
|
-
import * as i18nKeys from '@config/Identifier/page.jsonStorage';
|
|
1
|
+
import { useStore } from '@brain-toolkit/react-kit/hooks/useStore';
|
|
2
|
+
import { jsonStorage18n } from '@config/i18n/jsonStorage18n';
|
|
7
3
|
import { IOCIdentifier } from '@config/IOCIdentifier';
|
|
4
|
+
import { Button, Input } from 'antd';
|
|
5
|
+
import template from 'lodash/template';
|
|
6
|
+
import { useI18nInterface } from '@/uikit/hooks/useI18nInterface';
|
|
7
|
+
import { useIOC } from '@/uikit/hooks/useIOC';
|
|
8
8
|
|
|
9
9
|
export default function JSONStoragePage() {
|
|
10
|
-
const pageBridge =
|
|
10
|
+
const pageBridge = useIOC(IOCIdentifier.JSONStoragePageInterface);
|
|
11
11
|
const pageState = useStore(pageBridge);
|
|
12
|
-
const
|
|
12
|
+
const tt = useI18nInterface(jsonStorage18n);
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
|
-
<div
|
|
15
|
+
<div
|
|
16
|
+
data-testid="JSONStoragePage"
|
|
17
|
+
className="min-h-screen bg-primary py-6 flex flex-col justify-center sm:py-12"
|
|
18
|
+
>
|
|
16
19
|
<div className="relative py-3 sm:max-w-xl sm:mx-auto">
|
|
17
20
|
<div className="bg-secondary shadow-lg rounded-lg px-8 py-6">
|
|
18
21
|
<h1 className="text-3xl font-bold text-center text-text mb-8">
|
|
19
|
-
{
|
|
22
|
+
{tt.mainTitle}
|
|
20
23
|
</h1>
|
|
21
24
|
|
|
22
25
|
<div className="space-y-6">
|
|
23
26
|
{/* 无过期时间的测试 */}
|
|
24
27
|
<div className="p-6 bg-elevated rounded-lg">
|
|
25
28
|
<h2 className="text-xl font-semibold text-text mb-4">
|
|
26
|
-
{
|
|
29
|
+
{tt.permanentTitle}
|
|
27
30
|
</h2>
|
|
28
31
|
<div className="text-text-secondary mb-4">
|
|
29
|
-
{template(
|
|
32
|
+
{template(tt.formatTitle)({
|
|
30
33
|
key: 'testKey1',
|
|
31
34
|
min: 100,
|
|
32
35
|
max: 9000
|
|
@@ -38,12 +41,12 @@ export default function JSONStoragePage() {
|
|
|
38
41
|
type="primary"
|
|
39
42
|
onClick={pageBridge.changeRandomTestKey1}
|
|
40
43
|
>
|
|
41
|
-
{
|
|
44
|
+
{tt.setRandom}
|
|
42
45
|
</Button>
|
|
43
46
|
|
|
44
47
|
<div className="p-4 bg-secondary rounded-lg w-full text-center">
|
|
45
48
|
<span className="text-text-secondary">
|
|
46
|
-
{
|
|
49
|
+
{tt.currentValue}:{' '}
|
|
47
50
|
</span>
|
|
48
51
|
<span className="font-semibold text-text">
|
|
49
52
|
{JSON.stringify(pageState.testKey1)}
|
|
@@ -55,10 +58,10 @@ export default function JSONStoragePage() {
|
|
|
55
58
|
{/* 带过期时间的测试 */}
|
|
56
59
|
<div className="p-6 bg-elevated rounded-lg">
|
|
57
60
|
<h2 className="text-xl font-semibold text-text mb-4">
|
|
58
|
-
{
|
|
61
|
+
{tt.expireTitle}
|
|
59
62
|
</h2>
|
|
60
63
|
<div className="text-text-secondary mb-4">
|
|
61
|
-
{template(
|
|
64
|
+
{template(tt.formatTitle)({
|
|
62
65
|
key: 'testKey2',
|
|
63
66
|
min: 100,
|
|
64
67
|
max: 9000
|
|
@@ -77,21 +80,19 @@ export default function JSONStoragePage() {
|
|
|
77
80
|
min="1000"
|
|
78
81
|
step="1000"
|
|
79
82
|
/>
|
|
80
|
-
<span className="text-text-secondary">
|
|
81
|
-
{t(i18nKeys.PAGE_JSONSTORAGE_MS)}
|
|
82
|
-
</span>
|
|
83
|
+
<span className="text-text-secondary">{tt.ms}</span>
|
|
83
84
|
</div>
|
|
84
85
|
|
|
85
86
|
<Button
|
|
86
87
|
type="primary"
|
|
87
88
|
onClick={pageBridge.onChangeRandomTestKey2}
|
|
88
89
|
>
|
|
89
|
-
{
|
|
90
|
+
{tt.setExpire}
|
|
90
91
|
</Button>
|
|
91
92
|
|
|
92
93
|
<div className="p-4 bg-secondary rounded-lg w-full text-center">
|
|
93
94
|
<span className="text-text-secondary">
|
|
94
|
-
{
|
|
95
|
+
{tt.currentValue}:{' '}
|
|
95
96
|
</span>
|
|
96
97
|
<span className="font-semibold text-text">
|
|
97
98
|
{pageState.testKey2}
|
|
@@ -103,7 +104,7 @@ export default function JSONStoragePage() {
|
|
|
103
104
|
{/* 请求超时时间设置 */}
|
|
104
105
|
<div className="p-6 bg-elevated rounded-lg">
|
|
105
106
|
<h2 className="text-xl font-semibold text-text mb-4">
|
|
106
|
-
{
|
|
107
|
+
{tt.timeoutTitle}
|
|
107
108
|
</h2>
|
|
108
109
|
<div className="flex items-center space-x-4">
|
|
109
110
|
<Input
|
|
@@ -116,9 +117,7 @@ export default function JSONStoragePage() {
|
|
|
116
117
|
min="1000"
|
|
117
118
|
step="1000"
|
|
118
119
|
/>
|
|
119
|
-
<span className="text-text-secondary">
|
|
120
|
-
{t(i18nKeys.PAGE_JSONSTORAGE_MS)}
|
|
121
|
-
</span>
|
|
120
|
+
<span className="text-text-secondary">{tt.ms}</span>
|
|
122
121
|
</div>
|
|
123
122
|
</div>
|
|
124
123
|
</div>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import BaseHeader from '../../uikit/components/BaseHeader';
|
|
2
1
|
import { Outlet } from 'react-router-dom';
|
|
3
2
|
import { ProcessExecutorProvider } from '@/uikit/components/ProcessExecutorProvider';
|
|
3
|
+
import { BaseHeader } from '../../uikit/components/BaseHeader';
|
|
4
4
|
|
|
5
5
|
export default function Layout() {
|
|
6
6
|
return (
|
|
7
|
-
<ProcessExecutorProvider>
|
|
7
|
+
<ProcessExecutorProvider data-testid="Layout">
|
|
8
8
|
<div
|
|
9
9
|
data-testid="basic-layout"
|
|
10
10
|
className="text-base min-h-screen bg-primary"
|