From 750aa40e8e366f8f3e2075e8ac846010ce36ba3b Mon Sep 17 00:00:00 2001 From: miteruzo Date: Fri, 5 Jun 2026 01:59:46 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=BC=E3=83=A0=E3=81=AE?= =?UTF-8?q?=E3=83=90=E3=83=AA=E3=83=87=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E3=81=A8=E3=83=8B=E3=82=B3=E9=80=A3=E6=90=BA=E3=81=AE=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E5=A4=89=E6=9B=B4=20(#090)=20(#355)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: http://git.miteruzo.com/miteruzo/btrc-hub/pulls/355 Co-authored-by: miteruzo Co-committed-by: miteruzo --- AGENTS.md | 42 +- backend/Gemfile | 2 + backend/Gemfile.lock | 4 + .../app/controllers/application_controller.rb | 48 ++ .../app/controllers/deerjikists_controller.rb | 10 +- .../app/controllers/materials_controller.rb | 16 +- .../app/controllers/nico_tags_controller.rb | 101 +++- backend/app/controllers/posts_controller.rb | 75 ++- backend/app/controllers/preview_controller.rb | 12 +- .../controllers/tag_children_controller.rb | 10 +- backend/app/controllers/tags_controller.rb | 48 +- .../theatre_comments_controller.rb | 2 +- backend/app/controllers/users_controller.rb | 4 +- .../app/controllers/wiki_pages_controller.rb | 16 +- backend/app/models/post.rb | 2 +- backend/app/representations/post_repr.rb | 57 ++- backend/app/representations/tag_repr.rb | 4 + backend/spec/requests/error_responses_spec.rb | 47 ++ backend/spec/requests/materials_spec.rb | 26 +- backend/spec/requests/nico_tags_spec.rb | 100 +++- backend/spec/requests/posts_spec.rb | 90 +++- .../spec/requests/tags_deerjikists_spec.rb | 24 + backend/spec/requests/users_spec.rb | 6 +- frontend/src/App.tsx | 3 +- frontend/src/components/PostEditForm.tsx | 73 ++- frontend/src/components/PostFormTagsArea.tsx | 61 +-- .../PostOriginalCreatedTimeField.tsx | 137 ++--- frontend/src/components/TagSearch.tsx | 6 +- .../src/components/common/DateTimeField.tsx | 19 +- frontend/src/components/common/FieldError.tsx | 18 + frontend/src/components/common/FormField.tsx | 36 ++ frontend/src/components/common/Label.tsx | 35 +- frontend/src/components/common/TagInput.tsx | 16 +- frontend/src/components/common/TextArea.tsx | 22 +- frontend/src/lib/apiErrors.test.ts | 79 +++ frontend/src/lib/apiErrors.ts | 36 ++ frontend/src/lib/prefetchers.test.ts | 28 ++ frontend/src/lib/prefetchers.ts | 22 +- frontend/src/lib/queryKeys.ts | 4 +- frontend/src/lib/tags.ts | 20 +- frontend/src/lib/useValidationErrors.ts | 28 ++ frontend/src/lib/users.test.ts | 20 + frontend/src/lib/users.ts | 7 + frontend/src/lib/utils.ts | 12 + .../deerjikists/DeerjikistDetailPage.test.tsx | 72 +++ .../deerjikists/DeerjikistDetailPage.tsx | 90 ++-- .../pages/materials/MaterialDetailPage.tsx | 114 +++-- .../pages/materials/MaterialNewPage.test.tsx | 38 +- .../src/pages/materials/MaterialNewPage.tsx | 113 +++-- .../pages/materials/MaterialSearchPage.tsx | 28 +- frontend/src/pages/posts/PostDetailPage.tsx | 5 +- frontend/src/pages/posts/PostNewPage.test.tsx | 44 +- frontend/src/pages/posts/PostNewPage.tsx | 159 +++--- frontend/src/pages/posts/PostSearchPage.tsx | 112 +++-- .../src/pages/tags/NicoTagListPage.test.tsx | 273 ++++++++++ frontend/src/pages/tags/NicoTagListPage.tsx | 466 +++++++++++++----- .../src/pages/tags/TagDetailPage.test.tsx | 36 +- frontend/src/pages/tags/TagDetailPage.tsx | 102 ++-- frontend/src/pages/tags/TagListPage.tsx | 126 ++--- .../src/pages/theatres/TheatreDetailPage.tsx | 16 +- frontend/src/pages/users/SettingPage.test.tsx | 34 +- frontend/src/pages/users/SettingPage.tsx | 27 +- frontend/src/pages/wiki/WikiEditPage.tsx | 48 +- frontend/src/pages/wiki/WikiNewPage.tsx | 47 +- frontend/src/pages/wiki/WikiSearchPage.tsx | 31 +- frontend/src/types.ts | 17 +- 66 files changed, 2624 insertions(+), 802 deletions(-) create mode 100644 backend/spec/requests/error_responses_spec.rb create mode 100644 frontend/src/components/common/FieldError.tsx create mode 100644 frontend/src/components/common/FormField.tsx create mode 100644 frontend/src/lib/apiErrors.test.ts create mode 100644 frontend/src/lib/apiErrors.ts create mode 100644 frontend/src/lib/useValidationErrors.ts create mode 100644 frontend/src/lib/users.test.ts create mode 100644 frontend/src/lib/users.ts create mode 100644 frontend/src/pages/deerjikists/DeerjikistDetailPage.test.tsx create mode 100644 frontend/src/pages/tags/NicoTagListPage.test.tsx diff --git a/AGENTS.md b/AGENTS.md index 168db54..7ab89a3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -84,12 +84,14 @@ cd frontend npm run dev npm run build npm run lint +npm run test +npm run test:run npm run preview ``` `npm run build` runs `tsc -b && vite build`, then `postbuild` runs `node scripts/generate-sitemap.js`. -Do not write or report `npm test` as a repository command unless a `test` script is added to `frontend/package.json`. +`npm run test` runs Vitest in watch mode. Use `npm run test:run` for a non-watch frontend test run. ## Coding style @@ -122,13 +124,49 @@ Do not write or report `npm test` as a repository command unless a `test` script - Keep page-level code under `frontend/src/pages` and shared UI/feature code under `frontend/src/components` unless existing patterns point elsewhere. - Match existing Tailwind, component, and import alias conventions. +### Frontend TSX style + +- Preserve the local TSX formatting style. Do not normalize TSX to common Prettier-style React formatting unless explicitly asked. +- Prefer `const` arrow functions for TypeScript/TSX component and helper declarations. +- Put two blank lines before and after top-level `const` function declarations, unless imports, exports, or file boundaries make that awkward. +- In TSX, indent nested tag attributes with one tab relative to the tag line. With the project tab width, this visually appears as 4 spaces. +- Keep a tag's closing marker on the same line as the final prop when the tag spans multiple lines. Do not put `/>` or `>` on its own line unless the existing surrounding code does so. +- Keep JSX closing parentheses in the existing compact style, for example `)` rather than moving `)` onto a separate line. + +Preferred: + +```tsx +const PostFormTagsArea: FC = ({ tags, setTags, errors, ...rest }) => { + return ( +