Skip to content

Swagger Editor App - #61

Open
AlyaEngineer wants to merge 21 commits into
mainfrom
develop
Open

Swagger Editor App#61
AlyaEngineer wants to merge 21 commits into
mainfrom
develop

Conversation

@AlyaEngineer

@AlyaEngineer AlyaEngineer commented Jul 6, 2026

Copy link
Copy Markdown
Owner
  1. Task: https://github.com/rolling-scopes-school/tasks/blob/master/react/modules/tasks/final.md
2. Screenshots Снимок экрана 2026-07-14 163439 Снимок экрана 2026-07-14 165124 Снимок экрана 2026-07-14 163514 Снимок экрана 2026-07-14 163550 Снимок экрана 2026-07-14 163617 Снимок экрана 2026-07-14 163753 Снимок экрана 2026-07-14 165010 Снимок экрана 2026-07-14 164059 Снимок экрана 2026-07-14 164457 Снимок экрана 2026-07-14 155032
  1. Deployment: Swagger Editor App
  2. Done / deadline: 14.07.2026 / 14.07.2026
  3. Score: 550 / 550
  4. TouTube link: https://youtu.be/A8oMetTeLDY
Feature 1: App Header
  • Non-auth users see Sign In / Sign Up in header (upper right) — 15
  • Auth users see History / Sign Out in header — 10
  • About link in header and footer — 10
  • Expired/invalid token → redirect from private routes to Main — 10
  • Sign In / Sign Up buttons redirect to respective form route — 15
Feature 2: Sign In / Sign Up
  • Sign In / Sign Up / Sign Out buttons present everywhere they should be — 10
  • Client-side validation (email, password: 8+ chars, letter+digit+special, Unicode) — 20
  • Successful login → redirect to Main — 10
  • Logged-in user on Sign In / Sign Up routes → redirect to Main — 10
Feature 3: Swagger Editor
  • Load/paste schema in JSON and YAML — 25
  • Auto-detect input format (JSON vs YAML) — 20
  • Format switch with JSON ↔ YAML conversion, no data loss — 20
  • Schema validation with error indication — 15
  • Auth users save schema; restored on next login — 10
  • Viewer auto-populates with endpoints on valid schema — 10
  • Responsive split view (horizontal/vertical by orientation) — 20
Feature 4: Swagger Viewer
  • Endpoint list organized by path/method — 20
  • Details: method, path, all param types (path/query/header/cookie) — 25
  • Request schema and example payloads displayed — 20
  • Response schema, examples, all status codes displayed — 25
  • Try-It-Out: fill params/headers/body, execute, show response — 20
  • Generate cURL + copy-to-clipboard — 10
Feature 5: History and Analytics
  • SSR-generated; empty state with links to editor/viewer — 15
  • Requests sorted by timestamp (most recent first) — 10
  • Server-side analytics: duration, status, timestamp, method, request size, response size, error details, endpoint/URL — 45
Feature 6: About Page
  • Public route, accessible to all — 5
  • Info about RS School course — 5
  • Team info (names, roles, GitHub links) — 10
  • Design consistent with the app — 5
Feature 7: General Requirements
  • i18n: 2+ languages with toggler in header — 30
  • Sticky header with animation on stick — 10
  • User-friendly error display — 10
  • Private routes protected (401 if not authenticated) — 5
Feature 8: YouTube Video
  • 5–7 min YouTube walkthrough linked, covers all criteria — 50

AlyaEngineer and others added 7 commits June 27, 2026 17:44
* feat: install next+ts+linter+prettier+ husky+redux

* feat: configs + perfectionist + lint fix

* feat: install scss

* refactor: add some folders

* feat: add commitlint and remove default favicons

* feat: delete unnecessary files

---------

Co-authored-by: Yulia  Demir <Nightelfin91@gmail.com>
* Merge pull request #39 from AlyaEngineer/story/0-development-environment

feature/0 - Project setup

* Chore: Set up testing environment (#47)

* chore: set up testing environment with Vitest and RTL

* style: satisfy eslint rule in commitlint config

* fix: fix next build errors (#52)

* chore: replace scss with css modules

* chore: add placeholder for locale page and layout

* сhore: apply lint formatting to config file
@AlyaEngineer
AlyaEngineer requested a review from lexarudak July 6, 2026 10:12
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds repository tooling, locale and theme wiring, shared navigation and error UI, Supabase authentication flows, and a Swagger editor with schema parsing, validation, persistence, and tests.

Changes

Application foundation and shared UI

Layer / File(s) Summary
Tooling and repository configuration
.coderabbit.yaml, .github/*, .gitignore, .husky/*, .prettier*, commitlint.config.mjs, eslint.config.mjs, package.json, tsconfig.json, vitest.*, README.md
Adds review automation, repository templates, ignore rules, hooks, formatting/linting configuration, package scripts, TypeScript settings, test setup, and project documentation.
i18n and theme runtime
next.config.ts, src/i18n/*, src/fonts.ts, src/theme/*, src/providers/mui-provider.tsx, src/i18n/messages/*
Defines locale routing/loading, navigation helpers, fonts, translated messages, MUI palettes, component overrides, typography, and provider composition.
Locale layout and routes
src/app/[locale]/*, src/app/globals.css, src/app/global-error.*
Adds locale metadata and the provider shell, editor and authentication routes, unauthorized redirect handling, and global layout styles.
Shared navigation and error UI
src/constants/*, src/components/app-link/*, src/components/header/*, src/components/footer/*, src/components/auth-navigation/*, src/components/error-card/*, src/providers/toast-provider/*
Adds shared route/navigation components, header/footer rendering, authentication-aware navigation, reusable error UI, toast context, and related tests.

Authentication

Layer / File(s) Summary
Supabase clients and auth state
src/lib/*, src/providers/auth-provider/*, src/utils/auth/get-authenticated-user.*, .env.example
Adds browser/server Supabase clients, cookie handling, authentication context, authenticated-user checks, environment placeholders, and tests.
Authentication validation and forms
src/utils/auth/auth-schemas.*, src/components/auth-card/*, src/components/controlled-text-field/*, src/components/sign-in-form/*, src/components/sign-up-form/*
Adds Zod validation, reusable form controls and cards, sign-in/sign-up submission flows, Supabase integration, redirects, toasts, and tests.
Auth middleware and route redirects
src/proxy.*
Combines next-intl middleware with Supabase claim refresh, cookie/header propagation, and redirects for authenticated users visiting authentication routes.

Swagger editor

Layer / File(s) Summary
Schema contracts, parsing, and validation
src/types/index.ts, src/constants/default-schema.ts, src/services/schema-service.ts, src/utils/swagger-editor/*, src/utils/network/get-signal-with-timeout.ts
Adds schema format and OpenAPI types, default content, JSON/YAML conversion and validation, endpoint extraction, persistence contracts, timeout cancellation, and tests.
Editor state and persistence
src/utils/hooks/use-swagger.*
Adds debounced validation, authenticated schema restoration, format conversion, edit tracking, and hook tests.
Editor UI components
src/app/[locale]/page.tsx, src/components/format-toggle/*, src/components/swagger-control/*, src/components/swagger-editor/*, src/components/swagger-monaco-editor/*, src/components/swagger-viewer/*
Adds the editor page composition, Monaco integration, viewer states, format switching, save controls, endpoint status display, and UI tests.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested labels: feature-1-header, feature-2-auth, feature-3-editor, feature-7-general, feature-9-footer

Suggested reviewers: lexarudak, Ivan-khodorov, a-rudak-EIS, YuliaDemir

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is generic and doesn’t describe the main change in this pull request. Use a specific title that highlights the primary change, such as adding Swagger editor, authentication, and i18n support.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
tsconfig.json (1)

21-24: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant path alias.

@/* already resolves to ./src/*, so @/components would already work without a separate @components alias. Consider dropping the redundant entry for consistency.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tsconfig.json` around lines 21 - 24, The tsconfig paths mapping contains a
redundant alias: `@components` duplicates the existing `@/*` resolution to
`./src/*`, so remove the extra entry from the `paths` block and keep the shared
`@/*` alias consistent for imports such as `@/components`.
src/app/layout.tsx (1)

17-20: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Placeholder metadata left unchanged.

title/description still reflect the default create-next-app scaffold rather than the "Swagger Editor" project. Low priority for a scaffolding PR, but should be updated before this becomes user-facing.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/layout.tsx` around lines 17 - 20, Update the exported metadata in
layout.tsx so it no longer uses the default create-next-app placeholder values.
Change the Metadata object in the metadata export to use project-specific title
and description for Swagger Editor, keeping the update localized to the metadata
definition.
src/app/page.module.css (1)

21-142: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Dead CSS: several classes are unused.

page.tsx only references styles.page, so .main, .intro, .ctas, a.primary/a.secondary, and .logo (referenced in the dark-mode block at line 127 but never defined) are all leftover from the create-next-app boilerplate and currently unused. Consider trimming this file to just what's rendered, or removing it once the real Home page is implemented.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/page.module.css` around lines 21 - 142, The page.module.css
stylesheet still contains leftover create-next-app boilerplate that is not
referenced by page.tsx, so remove the unused rules for .main, .intro, .ctas,
a.primary, a.secondary, and the .logo dark-mode override, and keep only the
styles actually applied by styles.page. If the Home page is intended to use
these selectors later, move them into the component that renders them instead of
leaving dead CSS in page.module.css.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Around line 1-36: The README is still using the default create-next-app
guidance, which points to the wrong app location and misses this project’s
Swagger Editor/RS School context. Update the getting-started and overview text
to reference the actual app entry under src/app and replace the generic Next.js
template copy with repo-specific setup and usage notes, keeping the README
aligned with the current structure and purpose.

---

Nitpick comments:
In `@src/app/layout.tsx`:
- Around line 17-20: Update the exported metadata in layout.tsx so it no longer
uses the default create-next-app placeholder values. Change the Metadata object
in the metadata export to use project-specific title and description for Swagger
Editor, keeping the update localized to the metadata definition.

In `@src/app/page.module.css`:
- Around line 21-142: The page.module.css stylesheet still contains leftover
create-next-app boilerplate that is not referenced by page.tsx, so remove the
unused rules for .main, .intro, .ctas, a.primary, a.secondary, and the .logo
dark-mode override, and keep only the styles actually applied by styles.page. If
the Home page is intended to use these selectors later, move them into the
component that renders them instead of leaving dead CSS in page.module.css.

In `@tsconfig.json`:
- Around line 21-24: The tsconfig paths mapping contains a redundant alias:
`@components` duplicates the existing `@/*` resolution to `./src/*`, so remove
the extra entry from the `paths` block and keep the shared `@/*` alias
consistent for imports such as `@/components`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 783b7bb0-0fec-4d88-830e-64e58a7cf262

📥 Commits

Reviewing files that changed from the base of the PR and between 900844a and 21cef07.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (22)
  • .coderabbit.yaml
  • .github/PULL_REQUEST_TEMPLATE.md
  • .gitignore
  • .husky/commit-msg
  • .husky/pre-commit
  • .prettierignore
  • .prettierrc
  • README.md
  • commitlint.config.mjs
  • eslint.config.mjs
  • next.config.ts
  • package.json
  • src/app/[locale]/layout.tsx
  • src/app/[locale]/page.tsx
  • src/app/globals.css
  • src/app/layout.tsx
  • src/app/page.module.css
  • src/app/page.tsx
  • src/components/index.ts
  • tsconfig.json
  • vitest.config.ts
  • vitest.setup.ts

Comment thread README.md Outdated
* Story/1 sticky header general (#50)

* feat: install next+ts+linter+prettier+ husky+redux

* feat: configs + perfectionist + lint fix

* feat: install scss

* refactor: add some folders

* feat: install i18n + basic configs

* feat: add internatiolisation

* feat: language switcher

* feat: dependencies update

* feat: add sticky header

* feat: add mui Button-and-Link-like component

* fix: lint

* style: add style for header

* refactor:  remove css from language selector

* refactor: add const for flex styles in the header boxes

* refactor: history style as link

* fix: add some fixes

* feat: footer with about page link (#59)

* feat: add Inter and JetBrains Mono fonts via next/font

* feat: reorganize theme into palette, components, typography, theme modules

* feat: add i18n translations for header navigation links

* fix: prevent header layout shift on language switcher toggle click

* feat: add footer with translated links and styling

* test: add tests for footer

* fix: correct invalid box-shadow offset

* fix: fix header height

* fix: fix language switcher

* refactor: extract routes and external links into constants

* refactor: remove leftover placeholder before merge

* fix: add InitColorSchemeScript to prevent SSR flash

* style: apply Prettier formatting

---------

Co-authored-by: YuliaDemir <129578495+YuliaDemir@users.noreply.github.com>
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
swagger-editor-app Ready Ready Preview, Comment Jul 13, 2026 11:33pm

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
src/i18n/messages/en.json (1)

2-21: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Inconsistent namespace key casing.

Metadata, Header, and HomePage are PascalCase while footer is lowercase. Standardize casing across namespaces to avoid confusion when components reference translation keys (e.g. useTranslations('footer') vs useTranslations('Footer')).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/i18n/messages/en.json` around lines 2 - 21, The translation namespace
keys in the messages file are inconsistent because Metadata, Header, and
HomePage use PascalCase while footer uses lowercase. Update the namespace key in
the messages object to match the same casing convention used by the other
sections, and make sure any references in components or hooks like
useTranslations(...) use that same symbol consistently.
src/app/[locale]/page.tsx (1)

1-4: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Inconsistent import path for Footer vs Header.

Header is imported from the barrel @components, but Footer bypasses it and imports directly from its file. Use the barrel consistently for both.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/`[locale]/page.tsx around lines 1 - 4, The import style is
inconsistent between Header and Footer in this page component. Update the Footer
import to use the same barrel entry as Header from `@components` so both symbols
are imported consistently, and keep the existing getTranslations import
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/auth-navigation/auth-navigation.tsx`:
- Around line 12-16: Remove the commented-out useAuth() call in
auth-navigation.tsx and replace the dead code with a concise TODO comment that
points to the tracked auth work; keep the current stub or replace it later, but
do not leave commented-out hook code inline. Use the auth-navigation component’s
useAuth-related destructuring as the location to clean up the dead code.

In `@src/i18n/messages/en.json`:
- Line 22: Remove the leftover debug translation entry from the English messages
file. The stray "check" key in the messages object appears to be a test
artifact, so delete it from the JSON alongside any related cleanup in the same
messages structure to keep the production i18n catalog clean.

In `@src/theme/components.ts`:
- Around line 54-68: The Select root styles in components.ts let the hover rule
override the focused outline because both selectors have equal specificity and
the hover rule comes later. Update the root style block so the focused state in
the root callback keeps precedence over hover, either by moving the focused
selector after the hover selector or by making the focused selector more
specific, ensuring the Mui-focused borderColor and borderWidth remain visible
when hovered.

---

Nitpick comments:
In `@src/app/`[locale]/page.tsx:
- Around line 1-4: The import style is inconsistent between Header and Footer in
this page component. Update the Footer import to use the same barrel entry as
Header from `@components` so both symbols are imported consistently, and keep the
existing getTranslations import unchanged.

In `@src/i18n/messages/en.json`:
- Around line 2-21: The translation namespace keys in the messages file are
inconsistent because Metadata, Header, and HomePage use PascalCase while footer
uses lowercase. Update the namespace key in the messages object to match the
same casing convention used by the other sections, and make sure any references
in components or hooks like useTranslations(...) use that same symbol
consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c3165677-59dd-4a0b-8ae2-81069c997260

📥 Commits

Reviewing files that changed from the base of the PR and between 21cef07 and 068e0a8.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (28)
  • .coderabbit.yaml
  • next.config.ts
  • package.json
  • src/app/[locale]/layout.tsx
  • src/app/[locale]/page.tsx
  • src/app/globals.css
  • src/components/app-link/app-link.tsx
  • src/components/auth-navigation/auth-navigation.tsx
  • src/components/footer/footer.test.tsx
  • src/components/footer/footer.tsx
  • src/components/header/header.tsx
  • src/components/index.ts
  • src/components/language-switcher/language-switcher.tsx
  • src/constants/brand.ts
  • src/constants/routes.ts
  • src/fonts.ts
  • src/i18n/messages/en.json
  • src/i18n/messages/ru.json
  • src/i18n/navigation.ts
  • src/i18n/request.ts
  • src/i18n/routing.ts
  • src/providers/mui-provider.tsx
  • src/proxy.ts
  • src/theme/components.ts
  • src/theme/index.ts
  • src/theme/palette.ts
  • src/theme/theme.ts
  • src/theme/typography.ts
✅ Files skipped from review due to trivial changes (5)
  • src/i18n/routing.ts
  • src/components/footer/footer.tsx
  • src/constants/routes.ts
  • src/components/index.ts
  • src/i18n/messages/ru.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • .coderabbit.yaml

Comment thread src/components/auth-navigation/auth-navigation.tsx Outdated
Comment thread src/i18n/messages/en.json Outdated
Comment thread src/theme/components.ts
* feat: language switching (#53)

* feat: install next+ts+linter+prettier+ husky+redux

* feat: configs + perfectionist + lint fix

* feat: install scss

* refactor: add some folders

* feat: install i18n + basic configs

* feat: add internatiolisation

* feat: language switcher

* feat: dependencies update

* fix: delete scss + delete unnecessary files

* fix: delete unnecessary layout

* feat: user friendly errors (#58)

* feat: add error page component

* test: add tests for error page component

* feat: add global error page component

* test: add tests for global error page component

* feat: implement toast provider and toast component

* test: add tests for toast provider and toast component

* feat: add toaster messages dictionary

* chore: add coderabbit config

* fix: fix .coderabbit.yaml instruction

* fix: add target branches for review to instructions

* fix: move console.error into useEffect

* fix: ignore clickaway on close

* test: add test for onClose on clickaway

* fix: memoize showToast and context value with useCallback/useMemo

* fix: remove duplicate dependency entries from devDependencies in package.json

* fix: pass showToast function directly to context instead of memoized object wrapper

* fix: split combined toast state into three separate useState calls

* refactor: extract error page props into named Props type

* fix: fixes with Prettier

* feat: integrate ToastProvider into app layout

* refactor: extract shared ErrorCard component and align with MUI theme

* refactor: rename ErrorCard props

* fix: add suppressHydrationWarning to html tag to prevent expected mismatch

* refactor: move Header and Footer into root layout

* fix: wrap main content in semantic main element

* fix: add borderBottom to AppBar in header

---------

Co-authored-by: YuliaDemir <129578495+YuliaDemir@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/app/global-error.tsx (1)

36-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Hardcoded copy duplicates errorPage translation strings.

"Something went wrong", "Try refreshing the page or come back later", and "Try again" mirror the errorPage messages exercised in error.test.tsx (title/description/retry). Since global-error.tsx renders outside the locale layout it can't use next-intl, but leaving the fallback copy as inline literals means the two content sources can silently drift if one is edited and not the other. Consider extracting these fallback strings into a small shared constant (e.g. src/constants/error-fallback.ts) imported by both this file and used as the en default, so there's one place to update.

As per path instructions, "Flag duplicate implementations of the same logic in different files."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/global-error.tsx` around lines 36 - 40, The fallback copy in
global-error.tsx duplicates the errorPage text used elsewhere, so it can drift
if edited separately. Extract the title, description, and retry label into a
shared constant (for example, a small error-fallback module) and import it here
and wherever the English default is defined, keeping the single source of truth
aligned with errorPage and error.test.tsx.

Source: Path instructions

src/app/[locale]/error.tsx (1)

14-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate error-logging effect shared with global-error.tsx.

The useEffect(() => console.error(error), [error]) pattern is duplicated verbatim in src/app/global-error.tsx (Lines 26-28). Extracting a small shared hook removes the duplication and gives a single place to later swap in a real error-reporting service.

As per path instructions, "Flag duplicate implementations of the same logic in different files (e.g. two hooks or components solving the same UI concern)."

♻️ Suggested shared hook
+// src/hooks/use-log-error.ts
+import { useEffect } from 'react';
+
+export function useLogError(error: Error) {
+  useEffect(() => {
+    console.error(error);
+  }, [error]);
+}
 export default function ErrorPage({ error, unstable_retry }: Props) {
-  useEffect(() => {
-    console.error(error);
-  }, [error]);
+  useLogError(error);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/`[locale]/error.tsx around lines 14 - 16, The error-logging useEffect
in this error component is duplicated in global-error.tsx, so extract the shared
behavior into a small reusable hook and use it from both components. Move the
console.error(error) effect into a named hook (for example, one referenced from
error.tsx and global-error.tsx) so there is a single place to later swap in
centralized error reporting. Keep the existing behavior unchanged while
replacing the duplicated useEffect blocks with the shared hook call.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/app/`[locale]/error.tsx:
- Around line 14-16: The error-logging useEffect in this error component is
duplicated in global-error.tsx, so extract the shared behavior into a small
reusable hook and use it from both components. Move the console.error(error)
effect into a named hook (for example, one referenced from error.tsx and
global-error.tsx) so there is a single place to later swap in centralized error
reporting. Keep the existing behavior unchanged while replacing the duplicated
useEffect blocks with the shared hook call.

In `@src/app/global-error.tsx`:
- Around line 36-40: The fallback copy in global-error.tsx duplicates the
errorPage text used elsewhere, so it can drift if edited separately. Extract the
title, description, and retry label into a shared constant (for example, a small
error-fallback module) and import it here and wherever the English default is
defined, keeping the single source of truth aligned with errorPage and
error.test.tsx.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8a6440ac-4b76-46c5-b20e-1e1d5d84592a

📥 Commits

Reviewing files that changed from the base of the PR and between 068e0a8 and 55f86f4.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (18)
  • package.json
  • src/app/[locale]/error.test.tsx
  • src/app/[locale]/error.tsx
  • src/app/[locale]/layout.tsx
  • src/app/[locale]/page.tsx
  • src/app/global-error.test.tsx
  • src/app/global-error.tsx
  • src/components/error-card/error-card.tsx
  • src/components/header/header.tsx
  • src/components/index.ts
  • src/i18n/messages/en.json
  • src/i18n/messages/ru.json
  • src/providers/mui-provider.tsx
  • src/providers/toast-provider/Toast.test.tsx
  • src/providers/toast-provider/Toast.tsx
  • src/providers/toast-provider/ToastProvider.test.tsx
  • src/providers/toast-provider/ToastProvider.tsx
  • src/providers/toast-provider/types.ts
💤 Files with no reviewable changes (1)
  • src/app/[locale]/page.tsx
✅ Files skipped from review due to trivial changes (4)
  • src/providers/toast-provider/Toast.test.tsx
  • src/i18n/messages/ru.json
  • src/components/index.ts
  • src/providers/toast-provider/Toast.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/app/[locale]/layout.tsx
  • src/components/header/header.tsx

* Story/1 sticky header general (#50)

* feat: install next+ts+linter+prettier+ husky+redux

* feat: configs + perfectionist + lint fix

* feat: install scss

* refactor: add some folders

* feat: install i18n + basic configs

* feat: add internatiolisation

* feat: language switcher

* feat: dependencies update

* feat: add sticky header

* feat: add mui Button-and-Link-like component

* fix: lint

* style: add style for header

* refactor:  remove css from language selector

* refactor: add const for flex styles in the header boxes

* refactor: history style as link

* fix: add some fixes

* feat: schema json yaml support (#63)

* chore: setup libraries

* feat: swagger-editor

* refactor: move title and description into a separated component

* refactor: moved controls into the swaggerControl component

* chore: update package-lock.json

* fix: fix import in swagger-view

* feat: add translations into SwaggerControl, SwaggerEditor, SwaggerViewer

* fix: fix title translation in main text

* fix: enforce unique keys when parsing YAML

* refactor: extract DEFAULT_SCHEMA into a constant

* feat: add tooltip explaining disabled format toggle

* test: add test coverage for schema editing flow

* fix: resolve component type errors in swagger viewer

* fix: add request timeout with AbortController

* fix: preserve Monaco editor undo history and cursor position on format switch

* fix: prevent restore fetch from overwriting user-edited schema

* fix: handle rejected promise in restoreSchema to prevent unhandled rejection

* fix: replace missing setEditorValue with handleEditorChange in SwaggerEditor

* fix: apply syntax highlighting immediately on editor mount

* fix: preserve original JSON parse error

* fix: disable external $ref resolution in schema validation to prevent SSRF

* refactor: split SwaggerControl into service, component, and helper

move save request to schema-service
extract FormatToggle component
extract getSignalWithTimeout helper
switch errors to toast notifications

* refactor: rename useSwaggerHook and drop unnecessary useMemo

* test: fix tests after refactor

* refactor: extract duplicated language-setting logic into helper in SwaggerMonacoEditor

* refactor: remove redundant SwaggerViewer title

* fix: use translated conversionError message instead of hardcoded string

* refactor: extract SchemaFormat and isRecord into shared schema-types module

* fix: reserve space for status alert to prevent layout shift on locale switch

* feat: sync Monaco editor theme with app color scheme

* style: add shadow, border-radius, deduplicate panel styles

* test: fix ReactElement import in swagger-control tests

* feat: extract schema fetch logic into SchemaService with restore and save methods

* fix: extract magic number into named constant

* refactor: extract isRecord type guard into its own module

* fix: validate restore payload and cancel restore request on unmount

* test: add tests for monaco theme

* feat: add SwaggerViewer placeholder component

* fix: route SwaggerControl toast messages through shared toaster namespace

---------

Co-authored-by: Yulia  Demir <Nightelfin91@gmail.com>

* fix: remove duplicate SwaggerViewer implementation in swagger-view folder

* fix: remove unused key from swaggerControl i18n namespace

* fix: guard non-object JSON in SchemaService.restore

* refactor: catch unhandled rejection in debounced validation

---------

Co-authored-by: YuliaDemir <129578495+YuliaDemir@users.noreply.github.com>
Co-authored-by: Yulia  Demir <Nightelfin91@gmail.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (6)
package.json (1)

33-35: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Minor MUI version skew across related packages.

@mui/material is pinned to ^9.1.2 while @mui/icons-material and @mui/material-nextjs are pinned to ^9.1.1. These packages are typically released in lockstep; aligning them avoids subtle icon/theme mismatches down the line.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` around lines 33 - 35, The MUI package versions are slightly out
of sync across the related dependencies, so align the versions in package.json
for `@mui/material`, `@mui/icons-material`, and `@mui/material-nextjs` to the same
release. Update the dependency entries together so the MUI packages stay in
lockstep and can be located easily by their package names in the dependency
list.
src/components/swagger-control/swagger-control.test.tsx (1)

62-93: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Missing test for the timeout/AbortError branch.

Tests cover the success and generic-failure paths but not the AbortErrorrequestTimeoutError toast branch in handleSaveSchema. Consider adding a case that rejects the fetch promise with an AbortError-named error to cover this branch.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/swagger-control/swagger-control.test.tsx` around lines 62 -
93, The SwaggerControl tests cover success and generic failure, but they do not
exercise the AbortError path in handleSaveSchema. Add a new test alongside the
existing save endpoint cases that mocks global.fetch to reject with an error
whose name is AbortError, then assert the UI shows the requestTimeoutError
toast. Use SwaggerControl, handleSaveSchema behavior, and the existing
renderWithToast/userEvent patterns to locate the right test block.
src/components/swagger-control/swagger-control.tsx (1)

29-32: 🔒 Security & Privacy | 🔵 Trivial | 🏗️ Heavy lift

Hardcoded auth bypass behind TODO.

isAuthenticated is hardcoded true, so the Save button and its side effects run for every user regardless of real auth state. This matches the PR's stated incomplete-auth scope, but flagging so it isn't missed before merge.

Want help wiring this to the real auth state once it lands?

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/swagger-control/swagger-control.tsx` around lines 29 - 32, The
auth state in swagger-control is hardcoded to true, so replace the temporary
placeholder with the real authentication source before Save-related behavior
depends on it. Update the isAuthenticated logic in SwaggerControl to read from
the actual auth state/provider instead of the inline object literal, and keep
the existing Save button gating tied to that symbol so unauthorized users cannot
trigger the side effects.
src/components/swagger-monaco-editor/swagger-monaco-editor.tsx (1)

38-60: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Minor: applyLanguage omitted from useEffect dependencies.

The effect only depends on format, relying on editorRef/monacoRef being stable refs; functionally correct but may trigger react-hooks/exhaustive-deps lint warnings. Not blocking.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/swagger-monaco-editor/swagger-monaco-editor.tsx` around lines
38 - 60, The `useEffect` that calls `applyLanguage` in
`swagger-monaco-editor.tsx` is missing the function from its dependency list,
which can trigger `react-hooks/exhaustive-deps` warnings. Update the effect to
include `applyLanguage` alongside `format`, and keep the `applyLanguage` helper
in sync with the `handleMount` flow so the language update logic remains
centralized and lint-compliant.
src/components/swagger-viewer/swagger-viewer.tsx (1)

13-13: 🎯 Functional Correctness | 🔵 Trivial

TODO: placeholder implementation.

SwaggerViewer is a stub per the TODO comment; real viewer rendering (endpoint list/tree) is not implemented yet.

Would you like help scaffolding the real endpoint viewer (list, expand/collapse per path/method), or should this be tracked in a separate issue per the PR's "viewer features" incomplete-items list?

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/swagger-viewer/swagger-viewer.tsx` at line 13, SwaggerViewer
is still a placeholder stub and does not render the actual endpoint viewer UI.
Replace the TODO implementation in SwaggerViewer with real Swagger rendering
logic that displays the API endpoints, including a list/tree of paths and
methods and any needed expand/collapse behavior, using the existing
SwaggerViewer component as the entry point. If the full viewer is intentionally
out of scope for this PR, keep only a minimal non-placeholder implementation and
move the remaining viewer features to a separate tracked issue.
src/utils/hooks/use-swagger.ts (1)

97-106: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Drop setError from useSwagger’s public return value. No current consumer uses it, so the hook can keep that state private and avoid leaking an internal setter.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/utils/hooks/use-swagger.ts` around lines 97 - 106, Remove the internal
error setter from the public API of useSwagger by taking setError out of the
object returned from the hook. Keep the error state managed inside useSwagger
itself and leave the existing consumers on editorValue, error, format,
handleEditorChange, handleFormatToggle, isValid, and schema unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/swagger-control/swagger-control.tsx`:
- Around line 36-58: The async save flow in handleSaveSchema can still call
setIsSaving(false) after unmount, causing a React state-update warning. Add an
unmount guard in swagger-control.tsx around handleSaveSchema, either by tracking
mounted state with a ref or aborting the in-flight SchemaService.save request on
unmount, and only update state in the finally block when the component is still
mounted.

In `@src/services/schema-service.ts`:
- Around line 23-37: The restore() method in schema-service.ts is treating every
non-2xx fetch response as “no saved schema,” which hides real server failures
from callers like use-swagger.ts. Update restore() to distinguish a true
missing-schema case from actual backend errors: only return null for the
intended “not found/no data” response, and for other !response.ok cases throw or
reject with the response error so the caller can surface it. Keep the existing
restore() and save() error-handling behavior aligned, using the restore()
function and its fetch('/api/schema') response handling as the main place to fix
this.

In `@src/utils/hooks/use-swagger.ts`:
- Around line 29-49: The useEffect in use-swagger is vulnerable to stale async
validation results overwriting newer editorValue state. Add a run/version guard
inside the validateSwaggerSchema promise chain so only the latest debounce cycle
can call setIsValid, setError, setSchema, and setFormat. Use the existing
useEffect cleanup plus a local token/flag tied to editorValue to ignore older
resolve/catch callbacks.
- Around line 51-76: The restore flow in useSwagger is only clearing the
timeout, so SchemaService.restore(signal) can continue after unmount. Update
getSignalWithTimeout to expose an abortable cleanup, not just timer clearing,
and make the useEffect cleanup call that abort path. Keep the existing
restoreSchema and restoreError handling, but ensure the AbortController is
actually aborted when the effect tears down.

In `@src/utils/network/get-signal-with-timeout.ts`:
- Around line 1-10: The getSignalWithTimeout API currently exposes only cleanup,
which only clears the timeout and cannot cancel the AbortController request.
Update getSignalWithTimeout to return a separate abort action alongside cleanup
and signal, and use distinct semantics in callers such as use-swagger.ts and
swagger-control.tsx so React unmount cleanup can actually abort the pending
request while request-settlement paths still clear the timer. Ensure the unique
symbols getSignalWithTimeout and cleanup are updated consistently wherever they
are consumed.

---

Nitpick comments:
In `@package.json`:
- Around line 33-35: The MUI package versions are slightly out of sync across
the related dependencies, so align the versions in package.json for
`@mui/material`, `@mui/icons-material`, and `@mui/material-nextjs` to the same
release. Update the dependency entries together so the MUI packages stay in
lockstep and can be located easily by their package names in the dependency
list.

In `@src/components/swagger-control/swagger-control.test.tsx`:
- Around line 62-93: The SwaggerControl tests cover success and generic failure,
but they do not exercise the AbortError path in handleSaveSchema. Add a new test
alongside the existing save endpoint cases that mocks global.fetch to reject
with an error whose name is AbortError, then assert the UI shows the
requestTimeoutError toast. Use SwaggerControl, handleSaveSchema behavior, and
the existing renderWithToast/userEvent patterns to locate the right test block.

In `@src/components/swagger-control/swagger-control.tsx`:
- Around line 29-32: The auth state in swagger-control is hardcoded to true, so
replace the temporary placeholder with the real authentication source before
Save-related behavior depends on it. Update the isAuthenticated logic in
SwaggerControl to read from the actual auth state/provider instead of the inline
object literal, and keep the existing Save button gating tied to that symbol so
unauthorized users cannot trigger the side effects.

In `@src/components/swagger-monaco-editor/swagger-monaco-editor.tsx`:
- Around line 38-60: The `useEffect` that calls `applyLanguage` in
`swagger-monaco-editor.tsx` is missing the function from its dependency list,
which can trigger `react-hooks/exhaustive-deps` warnings. Update the effect to
include `applyLanguage` alongside `format`, and keep the `applyLanguage` helper
in sync with the `handleMount` flow so the language update logic remains
centralized and lint-compliant.

In `@src/components/swagger-viewer/swagger-viewer.tsx`:
- Line 13: SwaggerViewer is still a placeholder stub and does not render the
actual endpoint viewer UI. Replace the TODO implementation in SwaggerViewer with
real Swagger rendering logic that displays the API endpoints, including a
list/tree of paths and methods and any needed expand/collapse behavior, using
the existing SwaggerViewer component as the entry point. If the full viewer is
intentionally out of scope for this PR, keep only a minimal non-placeholder
implementation and move the remaining viewer features to a separate tracked
issue.

In `@src/utils/hooks/use-swagger.ts`:
- Around line 97-106: Remove the internal error setter from the public API of
useSwagger by taking setError out of the object returned from the hook. Keep the
error state managed inside useSwagger itself and leave the existing consumers on
editorValue, error, format, handleEditorChange, handleFormatToggle, isValid, and
schema unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e625216d-27db-4edc-af8f-bcb1a34fee74

📥 Commits

Reviewing files that changed from the base of the PR and between 55f86f4 and 84dee66.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (33)
  • package.json
  • src/app/[locale]/page.tsx
  • src/app/globals.css
  • src/components/format-toggle/format-toggle.tsx
  • src/components/header/header.tsx
  • src/components/index.ts
  • src/components/main-text/main-text.test.tsx
  • src/components/main-text/main-text.tsx
  • src/components/swagger-control/swagger-control.test.tsx
  • src/components/swagger-control/swagger-control.tsx
  • src/components/swagger-editor/swagger-editor.test.tsx
  • src/components/swagger-editor/swagger-editor.tsx
  • src/components/swagger-monaco-editor/swagger-monaco-editor.test.tsx
  • src/components/swagger-monaco-editor/swagger-monaco-editor.tsx
  • src/components/swagger-viewer/swagger-viewer.tsx
  • src/constants/default-schema.ts
  • src/constants/index.ts
  • src/i18n/messages/en.json
  • src/i18n/messages/ru.json
  • src/services/schema-service.ts
  • src/types/index.ts
  • src/utils/hooks/use-swagger.test.ts
  • src/utils/hooks/use-swagger.ts
  • src/utils/network/get-signal-with-timeout.ts
  • src/utils/swagger-editor/get-swagger-endpoints.ts
  • src/utils/swagger-editor/is-record.ts
  • src/utils/swagger-editor/schema-format-convert.test.ts
  • src/utils/swagger-editor/schema-format-parse.test.ts
  • src/utils/swagger-editor/schema-format.ts
  • src/utils/swagger-editor/schema-types.ts
  • src/utils/swagger-editor/swagger-validation.test.ts
  • src/utils/swagger-editor/swagger-validation.ts
  • tsconfig.json
💤 Files with no reviewable changes (1)
  • src/app/globals.css
✅ Files skipped from review due to trivial changes (2)
  • src/utils/swagger-editor/is-record.ts
  • src/types/index.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/components/header/header.tsx
  • tsconfig.json
  • src/i18n/messages/ru.json
  • src/i18n/messages/en.json

Comment thread src/components/swagger-control/swagger-control.tsx
Comment thread src/services/schema-service.ts Outdated
Comment thread src/utils/hooks/use-swagger.ts
Comment thread src/utils/hooks/use-swagger.ts Outdated
Comment thread src/utils/network/get-signal-with-timeout.ts
* chore: supabase setup (#73)

* chore: install the @supabase/supabase-js and @supabase/ssr helper packages

* feat: add Supabase browser client

* feat: add Supabase server client

* docs: add .env.example

* chore: add .env.local to gitignore

* docs: update README with project description, setup instructions, and environment variables

* feat: integrate Supabase session refresh into proxy

* test: add tests for Supabase browser client, server client, and proxy

* chore: ensure .env.example is tracked

* fix: log getClaims errors in proxy

* test: fix after review

* fix: pass response headers through setAll in proxy and add test coverage

* feat: proxy route protection (#75)

* feat: add page stubs for about, history, sign-in, and sign-up routes

* feat: redirect authenticated users away from sign-in/sign-up routes

* feat: protect private routes with 401 and redirect expired/invalid sessions

* test: add tests for getAuthenticatedUser, Unauthorized page, and proxy auth-route redirects

* fix: stricter route matching, error handling, cookie and locale preservation on redirect

* fix: wrap getClaims() in try/catch in getAuthenticatedUser

* refactor: use ROUTES constants and simplify locale/route matching

* fix: forward setAll headers on auth-route redirect

* docs: link to Supabase SSR guide in browser and server client files

* feat: auth forms integration (#79)

* feat: add AuthProvider with signOut and reactive auth state

* test: add unit tests for AuthProvider and AuthNavigation component

* refactor: update ru sign-up label

* chore: install zod, react-hook-form, @hookform/resolvers

* feat: add sign-in and sign-up forms with zod validation

* feat: connect SignIn and SignUp forms to Supabase auth

* fix: redirect to home after sign out to leave protected routes

* test: cover auth-schemas, auth-card, controlled-text-field, sign-in and sign-up forms

* fix: handle rejected Supabase calls in auth flows

* fix: show a redirecting indicator in the unauthorized boundary

* fix: remove unnecessary 'use client' directive from AuthCard

* fix: add type="button" to password visibility toggle to prevent accidental form submission

* fix: rebuild proxy response after mutating cookies

* test: update tests and proxy.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (3)
src/providers/auth-provider/AuthProvider.test.tsx (1)

17-39: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove unused/broken authStateChangeCallback capture mechanism.

This parameter is never passed by any test in this file, and even if it were, Object.assign(authStateChangeCallback, callback) can't reassign the caller's reference to a function — it only copies enumerable properties. The later tests correctly capture the callback via a closure (lines 74-85) instead. Recommend dropping the dead/non-functional path to avoid a future footgun.

♻️ Proposed cleanup
 function mockSupabaseClient({
-  authStateChangeCallback,
   user,
 }: {
-  authStateChangeCallback?: (event: string, session: unknown) => void;
   user: unknown;
 }) {
   const unsubscribe = vi.fn();
   const signOut = vi.fn().mockResolvedValue({ error: null });

   return {
     auth: {
       getUser: vi.fn().mockResolvedValue({ data: { user } }),
-      onAuthStateChange: vi.fn((callback: (event: string, session: unknown) => void) => {
-        if (authStateChangeCallback) {
-          Object.assign(authStateChangeCallback, callback);
-        }
-        return { data: { subscription: { unsubscribe } } };
-      }),
+      onAuthStateChange: vi.fn(() => ({ data: { subscription: { unsubscribe } } })),
       signOut,
     },
   } as unknown as ReturnType<typeof createClient>;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/providers/auth-provider/AuthProvider.test.tsx` around lines 17 - 39,
Remove the unused authStateChangeCallback parameter from mockSupabaseClient and
delete the conditional Object.assign capture logic inside onAuthStateChange.
Keep callback registration behavior intact so tests can continue capturing
callbacks through their existing closures.
src/components/controlled-text-field/controlled-text-field.tsx (1)

35-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Localize the password-toggle aria-label.

t(labelKey) and error text are translated, but "toggle password visibility" is hardcoded English. Screen-reader users on the ru locale would hear an English string.

🌐 Suggested fix
       <IconButton
-        aria-label="toggle password visibility"
+        aria-label={t('togglePasswordVisibility')}
         edge="end"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/controlled-text-field/controlled-text-field.tsx` around lines
35 - 48, Localize the hardcoded aria-label in the passwordToggleButton by
passing an appropriate translation key through the existing t translation
function. Preserve the toggle behavior and ensure the label reflects the current
password visibility state where supported by the existing translations.
src/components/sign-in-form/sign-in-form.tsx (1)

62-105: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate form-shell markup with sign-up-form.tsx.

The Box wrapper (sx styling, autoComplete="off", noValidate) and submit Button are copy-pasted between this file and sign-up-form.tsx (Lines 68-119 there). Consider extracting a shared <AuthFormShell> (or similar) that accepts children + submit label, to keep the two forms' shells in sync.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/sign-in-form/sign-in-form.tsx` around lines 62 - 105, The
sign-in and sign-up forms duplicate their shared form shell markup. Extract the
common Box wrapper and submit Button into an AuthFormShell component that
accepts children and the submit label, then update the sign-in form and sign-up
form to use it while preserving their existing fields, submission handlers,
styling, and disabled-state behavior.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Around line 9-11: Update the README feature list to match the PR’s implemented
scope: mark the interactive Swagger viewer, schema persistence through
registration/sign-in, and authenticated request history/analytics as planned or
incomplete, unless those capabilities are now implemented. Do not present these
items as currently available.

In `@src/app/`[locale]/about/page.tsx:
- Around line 1-2: Replace the placeholder JSX returned by AboutPage with the
localized About-page content, including RS School information, team details,
GitHub links, and the supported multi-language presentation. Reuse the project’s
existing localization and shared UI components or content patterns rather than
hardcoding a single-language placeholder.

In `@src/proxy.ts`:
- Around line 16-41: Update the Supabase client’s cookies.setAll handler to
preserve the response produced by handleIntl(request) instead of replacing it
with NextResponse.next({ request }); mutate the existing response while applying
refreshed cookies and headers. Add a regression test covering the next-intl
default-locale redirect path, ensuring the redirect remains intact when Supabase
refreshes cookies.

In `@src/utils/auth/auth-schemas.ts`:
- Around line 16-18: Update the password schema’s digit validation regex
alongside the existing letter and special-character checks to use the Unicode
decimal-digit property, so non-ASCII digits satisfy the digit requirement and
are excluded from special-character classification. Preserve the existing
password length, letter, and special-character rules.

In `@src/utils/auth/get-authenticated-user.ts`:
- Around line 5-20: Move the data/error validation out of the try block in
getAuthenticatedUser, retaining only the getClaims call and unexpected-error
logging in the catch. After the catch, invoke unauthorized() once when data is
absent or an authentication error exists, and update
get-authenticated-user.test.ts to verify the interrupt occurs only once.

---

Nitpick comments:
In `@src/components/controlled-text-field/controlled-text-field.tsx`:
- Around line 35-48: Localize the hardcoded aria-label in the
passwordToggleButton by passing an appropriate translation key through the
existing t translation function. Preserve the toggle behavior and ensure the
label reflects the current password visibility state where supported by the
existing translations.

In `@src/components/sign-in-form/sign-in-form.tsx`:
- Around line 62-105: The sign-in and sign-up forms duplicate their shared form
shell markup. Extract the common Box wrapper and submit Button into an
AuthFormShell component that accepts children and the submit label, then update
the sign-in form and sign-up form to use it while preserving their existing
fields, submission handlers, styling, and disabled-state behavior.

In `@src/providers/auth-provider/AuthProvider.test.tsx`:
- Around line 17-39: Remove the unused authStateChangeCallback parameter from
mockSupabaseClient and delete the conditional Object.assign capture logic inside
onAuthStateChange. Keep callback registration behavior intact so tests can
continue capturing callbacks through their existing closures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8ab11cd6-03f2-4a22-a244-36c547f963a5

📥 Commits

Reviewing files that changed from the base of the PR and between 84dee66 and 87d1003.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (39)
  • .env.example
  • .gitignore
  • README.md
  • next.config.ts
  • package.json
  • src/app/[locale]/about/page.tsx
  • src/app/[locale]/history/page.tsx
  • src/app/[locale]/layout.tsx
  • src/app/[locale]/sign-in/page.tsx
  • src/app/[locale]/sign-up/page.tsx
  • src/app/[locale]/unauthorized.test.tsx
  • src/app/[locale]/unauthorized.tsx
  • src/components/auth-card/auth-card.test.tsx
  • src/components/auth-card/auth-card.tsx
  • src/components/auth-navigation/auth-navigation.test.tsx
  • src/components/auth-navigation/auth-navigation.tsx
  • src/components/controlled-text-field/controlled-text-field.test.tsx
  • src/components/controlled-text-field/controlled-text-field.tsx
  • src/components/sign-in-form/sign-in-form.test.tsx
  • src/components/sign-in-form/sign-in-form.tsx
  • src/components/sign-up-form/sign-up-form.test.tsx
  • src/components/sign-up-form/sign-up-form.tsx
  • src/components/swagger-control/swagger-control.test.tsx
  • src/components/swagger-control/swagger-control.tsx
  • src/components/swagger-editor/swagger-editor.test.tsx
  • src/i18n/messages/en.json
  • src/i18n/messages/ru.json
  • src/lib/client.test.ts
  • src/lib/client.ts
  • src/lib/server.test.ts
  • src/lib/server.ts
  • src/providers/auth-provider/AuthProvider.test.tsx
  • src/providers/auth-provider/AuthProvider.tsx
  • src/proxy.test.ts
  • src/proxy.ts
  • src/utils/auth/auth-schemas.test.ts
  • src/utils/auth/auth-schemas.ts
  • src/utils/auth/get-authenticated-user.test.ts
  • src/utils/auth/get-authenticated-user.ts
🚧 Files skipped from review as they are similar to previous changes (9)
  • src/components/swagger-editor/swagger-editor.test.tsx
  • next.config.ts
  • src/app/[locale]/layout.tsx
  • src/i18n/messages/ru.json
  • src/components/swagger-control/swagger-control.test.tsx
  • package.json
  • .gitignore
  • src/i18n/messages/en.json
  • src/components/swagger-control/swagger-control.tsx

Comment thread README.md
Comment thread src/app/[locale]/about/page.tsx Outdated
Comment thread src/proxy.ts
Comment thread src/utils/auth/auth-schemas.ts
Comment thread src/utils/auth/get-authenticated-user.ts
* feat: add tests for header and language switcher

* fix: sign-in sign-up tests by mocking unnecessary components

* feat: add test for layout amd mui provider

* fix: tests
* feat: render swagger endpoint list

* feat: render endpoint details

* feat: add try-it-out execution

* fix: harden try-it-out request execution

* fix: pin try-it-out requests to validated IPs

* fix: handle try-it-out response stream errors

* feat: add curl generation

* fix: keep generated curl command current

* refactor: split swagger viewer components

* refactor: split try-it-out panel sections

* fix: harden try-it-out panel behavior

* feat: persist try-it-out history

* fix: cap try-it-out response size

* fix: harden try-it-out proxy

---------

Co-authored-by: Ivan-khodorov <187195904+Ivan-khodorov@users.noreply.github.com>
* feat: add History page with empty state and paginated table view

* test: cover History page, history list, history empty state, and getRequestHistory

* feat: add server-side request history persistence

* test: add tests for saveRequestHistory

* fix: handle unexpected errors when loading request history

* fix: prevent rendering history list on load failure

* fix: improve handle request history save failures

* refactor: simplify history page conditional rendering

* refactor: improve pagination code readability

* refactor: simplify history table header rendering
* feat: persist swagger schemas

* fix: validate persisted schemas

---------

Co-authored-by: Ivan-khodorov <187195904+Ivan-khodorov@users.noreply.github.com>
Co-authored-by: Ivan-khodorov <187195904+Ivan-khodorov@users.noreply.github.com>
* fix: header test

* fix: remove unnecessary test

* fix: add test timeout
* fix: header test

* fix: remove unnecessary test

* fix: add test timeout

* test: fix tests

* refactor: update tests

---------

Co-authored-by: Yulia  Demir <Nightelfin91@gmail.com>
* refactor: add import instead of using inner constant

* style: style MuiOutlinedInput and MuiPaper

* chore: uninstall  reduxjs/toolkit react-redux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants