diff --git a/.credentials.template b/.credentials.template index 4079e4b..2d11755 100644 --- a/.credentials.template +++ b/.credentials.template @@ -14,6 +14,12 @@ USERNAME= EMAIL= PASSWORD= +# Optional second realm user for multi-client testing (SSE: one user edits, +# the other sees the change live without refreshing). +USERNAME_2= +EMAIL_2= +PASSWORD_2= + # NOTE: if the password ends in punctuation (e.g. "?"), it IS part of the # password - type it exactly. # NOTE: the local Keycloak master-realm admin may not be the default diff --git a/AGENTS.md b/AGENTS.md index 9eab68a..b6b2a56 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,26 +10,28 @@ Guidelines for automated agents working in this repository. Shared rules: `bun` ## Commands -| Command | Notes | -| --------------------------- | ------------------------------------------------------------------------------------------- | -| `bun run dev` | `vp dev` | -| `bun run build` | `tsc -b && vp build` (typecheck IS included) | -| `bun run check` | format + lint + typecheck in one pass — run before committing | -| `bun run test` / `coverage` | Vitest 5 via `vp test`; single file: `bun run test -- src/App.test.tsx` | -| `bun run generate:graphql` | REQUIRED before build/test on fresh clone; regenerates git-ignored `src/graphql/generated/` | +| Command | Notes | +| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `bun run dev` | `vp dev` | +| `bun run build` | `tsc -b && vp build` (typecheck IS included) | +| `bun run check` | format + lint + typecheck in one pass — run before committing | +| `bun run test` / `coverage` | Vitest 5 via `vp test`; single file: `bun run test -- src/App.test.tsx`. Never run bare `bun test` — Bun's native runner has no Vitest API (`vi.hoisted`) or jsdom, so every suite fails. In IDEA, run the package.json scripts with a real Node/npm interpreter (Settings → search "Node"): with vite-plus's bundled bun as interpreter, the `test` script runs `bun test` and fails. `bun run test`, `vp test`, and plain `vitest run` all work. | +| `bun run generate:graphql` | REQUIRED before build/test on fresh clone; regenerates git-ignored `src/graphql/generated/` | ## Key Conventions -- **Structure**: feature-first — pages own their `api/`, `components/`, `hooks/` and colocated tests; components live in the feature that uses them and only graduate to `src/components/` when a second consumer appears (colocate-until-reuse). React context providers live in `src/providers/` (never `src/components/`); `src/components/` holds only shared renderable chrome beside generated `ui/`. Route trees are wrapped in `src/components/error-boundary.tsx` so a render error degrades to a recoverable card instead of a blank page. +- **Structure**: feature-first — pages own their `api/`, `components/`, `hooks/` and colocated tests; components live in the feature that uses them and only graduate to `src/components/` when a second consumer appears (colocate-until-reuse). React context providers live in `src/providers/` (never `src/components/`); `src/components/` holds only shared renderable chrome beside generated `ui/` — e.g. `src/components/permissions/` is a route-less header widget (ShieldCheck button → right-side Sheet) doing permission CRUD through Apollo (`usePermissionsGraphql.ts` documents; queries mount only while the sheet is open, mutations refetch the active list + size). That module is the app's ONLY permission data layer — the users page roles combobox consumes `usePermissionsListGraphql` from it (second consumer rule honored), never its own duplicate query. Route trees are wrapped in `src/components/error-boundary.tsx` so a render error degrades to a recoverable card instead of a blank page. - **Generated files**: `src/components/ui/**` (shadcn registry) and `src/graphql/generated/**` — never hand-edit; add components with `bunx --bun shadcn@latest add ` and update the installed-components table in `README.md` in the same change (Base UI style; `form` is a stub here — use `field` + react-hook-form + `zod`; multi-select uses the native `combobox` chips, not cmdk). - **Base UI API**: components use the `render` prop instead of Radix `asChild`; `DropdownMenuLabel` must sit inside `DropdownMenuGroup`; `Combobox` multi-select uses `ComboboxChips`/`ComboboxValue` children-fn + `useComboboxAnchor`. - **Design-system lint** (`@shadcn/lint` in the `lint` block): rules apply to all app code; only `src/components/ui/**` is exempt via `lint.overrides`. Restyling ui components (color/typography/spacing/shape) is an error — wrap ui components in your own components (`src/components/*.tsx` for shared, `src/pages//components/` for feature-local) and put spacing on plain wrapper divs; only `layout` classes are allowed on ui components. -- **Auth**: own `KeycloakProvider` (`src/providers/keycloak.tsx`) over `keycloak-js` — no `@react-keycloak/web`. Event-driven like `@react-keycloak/core`'s `createAuthProvider`: `onReady/onAuthSuccess/onAuthError/onAuthRefreshSuccess/onAuthRefreshError/onAuthLogout/onTokenExpired` are attached before a module-guarded single `init()` (keycloak-js throws on second init; StrictMode-safe). Auth state is derived from `authenticated && token && idToken`, never a cached boolean. A refresh error alone does NOT log the user out (transient network); only `onAuthLogout` (fired by `clearToken()` after a 400 from the token endpoint) flips to logged-out. `getAccessToken()` proactively `updateToken(60)`s before every RTK Query/Apollo request so idle-then-request never sends an expired token. The 15s init watchdog renders logged-out if the silent-SSO iframe never settles. -- **State**: Redux Toolkit store with persisted `counter` slice + `usersApi` (RTK Query, `/coroutine` REST, optimistic patches, `prepareHeaders` bearer). Roles come from GraphQL via Apollo 4 typed documents (`graphql` tag from `@/graphql/generated`). -- **Users page state lives in the URL** (`page/size/sort/desc` search params) — no effect loops; SSE (`useSimpleSSE`) triggers `usersApi` refetch. +- **Auth**: own `KeycloakProvider` (`src/providers/keycloak.tsx`) over `keycloak-js` — no `@react-keycloak/web`. Event-driven like `@react-keycloak/core`'s `createAuthProvider`: `onReady/onAuthSuccess/onAuthError/onAuthRefreshSuccess/onAuthRefreshError/onAuthLogout/onTokenExpired` are attached before a module-guarded single `init()` (keycloak-js throws on second init; StrictMode-safe). Auth state is derived from `authenticated && token && idToken`, never a cached boolean. A refresh error alone does NOT log the user out (transient network); only `onAuthLogout` (fired by `clearToken()` after a 400 from the token endpoint, or by `expireSession()` when a stream reports server-side revocation) flips to logged-out. `getAccessToken()` proactively `updateToken(60)`s before every RTK Query/Apollo request so idle-then-request never sends an expired token. The 15s init watchdog renders logged-out if the silent-SSO iframe never settles. On wake (`online`/tab-visible) the provider forces `updateToken(-1)` so a remotely killed session is detected even when the `logged_out` stream push missed it and the backstop would no-op on a still-fresh token. +- **State**: Redux Toolkit store with persisted `counter` slice + `usersApi` (RTK Query, `/coroutine` REST, optimistic patches, `prepareHeaders` bearer, `refetchOnFocus`/`refetchOnReconnect` — note `setupListeners()` alone does NOT enable those; the API must opt in). Roles come from GraphQL via Apollo 4 typed documents (`graphql` tag from `@/graphql/generated`). There is deliberately NO cross-feature redux event spine (`permission-events`/`permission-sync` were removed): the single permission data layer (`src/components/permissions/usePermissionsGraphql.ts`) serves both the widget and the roles combobox, and its mutations refetch the active shared documents via `refetchQueries` — no store plumbing needed. Users freshness after permission changes is signalled by the server alone: exactly ONE `USERS_SYNCED: ` SSE broadcast per permission mutation, emitted after the backend fan-out rewrites the embedded role snapshots in users — a local refetch at mutation time would race that async sync, so there is none; the NotificationsProvider invalidation is action-agnostic so it just works. Design decision (deliberate, not an oversight): lifecycle/SYNCED events are cache-invalidation hints, never state transfer — losing one (e.g. BE crash between Mongo commit and Kafka publish, no outbox) only delays convergence, which the backstops bound: `onConnect` revalidation after a stream gap, `refetchOnFocus`/reconnect, `cache-and-network` on widget reopen. If a consumer ever needs the events for real work (audit, sync job), that consumer requires a transactional outbox on the BE — hint semantics do not extend to state-carrying consumers. +- **Users page state lives in the URL** (`page/size/sort/desc` search params) — no effect loops; `update` broadcasts from the app-level stream invalidate `usersApi` tags (refetch even when the page isn't mounted). +- **Backend-down UX is per-component, never global state**: there is deliberately NO `backendHealth` redux slice or polling probe (an earlier one was removed as over-engineering — the query caches already know). Each surface that needs the BE renders its own failure from its own query error. Copy is short and generic — "Something went wrong" + Try again everywhere (no "check the backend" operational advice: useless to a production user); a failed REFRESH with cached rows keeps the table with "The data may be out of date." + Retry (note: on refetch failure RTK moves rows to `previousData` — read `data ?? previousData`, never throw away usable data). Never a bare "Not Found" swap, never toast spam. Recovery is user-driven per surface (Try again/Retry refetches; the SSE bar keeps its own Reconnect). +- **Streams**: the live-updates stream is app-level — `src/providers/notifications.tsx` owns the single `useSimpleSSE` connection (`src/hooks/useSseUsers.ts`, graduated from the users feature when the provider became a second consumer), gated on `authenticated`: connects on login, closes on logout, resolves a fresh token per (re)connect. `/update/user` is a **fetch-based SSE client with the bearer header** — no EventSource (it can't send headers), no ticket, no credential in any URL (BE ADR-0007; the FE has no ticket lib at all — if a chat/WS client is ever built, mirror the handshake from the backend's `web/chat.html` + `POST /ws-ticket`). Overlapping attempts are superseded by a generation counter — only the newest opens a stream, stale in-flight attempts are aborted. Liveness: the server heartbeats every 10 s and the hook runs a 45 s silence watchdog — a half-open stream that never errors still gets recycled through the normal backoff. Termination contract: `token_expired` → refresh + reconnect immediately; `logged_out` → stop forever + `expireSession()` (clears the local session via `keycloak.clearToken()` → `onAuthLogout`, so `ProtectedRoute` locks EVERY route at once — instant remote-logout detection). Idle-token expiry is server-enforced: the stream's connect-time token `exp` passing fires `token_expired` even if the client-side refresh never ran. After sleep/offline the retry budget can park the stream in `disconnected` — the hook auto-recovers (fresh token) on `online`/tab-visible, never resurrecting a `logged_out` stream. - **Responsive**: wide content (the users table) must scroll inside the ui Table's own `overflow-x-auto` wrapper, never stretch the page. The ancestor chain has to be shrinkable: `grid-cols-1` (minmax(0,1fr)) on page grids and `min-w-0 w-full` on flex-col ancestors (see `App.tsx`, `Users.tsx`, `data-table.tsx`). Verified 0 horizontal overflow at 375/390/768/1024/1280; body scrolls vertically when content exceeds the viewport; header is sticky. - **Formatting**: Oxfmt (double quotes, 80 cols). `vp fmt` may reformat `graphql` template literals — always run `bun run generate:graphql` after `vp check --fix`, then typecheck. -- **Tests**: Vitest + RTL + MSW v3 (`server.listen()` — no `onUnhandledRequest`); jsdom lacks `matchMedia`/`EventSource` (stubbed in `src/setupTests.ts`). Apollo `MockedProvider` from `@apollo/client/testing/react`; import DocumentNodes from `@/graphql/generated/graphql` (index only exports the `graphql` tag). +- **Tests**: Vitest + RTL + MSW v3 (`server.listen()` — no `onUnhandledRequest`); jsdom lacks `matchMedia` (stubbed in `src/setupTests.ts`; the SSE hook's `fetch`/streams are faked in `useSseUsers.test.tsx`). Apollo `MockedProvider` from `@apollo/client/testing/react`; import DocumentNodes from `@/graphql/generated/graphql` (index only exports the `graphql` tag). ## Gotchas @@ -46,9 +48,18 @@ Backend stack: `spring-reactive-mongo-template` dev-infra (Keycloak `http://loca **Env**: committed `.env` holds local-dev defaults (`VITE_APP_DOMAIN`/`_KEYCLOAK_URL`/`_BACKEND_URL`); `.env.template` documents all variables, `.env.*` files (incl. `.env.production`) are git-ignored. Values are inlined at build time — rebuild after changing them, and keep `VITE_APP_DOMAIN` registered in the Keycloak client's redirect/web origins. -**Credentials**: the git-ignored `.credentials` file at the repository root holds the real local Keycloak login (realm `app`, client `frontend`, user `user` / `user@user.com`). `.credentials.template` documents the format — copy it to `.credentials` and fill in values on a fresh clone. If `.credentials` is missing, stop and ask the developer; never guess, create it with real values, or reset passwords unless explicitly asked. Never print the password (watch for trailing punctuation — it is part of the password). +**Credentials**: the git-ignored `.credentials` file at the repository root holds the real local Keycloak logins (realm `app`, client `frontend`, user `user` / `user@user.com`, plus a second user `user2` via `USERNAME_2`/`EMAIL_2`/`PASSWORD_2` for multi-client testing — one user changes data, the other sees it live via SSE). `.credentials.template` documents the format — copy it to `.credentials` and fill in values on a fresh clone. For authenticated browser/E2E testing (Playwright), read the credentials from `.credentials`; if the file is missing, stop and ask the developer for credentials before running authenticated E2E — never guess, create it with real values, or reset passwords unless explicitly asked. Never print the password (watch for trailing punctuation — it is part of the password). Two concurrent sessions need isolated browser contexts (incognito-equivalent): tabs share the app's `localStorage` session, so a second tab is the same user. -Verified flows: login/logout redirect, silent-SSO restore, counter persistence, users CRUD + roles combobox + SSE badge, dark mode, pl/en switch, mobile sheet, 404/401 pages — all with zero console errors. +Verified flows: login/logout redirect, silent-SSO restore, counter persistence, users CRUD + roles combobox + SSE badge, SSE bearer subscribe + `USER_CREATED` event + refetch, cross-user live update (user creates/updates/deletes → `user2`'s table reflects it without reload, two isolated Playwright contexts — the stream broadcasts `USER_CREATED`/`USER_UPDATED`/`USER_DELETED` as `USER_: ` and the FE invalidation is action-agnostic), logout-elsewhere → `logged_out` (no reconnect), dark mode, pl/en switch, mobile sheet, 404/401 pages — all with zero console errors. Permissions widget E2E (real backend): open → list + `getPermissionsSize`, create → row appears via refetch, inline rename with `version` (no optimistic-lock conflict), delete → row disappears, roles combobox reflects the live permission set. Permission→users sync E2E: rename in the widget → users table role chips refetch on the `USERS_SYNCED` broadcast (there is deliberately NO local invalidation at mutation time — it would race the async fan-out); delete → chip disappears from assigned users; combobox shows the new name — the backend fan-out is async (~0.5s), so the widget queries use `cache-and-network` (cache-first showed stale rows on reopen). Cross-client fan-out E2E: renaming a permission held by 3 users produced exactly ONE `USERS_SYNCED: ` broadcast (no per-user USER_UPDATED spam), and both sessions' tables updated from that single event. Missed-broadcast E2E: SSE has no replay — with the stream parked `disconnected` (retry budget exhausted after a BE outage), an update made via REST stays stale in the watcher's cache; clicking **Reconnect** must catch it up, which the provider's `onConnect` → `invalidateTags` revalidation does (proven by a kill-BE/update/restart E2E and by `notifications.test.tsx`: invalidate-while-unmounted forces a fresh fetch on next mount, with a control showing the cache would otherwise serve). Note: if every data query hangs while introspection answers, the dev-infra `mongo_rs_primary` container is down or its WiredTiger volume needs `mongod --repair` after a Docker restart — note that repair ROLLS BACK unjournaled writes. + +## Verification — E2E is mandatory + +- Unit/integration tests are never the finish line. Every new feature or user-visible change must ALSO be driven end-to-end in a real browser (Playwright MCP) against the real stack before handoff: backend dev-infra up (check `mongo_rs_primary`), `bun run dev` on :3000, real login from `.credentials`. Claim "done" only after the flow actually worked in the browser — describe exactly what was exercised, and state plainly what was not. +- LOOK at the change like a designer would: take screenshots and compare against existing screens — spacing, alignment, padding, typography, hover/focus states. Known traps in this preset: `SheetContent`/`Dialog` carry no content padding of their own (children need `px-*`/`pb-*`); `flex-1` on a short list stretches an empty box (prefer content-sized + `mt-auto` footer); footers clipped at the sheet edge mean missing padding, not a viewport bug. +- Test responsiveness at 375/390, 768, 1024 and 1280 (resize the Playwright viewport): no horizontal page overflow, wide content scrolls inside its own wrapper, sticky header intact, and short viewports don't clip controls — force overflow (e.g. ~330px height) to prove scrollable regions scroll instead of pushing chrome offscreen. +- Exercise every state the change touches: loading, empty, error, dialogs/sheets open + close, form validation, dark mode, pl/en switch — not just the happy path. +- The console must be clean during the E2E run; the only acceptable noise is Keycloak's silent-SSO iframe sandbox warning. +- At handoff, report the E2E evidence (flows, viewport sizes, console state) alongside the unit-test results. ## Keeping This File Current diff --git a/README.md b/README.md index 5cd11d1..d059335 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,16 @@ Start the backend stack first (`spring-reactive-mongo-template` dev-infra), then Login via the user menu (top right). Real credentials live in the git-ignored `.credentials` file — copy `.credentials.template` and fill it in on a fresh clone. URLs come from the committed `.env` (all variables documented in `.env.template`; `.env.production` is generated by CI from repo secrets). +Live updates (`/users`) subscribe to `GET /update/user` with a bearer header — the client streams via `fetch` (no EventSource, no ticket, no credential in the URL). Reconnects always resolve a fresh token first (`getAccessToken()`), `token_expired` → refresh + reconnect, `logged_out` → the local session is expired, protected pages lock immediately and the stream never reconnects (see `src/hooks/useSseUsers.ts`). + ## Structure ``` src/ ├── components/ # shared chrome: nav, side-menu, user-dropdown, cookie-consent, │ │ # mode-toggle, loading-screen, spinner, error-boundary +│ ├── permissions/ # header widget: permission CRUD in a Sheet via Apollo GraphQL; +│ │ # usePermissionsGraphql.ts is the app's sole permission data layer │ └── ui/ # generated shadcn (base-nova) — do not hand-edit ├── graphql/ # schema.graphql + generated/ (codegen client preset; git-ignored) ├── lib/ # keycloak.ts, apollo.ts, utils (cn re-export) @@ -49,8 +53,8 @@ src/ │ ├── counter/ # RTK slice demo │ ├── home/ # landing card │ ├── error/ # 401 / 404 pages -│ └── users/ # RTK Query + GraphQL + SSE CRUD; owns its data-table, -│ # roles combobox and SSE status bar under components/ +│ └── users/ # RTK Query + SSE CRUD; owns its data-table, +│ # roles combobox (data from components/permissions) and SSE status bar ├── providers/ # keycloak.tsx (own Keycloak context), theme.tsx (light/dark/system) └── store/ # store + persisted counter slice + RTK Query api ``` diff --git a/src/App.test.tsx b/src/App.test.tsx index d75b8f8..2fe90c6 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -2,19 +2,24 @@ import type { ReactNode } from "react" import { Provider } from "react-redux" import { render, screen, waitFor } from "@testing-library/react" import { BrowserRouter } from "react-router-dom" -import { describe, expect, it, vi } from "vite-plus/test" +import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test" import App from "@/App" import { ThemeProvider } from "@/providers/theme" import { setupStore } from "@/store/store" +// Controllable auth state so the same App tree can be exercised as an +// authenticated and a logged-out visitor. +const kcState = vi.hoisted(() => ({ authenticated: true })) + vi.mock("@/providers/keycloak", () => ({ useKeycloak: () => ({ initialized: true, - authenticated: true, + authenticated: kcState.authenticated, login: vi.fn(), logout: vi.fn(), updateToken: vi.fn().mockResolvedValue(true), + expireSession: vi.fn(), }), KeycloakProvider: ({ children }: { children: ReactNode }) => children, keycloak: { token: "test-token" }, @@ -33,6 +38,15 @@ function renderApp() { ) } +beforeEach(() => { + kcState.authenticated = true + window.history.pushState({}, "", "/") +}) + +afterEach(() => { + window.history.pushState({}, "", "/") +}) + describe("App tests", () => { it("home renders with keycloak authorized", async () => { renderApp() @@ -52,3 +66,57 @@ describe("App tests", () => { }) }) }) + +describe("ProtectedRoute access control", () => { + it("denies a logged-out visitor the users page", async () => { + kcState.authenticated = false + window.history.pushState({}, "", "/users") + + renderApp() + + await waitFor(() => { + expect( + screen.getByRole("heading", { name: "Unauthorized" }) + ).toBeInTheDocument() + }) + expect(window.location.pathname).toBe("/unauthorized") + // No trace of the page: neither the table chrome nor its actions + expect( + screen.queryByRole("button", { name: /add user/i }) + ).not.toBeInTheDocument() + expect(screen.queryByText("Users Table")).not.toBeInTheDocument() + }) + + it("denies a logged-out visitor the counter page", async () => { + kcState.authenticated = false + window.history.pushState({}, "", "/counter") + + renderApp() + + await waitFor(() => { + expect( + screen.getByRole("heading", { name: "Unauthorized" }) + ).toBeInTheDocument() + }) + expect(window.location.pathname).toBe("/unauthorized") + }) + + it("keeps restricted menu items hidden while logged out", async () => { + kcState.authenticated = false + + renderApp() + + await waitFor(() => { + expect(screen.getByRole("link", { name: "Home" })).toBeInTheDocument() + }) + expect( + screen.queryByRole("link", { name: "Users" }) + ).not.toBeInTheDocument() + expect( + screen.queryByRole("link", { name: "Counter" }) + ).not.toBeInTheDocument() + }) + + // Authenticated /users rendering is covered hermetically in Users.test.tsx; + // mounting it here would reach the real backend. +}) diff --git a/src/App.tsx b/src/App.tsx index d8af35a..cf2c281 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,6 +12,7 @@ import { LoadingScreenMemo } from "@/components/loading-screen" import { ErrorBoundary } from "@/components/error-boundary" import { CookieConsent } from "@/components/cookie-consent" import { ModeToggle } from "@/components/mode-toggle" +import { PermissionsWidget } from "@/components/permissions/permissions-widget" import { useKeycloak } from "@/providers/keycloak" import { useTheme } from "@/providers/theme" import { @@ -106,6 +107,7 @@ function App() { + {authenticated ? : null}
diff --git a/src/components/nav-item.tsx b/src/components/nav-item.tsx index 3bf37b1..c6bcfbd 100644 --- a/src/components/nav-item.tsx +++ b/src/components/nav-item.tsx @@ -15,7 +15,7 @@ export function NavMenuItem({ item }: NavMenuItemProps) { const location = useLocation() return ( - + } diff --git a/src/components/permissions/permission-form.tsx b/src/components/permissions/permission-form.tsx new file mode 100644 index 0000000..14faea6 --- /dev/null +++ b/src/components/permissions/permission-form.tsx @@ -0,0 +1,94 @@ +import { useMemo } from "react" +import { type SubmitHandler, useForm } from "react-hook-form" +import { zodResolver } from "@hookform/resolvers/zod" +import { useTranslation } from "react-i18next" +import { z } from "zod" + +import { Button } from "@/components/ui/button" +import { + Field, + FieldError, + FieldGroup, + FieldLabel, +} from "@/components/ui/field" +import { Input } from "@/components/ui/input" +import { Textarea } from "@/components/ui/textarea" + +export interface PermissionFormValues { + name: string + description: string +} + +export interface PermissionFormProps { + initialName?: string + initialDescription?: string + onSubmit: (values: PermissionFormValues) => void + onCancel: () => void +} + +// Shared by the widget's create and inline-edit modes; mounted fresh per +// mode, so defaultValues are enough — no reset effect needed. +export function PermissionForm({ + initialName = "", + initialDescription = "", + onSubmit, + onCancel, +}: PermissionFormProps) { + const { t } = useTranslation("main") + + const schema = useMemo( + () => + z.object({ + name: z.string().min(2, t("permissions.name_validation")), + description: z.string(), + }), + [t] + ) + + const form = useForm({ + resolver: zodResolver(schema), + defaultValues: { name: initialName, description: initialDescription }, + }) + + const handleSubmit: SubmitHandler = (values) => { + onSubmit(values) + } + + return ( +
+ + + + {t("permissions.name")} + + + + + + + {t("permissions.description")} + +