@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.
Files changed (363) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/configs/_common/.github/workflows/general-check.yml +1 -1
  3. package/dist/configs/_common/.github/workflows/release.yml +2 -2
  4. package/dist/configs/_common/.gitignore.template +6 -0
  5. package/dist/configs/_common/.prettierignore +17 -5
  6. package/dist/configs/_common/.vscode/settings.json +6 -1
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.js +1 -1
  9. package/dist/templates/next-app/.env.template +1 -1
  10. package/dist/templates/next-app/README.en.md +0 -1
  11. package/dist/templates/next-app/README.md +0 -1
  12. package/dist/templates/next-app/config/Identifier/api.ts +5 -5
  13. package/dist/templates/next-app/config/Identifier/common/admint.table.ts +69 -0
  14. package/dist/templates/next-app/config/Identifier/common/common.ts +76 -0
  15. package/dist/templates/next-app/config/Identifier/common/index.ts +3 -0
  16. package/dist/templates/next-app/config/Identifier/{validator.ts → common/validators.ts} +5 -5
  17. package/dist/templates/next-app/config/Identifier/index.ts +2 -12
  18. package/dist/templates/next-app/config/Identifier/pages/index.ts +6 -0
  19. package/dist/templates/next-app/config/Identifier/pages/page.admin.home.ts +27 -0
  20. package/dist/templates/next-app/config/Identifier/pages/page.admin.locales.ts +266 -0
  21. package/dist/templates/next-app/config/Identifier/pages/page.admin.user.ts +293 -0
  22. package/dist/templates/{react-app/config/Identifier → next-app/config/Identifier/pages}/page.home.ts +15 -22
  23. package/dist/templates/next-app/config/Identifier/{page.login.ts → pages/page.login.ts} +28 -34
  24. package/dist/templates/next-app/config/Identifier/{page.register.ts → pages/page.register.ts} +30 -29
  25. package/dist/templates/next-app/config/adminNavs.ts +19 -0
  26. package/dist/templates/next-app/config/common.ts +22 -13
  27. package/dist/templates/next-app/config/i18n/HomeI18n.ts +5 -5
  28. package/dist/templates/next-app/config/i18n/admin18n.ts +61 -19
  29. package/dist/templates/next-app/config/i18n/i18nConfig.ts +2 -0
  30. package/dist/templates/next-app/config/i18n/i18nKeyScheam.ts +36 -0
  31. package/dist/templates/next-app/config/i18n/loginI18n.ts +22 -22
  32. package/dist/templates/next-app/config/i18n/register18n.ts +23 -24
  33. package/dist/templates/next-app/docs/en/index.md +0 -1
  34. package/dist/templates/next-app/docs/en/project-structure.md +0 -1
  35. package/dist/templates/next-app/docs/zh/index.md +0 -1
  36. package/dist/templates/next-app/docs/zh/project-structure.md +0 -1
  37. package/dist/templates/next-app/make/generateLocales.ts +19 -12
  38. package/dist/templates/next-app/migrations/schema/LocalesSchema.ts +15 -0
  39. package/dist/templates/next-app/migrations/sql/1694244000000.sql +11 -0
  40. package/dist/templates/next-app/package.json +7 -3
  41. package/dist/templates/next-app/public/locales/en.json +172 -207
  42. package/dist/templates/next-app/public/locales/zh.json +172 -207
  43. package/dist/templates/next-app/src/app/[locale]/admin/locales/page.tsx +153 -0
  44. package/dist/templates/next-app/src/app/[locale]/admin/users/page.tsx +48 -50
  45. package/dist/templates/next-app/src/app/[locale]/login/LoginForm.tsx +2 -2
  46. package/dist/templates/next-app/src/app/api/admin/locales/create/route.ts +34 -0
  47. package/dist/templates/next-app/src/app/api/admin/locales/import/route.ts +40 -0
  48. package/dist/templates/next-app/src/app/api/admin/locales/route.ts +42 -0
  49. package/dist/templates/next-app/src/app/api/admin/locales/update/route.ts +32 -0
  50. package/dist/templates/next-app/src/app/api/locales/json/route.ts +44 -0
  51. package/dist/templates/next-app/src/base/cases/AdminPageManager.ts +1 -13
  52. package/dist/templates/next-app/src/base/cases/Datetime.ts +18 -0
  53. package/dist/templates/next-app/src/base/cases/DialogErrorPlugin.ts +12 -6
  54. package/dist/templates/next-app/src/base/cases/ResourceState.ts +17 -0
  55. package/dist/templates/next-app/src/base/cases/TranslateI18nInterface.ts +25 -0
  56. package/dist/templates/next-app/src/base/cases/ZodColumnBuilder.ts +200 -0
  57. package/dist/templates/next-app/src/base/port/ZodBuilderInterface.ts +8 -0
  58. package/dist/templates/next-app/src/base/services/AdminLocalesService.ts +20 -0
  59. package/dist/templates/next-app/src/base/services/AdminPageEvent.ts +26 -0
  60. package/dist/templates/next-app/src/base/services/AdminPageScheduler.ts +42 -0
  61. package/dist/templates/next-app/src/base/services/ResourceService.ts +122 -0
  62. package/dist/templates/next-app/src/base/services/adminApi/AdminLocalesApi.ts +104 -0
  63. package/dist/templates/next-app/src/base/services/adminApi/AdminUserApi.ts +38 -5
  64. package/dist/templates/next-app/src/base/services/appApi/AppApiPlugin.ts +1 -1
  65. package/dist/templates/next-app/src/i18n/request.ts +30 -1
  66. package/dist/templates/next-app/src/server/PageParams.ts +2 -10
  67. package/dist/templates/next-app/src/server/port/DBBridgeInterface.ts +5 -0
  68. package/dist/templates/next-app/src/server/port/DBTableInterface.ts +2 -0
  69. package/dist/templates/next-app/src/server/port/LocalesRepositoryInterface.ts +43 -0
  70. package/dist/templates/next-app/src/server/repositorys/LocalesRepository.ts +197 -0
  71. package/dist/templates/next-app/src/server/services/ApiLocaleService.ts +122 -0
  72. package/dist/templates/next-app/src/server/sqlBridges/SupabaseBridge.ts +60 -11
  73. package/dist/templates/next-app/src/server/validators/ExtendedExecutorError.ts +6 -0
  74. package/dist/templates/next-app/src/server/validators/LocalesValidator.ts +131 -0
  75. package/dist/templates/next-app/src/server/validators/LoginValidator.ts +2 -5
  76. package/dist/templates/next-app/src/server/validators/PaginationValidator.ts +32 -16
  77. package/dist/templates/next-app/src/styles/css/antd-themes/pagination/_default.css +2 -1
  78. package/dist/templates/next-app/src/styles/css/antd-themes/pagination/dark.css +28 -29
  79. package/dist/templates/next-app/src/styles/css/antd-themes/pagination/pink.css +2 -1
  80. package/dist/templates/next-app/src/uikit/components/AdminLayout.tsx +17 -3
  81. package/dist/templates/next-app/src/uikit/components/BaseHeader.tsx +5 -4
  82. package/dist/templates/next-app/src/uikit/components/BaseLayout.tsx +5 -4
  83. package/dist/templates/next-app/src/uikit/components/BootstrapsProvider.tsx +3 -2
  84. package/dist/templates/next-app/src/uikit/components/ComboProvider.tsx +1 -1
  85. package/dist/templates/next-app/src/uikit/components/EditableCell.tsx +118 -0
  86. package/dist/templates/next-app/src/uikit/components/LogoutButton.tsx +5 -6
  87. package/dist/templates/next-app/src/uikit/components/ThemeSwitcher.tsx +1 -1
  88. package/dist/templates/next-app/src/uikit/components/With.tsx +2 -2
  89. package/dist/templates/next-app/src/uikit/components/localesImportButton/LocalesImportButton.tsx +62 -0
  90. package/dist/templates/next-app/src/uikit/components/localesImportButton/LocalesImportEvent.ts +28 -0
  91. package/dist/templates/next-app/src/uikit/components/localesImportButton/import.module.css +6 -0
  92. package/dist/templates/next-app/src/uikit/hook/useI18nInterface.ts +8 -14
  93. package/dist/templates/next-app/src/uikit/hook/useWarnTranslations.ts +25 -0
  94. package/dist/templates/react-app/.prettierignore +17 -0
  95. package/dist/templates/react-app/README.en.md +71 -54
  96. package/dist/templates/react-app/README.md +35 -18
  97. package/dist/templates/react-app/__tests__/__mocks__/BootstrapTest.ts +14 -0
  98. package/dist/templates/react-app/__tests__/__mocks__/MockAppConfit.ts +1 -1
  99. package/dist/templates/react-app/__tests__/__mocks__/MockDialogHandler.ts +2 -2
  100. package/dist/templates/react-app/__tests__/__mocks__/MockLogger.ts +1 -1
  101. package/dist/templates/react-app/__tests__/__mocks__/components/TestApp.tsx +45 -0
  102. package/dist/templates/react-app/__tests__/__mocks__/components/TestBootstrapsProvider.tsx +34 -0
  103. package/dist/templates/react-app/__tests__/__mocks__/components/TestRouter.tsx +46 -0
  104. package/dist/templates/react-app/__tests__/__mocks__/components/index.ts +12 -0
  105. package/dist/templates/react-app/__tests__/__mocks__/createMockGlobals.ts +1 -2
  106. package/dist/templates/react-app/__tests__/__mocks__/testIOC/TestIOC.ts +51 -0
  107. package/dist/templates/react-app/__tests__/__mocks__/testIOC/TestIOCRegister.ts +69 -0
  108. package/dist/templates/react-app/__tests__/setup/index.ts +1 -51
  109. package/dist/templates/react-app/__tests__/setup/setupGlobal.ts +51 -0
  110. package/dist/templates/react-app/__tests__/src/App.structure.test.tsx +115 -0
  111. package/dist/templates/react-app/__tests__/src/base/cases/AppConfig.test.ts +2 -2
  112. package/dist/templates/react-app/__tests__/src/base/cases/AppError.test.ts +1 -1
  113. package/dist/templates/react-app/__tests__/src/base/cases/DialogHandler.test.ts +3 -5
  114. package/dist/templates/react-app/__tests__/src/base/cases/I18nKeyErrorPlugin.test.ts +13 -2
  115. package/dist/templates/react-app/__tests__/src/base/cases/InversifyContainer.test.ts +1 -1
  116. package/dist/templates/react-app/__tests__/src/base/cases/PublicAssetsPath.test.ts +1 -1
  117. package/dist/templates/react-app/__tests__/src/base/cases/RequestLogger.test.ts +5 -5
  118. package/dist/templates/react-app/__tests__/src/base/cases/RequestStatusCatcher.test.ts +1 -2
  119. package/dist/templates/react-app/__tests__/src/base/cases/RouterLoader.test.ts +25 -15
  120. package/dist/templates/react-app/__tests__/src/base/services/I18nService.test.ts +29 -15
  121. package/dist/templates/react-app/__tests__/src/core/IOC.test.ts +19 -9
  122. package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapClient.test.ts +153 -0
  123. package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapsApp.test.ts +9 -7
  124. package/dist/templates/react-app/__tests__/src/main.integration.test.tsx +4 -5
  125. package/dist/templates/react-app/__tests__/src/main.test.tsx +4 -4
  126. package/dist/templates/react-app/__tests__/src/uikit/components/BaseHeader.test.tsx +68 -59
  127. package/dist/templates/react-app/__tests__/src/uikit/components/chatMessage/ChatRoot.test.tsx +274 -0
  128. package/dist/templates/react-app/config/IOCIdentifier.ts +11 -8
  129. package/dist/templates/react-app/config/Identifier/{common.error.ts → common/common.error.ts} +5 -5
  130. package/dist/templates/react-app/config/Identifier/{common.ts → common/common.ts} +9 -9
  131. package/dist/templates/react-app/config/Identifier/common/index.ts +2 -0
  132. package/dist/templates/react-app/config/Identifier/components/component.chatMessage.ts +56 -0
  133. package/dist/templates/react-app/config/Identifier/components/component.messageBaseList.ts +103 -0
  134. package/dist/templates/react-app/config/Identifier/index.ts +1 -9
  135. package/dist/templates/react-app/config/Identifier/pages/index.ts +9 -0
  136. package/dist/templates/react-app/config/Identifier/{page.about.ts → pages/page.about.ts} +34 -26
  137. package/dist/templates/react-app/config/Identifier/{page.executor.ts → pages/page.executor.ts} +47 -39
  138. package/dist/templates/{next-app/config/Identifier → react-app/config/Identifier/pages}/page.home.ts +24 -23
  139. package/dist/templates/react-app/config/Identifier/pages/page.identifiter.ts +102 -0
  140. package/dist/templates/react-app/config/Identifier/{page.jsonStorage.ts → pages/page.jsonStorage.ts} +18 -11
  141. package/dist/templates/react-app/config/Identifier/{page.login.ts → pages/page.login.ts} +37 -27
  142. package/dist/templates/react-app/config/Identifier/pages/page.message.ts +20 -0
  143. package/dist/templates/react-app/config/Identifier/{page.register.ts → pages/page.register.ts} +37 -25
  144. package/dist/templates/react-app/config/Identifier/{page.request.ts → pages/page.request.ts} +34 -44
  145. package/dist/templates/react-app/config/app.router.ts +81 -61
  146. package/dist/templates/react-app/config/i18n/PageI18nInterface.ts +51 -0
  147. package/dist/templates/react-app/config/i18n/aboutI18n.ts +42 -0
  148. package/dist/templates/react-app/config/i18n/chatMessageI18n.ts +17 -0
  149. package/dist/templates/react-app/config/i18n/executorI18n.ts +51 -0
  150. package/dist/templates/react-app/config/i18n/homeI18n.ts +24 -0
  151. package/dist/templates/react-app/config/i18n/i18nConfig.ts +30 -0
  152. package/dist/templates/react-app/config/i18n/identifiter18n.ts +30 -0
  153. package/dist/templates/react-app/config/i18n/jsonStorage18n.ts +27 -0
  154. package/dist/templates/react-app/config/i18n/login18n.ts +42 -0
  155. package/dist/templates/react-app/config/i18n/messageBaseListI18n.ts +22 -0
  156. package/dist/templates/react-app/config/i18n/messageI18n.ts +14 -0
  157. package/dist/templates/react-app/config/i18n/notFoundI18n.ts +34 -0
  158. package/dist/templates/react-app/config/i18n/register18n.ts +40 -0
  159. package/dist/templates/react-app/config/i18n/request18n.ts +41 -0
  160. package/dist/templates/react-app/config/theme.ts +14 -4
  161. package/dist/templates/react-app/docs/en/bootstrap.md +1670 -341
  162. package/dist/templates/react-app/docs/en/components/chat-message-component.md +314 -0
  163. package/dist/templates/react-app/docs/en/components/chat-message-refactor.md +270 -0
  164. package/dist/templates/react-app/docs/en/components/message-base-list-component.md +172 -0
  165. package/dist/templates/react-app/docs/en/development-guide.md +1021 -345
  166. package/dist/templates/react-app/docs/en/env.md +1132 -278
  167. package/dist/templates/react-app/docs/en/i18n.md +858 -147
  168. package/dist/templates/react-app/docs/en/index.md +733 -104
  169. package/dist/templates/react-app/docs/en/ioc.md +1228 -287
  170. package/dist/templates/react-app/docs/en/playwright/e2e-tests.md +321 -0
  171. package/dist/templates/react-app/docs/en/playwright/index.md +19 -0
  172. package/dist/templates/react-app/docs/en/playwright/installation-summary.md +332 -0
  173. package/dist/templates/react-app/docs/en/playwright/overview.md +222 -0
  174. package/dist/templates/react-app/docs/en/playwright/quickstart.md +325 -0
  175. package/dist/templates/react-app/docs/en/playwright/reorganization-notes.md +340 -0
  176. package/dist/templates/react-app/docs/en/playwright/setup-complete.md +290 -0
  177. package/dist/templates/react-app/docs/en/playwright/testing-guide.md +565 -0
  178. package/dist/templates/react-app/docs/en/store.md +1194 -184
  179. package/dist/templates/react-app/docs/en/why-no-globals.md +797 -0
  180. package/dist/templates/react-app/docs/zh/bootstrap.md +1670 -341
  181. package/dist/templates/react-app/docs/zh/components/chat-message-component.md +314 -0
  182. package/dist/templates/react-app/docs/zh/components/chat-message-refactor.md +270 -0
  183. package/dist/templates/react-app/docs/zh/components/message-base-list-component.md +172 -0
  184. package/dist/templates/react-app/docs/zh/development-guide.md +1021 -345
  185. package/dist/templates/react-app/docs/zh/env.md +1132 -275
  186. package/dist/templates/react-app/docs/zh/i18n.md +858 -147
  187. package/dist/templates/react-app/docs/zh/index.md +717 -104
  188. package/dist/templates/react-app/docs/zh/ioc.md +1229 -287
  189. package/dist/templates/react-app/docs/zh/playwright/e2e-tests.md +321 -0
  190. package/dist/templates/react-app/docs/zh/playwright/index.md +19 -0
  191. package/dist/templates/react-app/docs/zh/playwright/installation-summary.md +332 -0
  192. package/dist/templates/react-app/docs/zh/playwright/overview.md +222 -0
  193. package/dist/templates/react-app/docs/zh/playwright/quickstart.md +325 -0
  194. package/dist/templates/react-app/docs/zh/playwright/reorganization-notes.md +340 -0
  195. package/dist/templates/react-app/docs/zh/playwright/setup-complete.md +290 -0
  196. package/dist/templates/react-app/docs/zh/playwright/testing-guide.md +565 -0
  197. package/dist/templates/react-app/docs/zh/store.md +1192 -184
  198. package/dist/templates/react-app/docs/zh/why-no-globals.md +797 -0
  199. package/dist/templates/react-app/e2e/App.spec.ts +319 -0
  200. package/dist/templates/react-app/e2e/fixtures/base.fixture.ts +40 -0
  201. package/dist/templates/react-app/e2e/main.spec.ts +20 -0
  202. package/dist/templates/react-app/e2e/utils/test-helpers.ts +19 -0
  203. package/dist/templates/react-app/eslint.config.mjs +247 -0
  204. package/dist/templates/react-app/makes/eslint-utils.mjs +195 -0
  205. package/dist/templates/react-app/makes/generateTs2LocalesOptions.ts +26 -0
  206. package/dist/templates/react-app/package.json +31 -3
  207. package/dist/templates/react-app/playwright.config.ts +79 -0
  208. package/dist/templates/react-app/public/locales/en/common.json +233 -179
  209. package/dist/templates/react-app/public/locales/zh/common.json +233 -179
  210. package/dist/templates/react-app/src/App.tsx +15 -42
  211. package/dist/templates/react-app/src/base/apis/AiApi.ts +5 -5
  212. package/dist/templates/react-app/src/base/apis/feApi/FeApi.ts +1 -1
  213. package/dist/templates/react-app/src/base/apis/feApi/FeApiAdapter.ts +1 -1
  214. package/dist/templates/react-app/src/base/apis/feApi/FeApiBootstarp.ts +8 -8
  215. package/dist/templates/react-app/src/base/apis/feApi/FeApiType.ts +1 -1
  216. package/dist/templates/react-app/src/base/apis/userApi/UserApi.ts +6 -6
  217. package/dist/templates/react-app/src/base/apis/userApi/UserApiAdapter.ts +1 -1
  218. package/dist/templates/react-app/src/base/apis/userApi/UserApiBootstarp.ts +12 -14
  219. package/dist/templates/react-app/src/base/apis/userApi/UserApiType.ts +1 -1
  220. package/dist/templates/react-app/src/base/cases/DialogHandler.ts +5 -2
  221. package/dist/templates/react-app/src/base/cases/I18nKeyErrorPlugin.ts +3 -3
  222. package/dist/templates/react-app/src/base/cases/InversifyContainer.ts +3 -3
  223. package/dist/templates/react-app/src/base/cases/RequestLanguages.ts +2 -2
  224. package/dist/templates/react-app/src/base/cases/RequestLogger.ts +4 -4
  225. package/dist/templates/react-app/src/base/cases/RequestStatusCatcher.ts +1 -1
  226. package/dist/templates/react-app/src/base/cases/ResourceState.ts +23 -0
  227. package/dist/templates/react-app/src/base/cases/RouterLoader.ts +4 -4
  228. package/dist/templates/react-app/src/base/cases/TranslateI18nInterface.ts +26 -0
  229. package/dist/templates/react-app/src/base/port/ExecutorPageBridgeInterface.ts +2 -3
  230. package/dist/templates/react-app/src/base/port/I18nServiceInterface.ts +1 -1
  231. package/dist/templates/react-app/src/base/port/IOCInterface.ts +36 -0
  232. package/dist/templates/react-app/src/base/port/JSONStoragePageBridgeInterface.ts +2 -1
  233. package/dist/templates/react-app/src/base/port/ProcesserExecutorInterface.ts +1 -1
  234. package/dist/templates/react-app/src/base/port/RequestPageBridgeInterface.ts +2 -2
  235. package/dist/templates/react-app/src/base/port/RouteServiceInterface.ts +9 -5
  236. package/dist/templates/react-app/src/base/port/UserServiceInterface.ts +1 -1
  237. package/dist/templates/react-app/src/base/services/I18nService.ts +29 -29
  238. package/dist/templates/react-app/src/base/services/IdentifierService.ts +143 -0
  239. package/dist/templates/react-app/src/base/services/ProcesserExecutor.ts +3 -3
  240. package/dist/templates/react-app/src/base/services/RouteService.ts +27 -8
  241. package/dist/templates/react-app/src/base/services/UserService.ts +8 -8
  242. package/dist/templates/react-app/src/base/types/Page.ts +14 -2
  243. package/dist/templates/react-app/src/base/types/global.d.ts +1 -1
  244. package/dist/templates/react-app/src/core/IOC.ts +5 -46
  245. package/dist/templates/react-app/src/core/bootstraps/{BootstrapApp.ts → BootstrapClient.ts} +44 -17
  246. package/dist/templates/react-app/src/core/bootstraps/BootstrapsRegistry.ts +14 -7
  247. package/dist/templates/react-app/src/core/bootstraps/IocIdentifierTest.ts +1 -1
  248. package/dist/templates/react-app/src/core/bootstraps/PrintBootstrap.ts +1 -1
  249. package/dist/templates/react-app/src/core/clientIoc/ClientIOC.ts +40 -0
  250. package/dist/templates/react-app/src/core/{IocRegisterImpl.ts → clientIoc/ClientIOCRegister.ts} +35 -24
  251. package/dist/templates/react-app/src/core/globals.ts +9 -9
  252. package/dist/templates/react-app/src/main.tsx +4 -4
  253. package/dist/templates/react-app/src/pages/404.tsx +6 -3
  254. package/dist/templates/react-app/src/pages/500.tsx +5 -2
  255. package/dist/templates/react-app/src/pages/NoRouteFound.tsx +5 -0
  256. package/dist/templates/react-app/src/pages/auth/Layout.tsx +9 -6
  257. package/dist/templates/react-app/src/pages/auth/LoginPage.tsx +46 -56
  258. package/dist/templates/react-app/src/pages/auth/RegisterPage.tsx +46 -58
  259. package/dist/templates/react-app/src/pages/base/AboutPage.tsx +35 -40
  260. package/dist/templates/react-app/src/pages/base/ExecutorPage.tsx +51 -51
  261. package/dist/templates/react-app/src/pages/base/HomePage.tsx +14 -15
  262. package/dist/templates/react-app/src/pages/base/IdentifierPage.tsx +70 -11
  263. package/dist/templates/react-app/src/pages/base/JSONStoragePage.tsx +24 -25
  264. package/dist/templates/react-app/src/pages/base/Layout.tsx +2 -2
  265. package/dist/templates/react-app/src/pages/base/MessagePage.tsx +40 -0
  266. package/dist/templates/react-app/src/pages/base/RedirectPathname.tsx +3 -2
  267. package/dist/templates/react-app/src/pages/base/RequestPage.tsx +41 -59
  268. package/dist/templates/react-app/src/styles/css/antd-themes/{_default.css → _common/_default.css} +85 -0
  269. package/dist/templates/react-app/src/styles/css/antd-themes/{dark.css → _common/dark.css} +99 -0
  270. package/dist/templates/react-app/src/styles/css/antd-themes/_common/index.css +3 -0
  271. package/dist/templates/react-app/src/styles/css/antd-themes/{pink.css → _common/pink.css} +86 -0
  272. package/dist/templates/react-app/src/styles/css/antd-themes/index.css +4 -3
  273. package/dist/templates/react-app/src/styles/css/antd-themes/menu/_default.css +108 -0
  274. package/dist/templates/react-app/src/styles/css/antd-themes/menu/dark.css +67 -0
  275. package/dist/templates/react-app/src/styles/css/antd-themes/menu/index.css +3 -0
  276. package/dist/templates/react-app/src/styles/css/antd-themes/menu/pink.css +67 -0
  277. package/dist/templates/react-app/src/styles/css/antd-themes/pagination/_default.css +34 -0
  278. package/dist/templates/react-app/src/styles/css/antd-themes/pagination/dark.css +31 -0
  279. package/dist/templates/react-app/src/styles/css/antd-themes/pagination/index.css +3 -0
  280. package/dist/templates/react-app/src/styles/css/antd-themes/pagination/pink.css +36 -0
  281. package/dist/templates/react-app/src/styles/css/antd-themes/table/_default.css +44 -0
  282. package/dist/templates/react-app/src/styles/css/antd-themes/table/dark.css +43 -0
  283. package/dist/templates/react-app/src/styles/css/antd-themes/table/index.css +3 -0
  284. package/dist/templates/react-app/src/styles/css/antd-themes/table/pink.css +43 -0
  285. package/dist/templates/react-app/src/styles/css/page.css +4 -3
  286. package/dist/templates/react-app/src/styles/css/themes/_default.css +1 -0
  287. package/dist/templates/react-app/src/styles/css/themes/dark.css +1 -0
  288. package/dist/templates/react-app/src/styles/css/themes/pink.css +1 -0
  289. package/dist/templates/react-app/src/styles/css/zIndex.css +1 -1
  290. package/dist/templates/react-app/src/uikit/bridges/ExecutorPageBridge.ts +3 -3
  291. package/dist/templates/react-app/src/uikit/bridges/JSONStoragePageBridge.ts +2 -2
  292. package/dist/templates/react-app/src/uikit/bridges/NavigateBridge.ts +1 -1
  293. package/dist/templates/react-app/src/uikit/bridges/RequestPageBridge.ts +3 -3
  294. package/dist/templates/react-app/src/uikit/components/AppRouterProvider.tsx +35 -0
  295. package/dist/templates/react-app/src/uikit/components/BaseHeader.tsx +15 -11
  296. package/dist/templates/react-app/src/uikit/components/BaseRouteProvider.tsx +14 -11
  297. package/dist/templates/react-app/src/uikit/components/BaseRouteSeo.tsx +18 -0
  298. package/dist/templates/react-app/src/uikit/components/BootstrapsProvider.tsx +13 -0
  299. package/dist/templates/react-app/src/uikit/components/ClientSeo.tsx +62 -0
  300. package/dist/templates/react-app/src/uikit/components/ComboProvider.tsx +38 -0
  301. package/dist/templates/react-app/src/uikit/components/LanguageSwitcher.tsx +48 -27
  302. package/dist/templates/react-app/src/uikit/components/Loading.tsx +4 -2
  303. package/dist/templates/react-app/src/uikit/components/LocaleLink.tsx +4 -5
  304. package/dist/templates/react-app/src/uikit/components/LogoutButton.tsx +34 -11
  305. package/dist/templates/react-app/src/uikit/components/MessageBaseList.tsx +240 -0
  306. package/dist/templates/react-app/src/uikit/components/ProcessExecutorProvider.tsx +9 -5
  307. package/dist/templates/react-app/src/uikit/components/RouterRenderComponent.tsx +6 -3
  308. package/dist/templates/react-app/src/uikit/components/ThemeSwitcher.tsx +97 -40
  309. package/dist/templates/react-app/src/uikit/components/UserAuthProvider.tsx +5 -5
  310. package/dist/templates/react-app/src/uikit/components/With.tsx +17 -0
  311. package/dist/templates/react-app/src/uikit/components/chatMessage/ChatMessageBridge.ts +176 -0
  312. package/dist/templates/react-app/src/uikit/components/chatMessage/ChatRoot.tsx +21 -0
  313. package/dist/templates/react-app/src/uikit/components/chatMessage/FocusBar.tsx +106 -0
  314. package/dist/templates/react-app/src/uikit/components/chatMessage/MessageApi.ts +271 -0
  315. package/dist/templates/react-app/src/uikit/components/chatMessage/MessageItem.tsx +102 -0
  316. package/dist/templates/react-app/src/uikit/components/chatMessage/MessagesList.tsx +86 -0
  317. package/dist/templates/react-app/src/uikit/contexts/BaseRouteContext.ts +17 -11
  318. package/dist/templates/react-app/src/uikit/contexts/IOCContext.ts +13 -0
  319. package/dist/templates/react-app/src/uikit/hooks/useAppTranslation.ts +26 -0
  320. package/dist/templates/react-app/src/uikit/hooks/useI18nGuard.ts +8 -11
  321. package/dist/templates/react-app/src/uikit/hooks/useI18nInterface.ts +25 -0
  322. package/dist/templates/react-app/src/uikit/hooks/useIOC.ts +35 -0
  323. package/dist/templates/react-app/src/uikit/hooks/useNavigateBridge.ts +3 -3
  324. package/dist/templates/react-app/src/uikit/hooks/useStrictEffect.ts +0 -1
  325. package/dist/templates/react-app/tsconfig.e2e.json +21 -0
  326. package/dist/templates/react-app/tsconfig.json +8 -1
  327. package/dist/templates/react-app/tsconfig.node.json +1 -1
  328. package/dist/templates/react-app/tsconfig.test.json +3 -1
  329. package/dist/templates/react-app/vite.config.ts +50 -34
  330. package/package.json +2 -1
  331. package/dist/configs/react-app/eslint.config.js +0 -94
  332. package/dist/templates/next-app/config/Identifier/common.error.ts +0 -41
  333. package/dist/templates/next-app/config/Identifier/common.ts +0 -69
  334. package/dist/templates/next-app/config/Identifier/page.about.ts +0 -181
  335. package/dist/templates/next-app/config/Identifier/page.admin.ts +0 -48
  336. package/dist/templates/next-app/config/Identifier/page.executor.ts +0 -272
  337. package/dist/templates/next-app/config/Identifier/page.identifiter.ts +0 -39
  338. package/dist/templates/next-app/config/Identifier/page.jsonStorage.ts +0 -72
  339. package/dist/templates/next-app/config/Identifier/page.request.ts +0 -182
  340. package/dist/templates/next-app/src/base/cases/ChatAction.ts +0 -21
  341. package/dist/templates/next-app/src/base/cases/FocusBarAction.ts +0 -36
  342. package/dist/templates/next-app/src/base/cases/RequestState.ts +0 -20
  343. package/dist/templates/next-app/src/base/port/AdminPageInterface.ts +0 -85
  344. package/dist/templates/next-app/src/base/port/AsyncStateInterface.ts +0 -7
  345. package/dist/templates/next-app/src/base/services/AdminUserService.ts +0 -45
  346. package/dist/templates/next-app/src/uikit/components/ChatRoot.tsx +0 -17
  347. package/dist/templates/next-app/src/uikit/components/chat/ChatActionInterface.ts +0 -30
  348. package/dist/templates/next-app/src/uikit/components/chat/ChatFocusBar.tsx +0 -65
  349. package/dist/templates/next-app/src/uikit/components/chat/ChatMessages.tsx +0 -59
  350. package/dist/templates/next-app/src/uikit/components/chat/ChatWrap.tsx +0 -28
  351. package/dist/templates/next-app/src/uikit/components/chat/FocusBarActionInterface.ts +0 -19
  352. package/dist/templates/next-app/src/uikit/hook/useMountedClient.ts +0 -17
  353. package/dist/templates/next-app/src/uikit/hook/useStore.ts +0 -15
  354. package/dist/templates/react-app/__tests__/__mocks__/I18nService.ts +0 -13
  355. package/dist/templates/react-app/__tests__/src/App.test.tsx +0 -139
  356. package/dist/templates/react-app/config/Identifier/page.identifiter.ts +0 -39
  357. package/dist/templates/react-app/config/i18n.ts +0 -15
  358. package/dist/templates/react-app/docs/en/project-structure.md +0 -434
  359. package/dist/templates/react-app/docs/zh/project-structure.md +0 -434
  360. package/dist/templates/react-app/src/base/cases/RequestState.ts +0 -20
  361. package/dist/templates/react-app/src/base/port/AsyncStateInterface.ts +0 -7
  362. package/dist/templates/react-app/src/uikit/hooks/useDocumentTitle.ts +0 -15
  363. 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 { IOC } from '@/core/IOC';
5
- import { useStore } from '@/uikit/hooks/useStore';
6
- import * as i18nKeys from '@config/Identifier/page.executor';
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 { t } = useBaseRoutePage();
24
- const pageBridge = IOC(IOCIdentifier.ExecutorPageBridgeInterface);
25
- const jspBridge = IOC(IOCIdentifier.JSONStoragePageInterface);
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: t(i18nKeys.PAGE_EXECUTOR_TEST_PLUGIN_TITLE),
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: t(i18nKeys.PAGE_EXECUTOR_TASK_TYPE_DATA_SYNC),
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: t(i18nKeys.PAGE_EXECUTOR_TASK_TYPE_MAINTENANCE),
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: t(i18nKeys.PAGE_EXECUTOR_TASK_TYPE_BACKUP),
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
- IOC('DialogHandler').success(
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
- IOC('DialogHandler').error(t(i18nKeys.PAGE_EXECUTOR_PLUGIN_TEST_FAILURE));
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, t]);
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} ${t(i18nKeys.PAGE_EXECUTOR_TASK_DURATION_UNIT)}`;
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
- IOC('DialogHandler').success(
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
- IOC('DialogHandler').error(
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
- IOC('DialogHandler').error(
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 className="min-h-screen bg-primary py-8 px-4 sm:px-6 lg:px-8">
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
- {t(i18nKeys.PAGE_EXECUTOR_MAIN_TITLE)}
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
- {t(i18nKeys.PAGE_EXECUTOR_TEST_PLUGIN_TITLE)}
243
+ {tt.testPluginTitle}
242
244
  </h2>
243
245
  <div className="space-y-4">
244
246
  <div className="text-text-secondary">
245
- {t(i18nKeys.PAGE_EXECUTOR_REQUEST_TIMEOUT)}: {requestTimeout}
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
- {t(i18nKeys.PAGE_EXECUTOR_TEST_PLUGIN_TITLE)}
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
- {IOC('JSONSerializer').stringify(helloState.result?.data)}
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
- {t(i18nKeys.PAGE_EXECUTOR_CREATE_TASK_TITLE)}
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={t(i18nKeys.PAGE_EXECUTOR_ENTER_URL)}
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
- {t(i18nKeys.PAGE_EXECUTOR_CREATE_BUTTON)}
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
- {t(i18nKeys.PAGE_EXECUTOR_TASK_STATS_TOTAL)}
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
- {t(i18nKeys.PAGE_EXECUTOR_TASK_STATS_RUNNING)}
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
- {t(i18nKeys.PAGE_EXECUTOR_TASK_STATS_COMPLETED)}
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
- {t(i18nKeys.PAGE_EXECUTOR_TASK_STATS_FAILED)}
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
- {t(i18nKeys.PAGE_EXECUTOR_TASK_LIST_TITLE)}
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
- {t(i18nKeys.PAGE_EXECUTOR_TASK_START)}
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
- {t(i18nKeys.PAGE_EXECUTOR_TASK_STOP)}
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
- {t(i18nKeys.PAGE_EXECUTOR_TASK_HISTORY_TITLE)}
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
- {t(i18nKeys.PAGE_EXECUTOR_HELP_DESCRIPTION)}
453
+ {tt.helpDescription}
452
454
  </p>
453
455
  <Space>
454
456
  <Button type="primary" size="large">
455
- {t(i18nKeys.PAGE_EXECUTOR_VIEW_GUIDE)}
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 LocaleLink from '@/uikit/components/LocaleLink';
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
- {t(i18nKeys.HOME_WELCOME)}
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
- {t(i18nKeys.HOME_EXPLORE)}
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
- {t(i18nKeys.HOME_GET_STARTED_TITLE)}
69
+ {tt.getStartedTitle}
71
70
  </h2>
72
71
  <p className="text-lg text-text-secondary mb-8">
73
- {t(i18nKeys.HOME_GET_STARTED_DESCRIPTION)}
72
+ {tt.getStartedDescription}
74
73
  </p>
75
74
  <Button type="primary" size="large" className="px-8">
76
- {t(i18nKeys.HOME_GET_STARTED_BUTTON)}
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 * as ErrorIdentifierList from '@config/Identifier/common.error';
4
- import * as i18nKeys from '@config/Identifier/page.identifiter';
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 className="min-h-screen bg-primary py-8 px-4 sm:px-6 lg:px-8">
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
- {t(i18nKeys.PAGE_ERROR_IDENTIFIER_MAIN_TITLE)}
54
+ {tt.title}
17
55
  </h1>
18
56
  <p className="text-xl text-text-secondary mb-8">
19
- {t(i18nKeys.PAGE_ERROR_IDENTIFIER_SOURCE_DESCRIPTION)}
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
- {/* Call to Action Section */}
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
- {t(i18nKeys.PAGE_ERROR_IDENTIFIER_HELP_TITLE)}
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
- {t(i18nKeys.PAGE_ERROR_IDENTIFIER_HELP_DESCRIPTION)}
108
+ {tt.helpDescription}
50
109
  </p>
51
110
  <Button type="primary" size="large">
52
- {t(i18nKeys.PAGE_ERROR_IDENTIFIER_CONTACT_SUPPORT)}
111
+ {tt.contactSupport}
53
112
  </Button>
54
113
  </section>
55
114
  </div>
@@ -1,32 +1,35 @@
1
- import { IOC } from '@/core/IOC';
2
- import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
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 = IOC(IOCIdentifier.JSONStoragePageInterface);
10
+ const pageBridge = useIOC(IOCIdentifier.JSONStoragePageInterface);
11
11
  const pageState = useStore(pageBridge);
12
- const { t } = useBaseRoutePage();
12
+ const tt = useI18nInterface(jsonStorage18n);
13
13
 
14
14
  return (
15
- <div className="min-h-screen bg-primary py-6 flex flex-col justify-center sm:py-12">
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
- {t(i18nKeys.PAGE_JSONSTORAGE_MAIN_TITLE)}
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
- {t(i18nKeys.PAGE_JSONSTORAGE_PERMANENT_TITLE)}
29
+ {tt.permanentTitle}
27
30
  </h2>
28
31
  <div className="text-text-secondary mb-4">
29
- {template(t(i18nKeys.PAGE_JSONSTORAGE_FORMAT_TITLE))({
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
- {t(i18nKeys.PAGE_JSONSTORAGE_SET_RANDOM)}
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
- {t(i18nKeys.PAGE_JSONSTORAGE_CURRENT_VALUE)}:{' '}
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
- {t(i18nKeys.PAGE_JSONSTORAGE_EXPIRE_TITLE)}
61
+ {tt.expireTitle}
59
62
  </h2>
60
63
  <div className="text-text-secondary mb-4">
61
- {template(t(i18nKeys.PAGE_JSONSTORAGE_FORMAT_TITLE))({
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
- {t(i18nKeys.PAGE_JSONSTORAGE_SET_EXPIRE)}
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
- {t(i18nKeys.PAGE_JSONSTORAGE_CURRENT_VALUE)}:{' '}
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
- {t(i18nKeys.PAGE_JSONSTORAGE_TIMEOUT_TITLE)}
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"