feat(spec-100): admin routes + translate cleanup + wrapper removal#23
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three structural cleanups landed in one wave:
1. Admin route consolidation
- Moved `(app)/api-keys/page.tsx` → `(app)/admin/api-keys/page.tsx`.
- Moved `(app)/webhooks/page.tsx` → `(app)/admin/webhooks/page.tsx`.
- Updated sidebar NavItem hrefs + active matchers to /admin/api-keys
and /admin/webhooks.
- Simplified ADMIN_PREFIXES from ["/admin","/api-keys","/webhooks"]
to just ["/admin"].
2. Translate components → @open-elements/ui
- Deleted local `components/translate-dialog.tsx`, `translate-button.tsx`,
and the translate-button test (lib carries equivalent tests).
- Updated four usage sites (company-detail, contact-detail,
company-comments, contact-comments) to import TranslateButton from
@open-elements/ui and wire in `configured` (from useTranslationConfig),
`onTranslate` (translateText), and the translations bundle.
3. Wrapper-file cleanup (finishes the spec-098 migration tail)
- Deleted pass-through wrappers:
- components/session-provider.tsx
- components/forbidden-page.tsx
- components/add-comment-dialog.tsx
- components/bearer-token-card.tsx (unused leftover)
- lib/roles.ts
- lib/forbidden-error.ts
and their tests under the same paths.
- Re-pointed every importer at `@open-elements/nextjs-app-layer`.
- `lib/api.ts`'s ForbiddenError import now resolves to the lib too.
Test fixtures: added `getTranslationSettings` + `translateText` to the
`@/lib/api` mock in `company-detail.test.tsx` and `contact-detail.test.tsx`
because the swap to the lib's TranslateButton means useTranslationConfig
runs inside these components.
Dependency bumps:
- @open-elements/ui: ^0.6.0 → ^0.8.0 (TranslateButton + TranslateDialog).
- @open-elements/nextjs-app-layer: ^0.1.0 → ^0.2.0 (admin /admin/* defaultRoute).
Verification (local, against file: checkouts of the two lib branches):
- `pnpm exec next build` exits 0; middleware-manifest matcher preserved.
- Test suite: 165 passing, 42 pre-existing companies/contacts-client
localStorage failures unchanged from main.
- grep -r "@/components/session-provider|@/components/forbidden-page|
@/components/add-comment-dialog|@/components/translate-button|
@/components/translate-dialog|@/lib/roles|@/lib/forbidden-error" src/
returns nothing.
- grep -r "translate-button|translate-dialog" src/ returns nothing.
- grep -r '"/api-keys"|"/webhooks"' src/ returns nothing.
CI on this PR will be red until the two paired lib PRs are merged and
published to npm (open-elements-ui#3 → 0.8.0, nextjs-app-layer#1 → 0.2.0).
After both releases, a `pnpm install` on this branch regenerates the
lockfile against the registry resolutions; push that as an additional
commit to turn CI green.
Closes #22
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three structural cleanups bundled into one wave of releases:
/api-keysand/webhooksunder/admin/*. Both are IT-ADMIN-gated and the sidebar already groups themwith the other admin pages; the URL now matches the role contract.
@open-elements/ui—TranslateButtonandTranslateDialogmove to the lib (see paired PRopen-elements-ui#3).
The five usage sites pass
configured,onTranslate, and thetranslations bundle as props.
spec 098 are deleted; every importer points directly at
@open-elements/nextjs-app-layer.Spec
specs/100-admin-routes-translate-cleanup/specs/100-admin-routes-translate-cleanup/design.mdspecs/100-admin-routes-translate-cleanup/behaviors.mdspecs/100-admin-routes-translate-cleanup/steps.mdChanges
Admin route move
(app)/api-keys/page.tsx→(app)/admin/api-keys/page.tsx(app)/webhooks/page.tsx→(app)/admin/webhooks/page.tsx(app)/layout.tsx: NavItem hrefs + active matchers →/admin/api-keysand
/admin/webhooks.ADMIN_PREFIXEScollapses to["/admin"].Translate swap (4 sites)
components/company-detail.tsxcomponents/contact-detail.tsxcomponents/company-comments.tsxcomponents/contact-comments.tsxEach:
import { TranslateButton } from "@open-elements/ui"+ inlineconfigured(viauseTranslationConfig),onTranslate(viatranslateText), and a translations bundle fromt.translation.*.Local
translate-dialog.tsxandtranslate-button.tsxdeleted.Wrapper deletions
components/session-provider.tsx@open-elements/nextjs-app-layercomponents/forbidden-page.tsx@open-elements/nextjs-app-layercomponents/add-comment-dialog.tsx@open-elements/nextjs-app-layercomponents/bearer-token-card.tsx(unused)lib/roles.ts@open-elements/nextjs-app-layerlib/forbidden-error.ts@open-elements/nextjs-app-layerlib/api.tsnow importsForbiddenErrordirectly from@open-elements/nextjs-app-layer.Dependency bumps
@open-elements/ui:^0.6.0→^0.8.0@open-elements/nextjs-app-layer:^0.1.0→^0.2.0Test coverage
file:../../open-elements-uiandfile:../../nextjs-app-layerto verify the integration).unchanged — same set as on
mainand on the previous spec PRs.getTranslationSettings+translateText(the swap to the lib'sTranslateButtonmeansuseTranslationConfigruns inside these components).Acceptance checks
grep -r "@/components/session-provider|@/components/forbidden-page|@/components/add-comment-dialog|@/components/translate-button|@/components/translate-dialog|@/lib/roles|@/lib/forbidden-error" src/→ zero matches.grep -r "translate-button|translate-dialog" src/→ zero matches.grep -r '"/api-keys"|"/webhooks"' src/→ zero matches..next/server/middleware-manifest.jsonmatcher unchanged (regressionguard for spec-098's production fix preserved).
CI dependency
CI on this PR is red until the two paired lib PRs are merged and
published to npm:
@open-elements/ui→0.8.0(open-elements-ui#3)@open-elements/nextjs-app-layer→0.2.0(nextjs-app-layer#1)After both libs are released, run
pnpm installon this branch once toregenerate
pnpm-lock.yamlagainst the registry resolutions, then push.CI will then pass.
Closes #22
🤖 Generated with Claude Code