mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5859] [MERGED] Frontend dev tooling (Husky, lint-staged, MSW, Storybook) + full React Hook Form migration #6010
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6010
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5859
Author: @MHSanaei
Created: 7/8/2026
Status: ✅ Merged
Merged: 7/8/2026
Merged by: @MHSanaei
Base:
main← Head:feat/rhf-migration-and-dev-tooling📝 Commits (10+)
1c9b751chore(frontend): add husky + lint-staged pre-commit gatebcb3742test(frontend): add MSW request mocking1a6efffchore(frontend): add Storybook + component storiesd8755d2feat(frontend): add React Hook Form primitives3b98f4crefactor(frontend): migrate Pattern-B leaf forms to React Hook Form807407frefactor(frontend): migrate LoginPage to React Hook Form42d1f57refactor(frontend): migrate ClientFormModal to React Hook Forme09bc7brefactor(frontend): migrate Node and DNS modals to React Hook Form15c5878refactor(frontend): migrate HostFormModal to React Hook Form904815arefactor(frontend): migrate OutboundFormModal + fragments to React Hook Form📊 Changes
98 files changed (+9824 additions, -5417 deletions)
View changed files
📝
.github/workflows/docs-ci.yml(+3 -0)📝
frontend/.gitignore(+1 -0)➕
frontend/.husky/pre-commit(+1 -0)➕
frontend/.storybook/main.ts(+25 -0)➕
frontend/.storybook/preview.tsx(+60 -0)📝
frontend/CLAUDE.md(+11 -4)📝
frontend/package-lock.json(+3803 -334)📝
frontend/package.json(+24 -2)➕
frontend/public/mockServiceWorker.js(+349 -0)➕
frontend/src/components/clients/ClientSpeedTag.stories.tsx(+21 -0)➕
frontend/src/components/clients/ConfigBlock.stories.tsx(+29 -0)➕
frontend/src/components/feedback/PromptModal.stories.tsx(+70 -0)➕
frontend/src/components/feedback/TextModal.stories.tsx(+51 -0)➕
frontend/src/components/form/rhf/FormField.tsx(+93 -0)➕
frontend/src/components/form/rhf/index.ts(+5 -0)➕
frontend/src/components/form/rhf/normalizeAntdOnChange.ts(+10 -0)➕
frontend/src/components/form/rhf/rhfZodValidate.ts(+9 -0)➕
frontend/src/components/form/rhf/toDotted.ts(+5 -0)➕
frontend/src/components/form/rhf/useZodForm.ts(+18 -0)➕
frontend/src/components/ui/InfinityIcon.stories.tsx(+27 -0)...and 78 more files
📄 Description
Summary
Adds four frontend developer-tooling additions and migrates all panel forms from Ant Design's
Formstore to React Hook Form (RHF). Ant Design components stay; only the form-state layer changes. 14 focused commits; every commit is green (typecheck, ESLint, 727 vitest tests, build).Dev tooling
eslint --fixon staged frontend TS/TSX. The hook installs from the repo root intofrontend/.husky(the onlypackage.jsonis infrontend/).setupServerexercises the realhttp-init.tspipeline (CSRF acquisition, 403 refetch-and-retry) alongside the existingHttpUtilspies, so the current tests are untouched. Browser worker generated for Storybook/dev.ConfigProvider+ light/dark toolbar + en-US i18next);main.tsneutralizes the app config's multi-entry input /renderBuiltUrl/ sharedoutDirsobuild-storybookcan never clobberinternal/web/dist. Seed stories across the presentational library.src/components/form/rhf/—FormField(aControllerwrapping an AntDForm.Itemshell),useZodForm(zodResolver, Zod 4),rhfZodValidate.React Hook Form migration
Every form moved to RHF while preserving exact submit behaviour (same
safeParse, same toast, same wire payload):LoginPage,ClientFormModalNode/DNS/HostmodalsOutboundFormModal+ all outbound fragments, and the host json-form wrappers that reuse themInboundFormModal(the 1054-line giant) + all inbound fragmentsShared config editors are not rewritten: the 1180-line
FinalMaskForm,SniffingFields, andCustomSockoptListstay Ant-Design-Formislands, wrapped in small value/onChange adapters (src/lib/xray/forms/fields/) and bound via aController(the same pattern the pre-existingHostFinalMaskFormused).HeaderMapEditoralready exposes value/onChange and binds directly. The now-unusedantdRulehelper is removed andfrontend/CLAUDE.mddocuments the new pattern.Intentionally out of scope (not
Form-based, left as-is): the settings tabs (control panels that live-patchallSetting),FilterDrawer, andGroupsPage.Verification
typecheck,lint,build, and the full 727-test vitest suite pass on every commit. The golden share-link / config fixtures pass byte-for-byte, confirming identical wire output.streamSettings.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.