Skip to content

feat: shared setting components - shell, danger/warning zones#5456

Merged
ogzhanolguncu merged 9 commits intomainfrom
setting-danger-zones
Mar 26, 2026
Merged

feat: shared setting components - shell, danger/warning zones#5456
ogzhanolguncu merged 9 commits intomainfrom
setting-danger-zones

Conversation

@ogzhanolguncu
Copy link
Copy Markdown
Contributor

What does this PR do?

This PR, uses same type of Container(Shell) component to wrap settings pages. Also moves every danger/warning zone to a shared component.

Affected pages:

  • Billing settings
  • Project settings
  • Ratelimit settings
  • API Settings

Testing

Every page above should look good and consistent with each other. Also work without an issue

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 25, 2026

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

Project Deployment Actions Updated (UTC)
dashboard Ready Ready Preview, Comment Mar 26, 2026 2:19pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 88bf19f3-b021-43bc-a2df-9f7281cc40c8

📥 Commits

Reviewing files that changed from the base of the PR and between a90535a and ea4d181.

📒 Files selected for processing (1)
  • web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/page.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/page.tsx

📝 Walkthrough

Walkthrough

Adds new settings UI primitives (SettingsShell, SettingsZone, SettingsDangerZone, SettingsZoneRow) and refactors many dashboard, project, ratelimit, and billing settings pages to use them; removes many explicit SettingCard border props and consolidates delete/cancel flows into zone/row patterns and dialog-managed actions.

Changes

Cohort / File(s) Summary
New Settings UI Primitives
web/internal/ui/src/components/settings-card.tsx
Added SettingsShell, SettingsZone, SettingsDangerZone, SettingsZoneRow; introduced zone context/theming and row action button wiring; adjusted description text styling and Button imports.
API Settings — Minor Styling/Borders
web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/copy-key-space-id.tsx, .../default-bytes.tsx, .../default-prefix.tsx, .../update-api-name.tsx, .../update-ip-whitelist.tsx
Removed SettingCard border props (top/bottom/both) and minor button size/padding tweak in IP whitelist component.
API Settings — Danger/Delete Flows
web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/delete-api.tsx, .../delete-protection.tsx
Replaced SettingCard layouts with SettingsZoneRow/danger-zone patterns; consolidated description rendering; normalized badge props; simplified dialog/button color logic.
API Settings — Page Layout & Skeleton
web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/settings-client.tsx, .../skeleton.tsx
Wrapped page in SettingsShell/SettingCardGroup; simplified skeleton to compact placeholders and updated layout to new primitives.
Project Settings — Delete & Layout
web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/components/delete-project.tsx, .../page.tsx, .../openapi-diff/page.tsx
Switched delete UI to SettingsDangerZone/SettingsZoneRow; replaced local wrapper with SettingsShell on applicable pages.
Rate Limit Settings
web/apps/dashboard/app/(app)/[workspaceSlug]/ratelimits/[namespaceId]/settings/components/settings-client.tsx, .../skeleton.tsx
Replaced custom wrapper/border orchestration with SettingsShell/SettingCardGroup; moved delete action into SettingsDangerZone; simplified skeleton.
Billing Settings — Page & Layout
web/apps/dashboard/app/(app)/[workspaceSlug]/settings/billing/client.tsx, .../page.tsx
Replaced local Shell with SettingsShell; regrouped billing cards into SettingCardGroup; integrated cancel flows into SettingsDangerZone; adjusted placement of usage and billing portal.
Billing Settings — Component Changes
web/apps/dashboard/app/(app)/[workspaceSlug]/settings/billing/components/cancel-alert.tsx, .../cancel-plan.tsx, .../current-plan-card.tsx, .../usage.tsx, .../components/shell.tsx
Converted cancel alert/plan flows to zone/row/dialog-managed patterns; added dialog state for cancel; inlined plan display and removed ProductHelper; removed ProgressCircle and adjusted card borders and button styles; removed local Shell component export.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete. While it mentions the purpose and affected pages, it lacks required sections: specific issue reference, type of change checkbox, detailed testing instructions, and missing checklist items from the template. Add issue reference, select appropriate type of change checkboxes, provide detailed step-by-step testing instructions for each affected page, and complete all required checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main changes: introducing shared setting components for shell layouts and danger/warning zones across multiple settings pages.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 setting-danger-zones

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

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 (1)
web/internal/ui/src/components/settings-card.tsx (1)

250-251: Avoid implicit danger fallback when SettingsZoneRow is outside a provider.

Defaulting SettingsZoneContext to "danger" silently renders destructive styling if SettingsZoneRow is used without SettingsZone. Prefer a nullable context and explicit guard.

♻️ Proposed type-safe guard
-type SettingsZoneContext = React.createContext<SettingsZoneVariant>("danger");
+const SettingsZoneContext = React.createContext<SettingsZoneVariant | null>(null);

 function SettingsZoneRow({
   title,
   description,
   action,
 }: {
   title: React.ReactNode;
   description: React.ReactNode;
   action: SettingsZoneAction;
 }) {
   const zoneVariant = React.useContext(SettingsZoneContext);
+  if (!zoneVariant) {
+    throw new Error("SettingsZoneRow must be used within SettingsZone");
+  }
   const btnProps = zoneButtonProps[zoneVariant];

As per coding guidelines, "Make illegal states unrepresentable by modeling domain with discriminated unions and parsing inputs at boundaries into typed structures."

Also applies to: 321-323

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/internal/ui/src/components/settings-card.tsx` around lines 250 - 251,
SettingsZoneContext currently defaults to "danger", causing silent destructive
styling when SettingsZoneRow is rendered outside a provider; change the context
type to SettingsZoneVariant | null (make SettingsZoneContext default null) and
update consumers (e.g., SettingsZoneRow) to explicitly guard for a null value
and throw or render a safe fallback if no provider (refer to
SettingsZoneContext, SettingsZoneVariant, SettingsZoneRow, and SettingsZone),
ensuring the illegal state is made unrepresentable by failing fast instead of
implicitly using "danger".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@web/apps/dashboard/app/`(app)/[workspaceSlug]/apis/[apiId]/settings/components/delete-protection.tsx:
- Line 98: The button color is inverted: it currently sets
color={api.deleteProtection ? "warning" : "danger"}, making the "Enable" action
red; update the color logic so enabling protection (when api.deleteProtection is
falsy) uses a positive color (e.g., "success") and disabling uses "warning".
Locate the JSX in the DeleteProtection component (the button that reads the
api.deleteProtection prop) and change the ternary to map falsy -> "success" and
truthy -> "warning" so enabling is green and disabling remains a cautionary
color.

In `@web/apps/dashboard/app/`(app)/[workspaceSlug]/settings/billing/client.tsx:
- Around line 99-103: The subscription.status is being force-cast to
Stripe.Subscription.Status; fix this by updating the zod schema
(subscriptionSchema used by getBillingInfo) so status is validated as the
concrete Stripe subscription status values (e.g., replace z.string() with a
z.enum or union of the exact Stripe.Subscription.Status literals),
regenerate/infer the types from that schema so the returned type from
getBillingInfo reflects the exact union, and then remove the `as
Stripe.Subscription.Status` cast where SubscriptionStatus is rendered.

In `@web/internal/ui/src/components/settings-card.tsx`:
- Around line 349-353: The SettingsShell's main element currently hardcodes a
large fixed width via the "w-225" utility (in the className passed to the main
element in settings-card.tsx), which causes horizontal overflow on narrow
viewports; replace the fixed width with responsive sizing such as using "w-full"
combined with a max-width utility (e.g., "max-w-[...]" or Tailwind tokens like
"max-w-3xl/4xl" and responsive breakpoints like "sm:", "md:") so the main
container uses full available width on small screens but caps at a sensible max
on larger screens; update the className passed to the main element (and any
usage in the SettingsShell component) to "w-full" plus the chosen responsive
max-width utilities and remove "w-225".

---

Nitpick comments:
In `@web/internal/ui/src/components/settings-card.tsx`:
- Around line 250-251: SettingsZoneContext currently defaults to "danger",
causing silent destructive styling when SettingsZoneRow is rendered outside a
provider; change the context type to SettingsZoneVariant | null (make
SettingsZoneContext default null) and update consumers (e.g., SettingsZoneRow)
to explicitly guard for a null value and throw or render a safe fallback if no
provider (refer to SettingsZoneContext, SettingsZoneVariant, SettingsZoneRow,
and SettingsZone), ensuring the illegal state is made unrepresentable by failing
fast instead of implicitly using "danger".

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2f05dd5e-c3c3-4e85-b463-e7a6bd1be513

📥 Commits

Reviewing files that changed from the base of the PR and between 9078f08 and bcf6789.

📒 Files selected for processing (22)
  • web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/copy-key-space-id.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/default-bytes.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/default-prefix.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/delete-api.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/delete-protection.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/settings-client.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/skeleton.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/update-api-name.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/update-ip-whitelist.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/openapi-diff/page.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/components/delete-project.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/page.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/ratelimits/[namespaceId]/settings/components/settings-client.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/ratelimits/[namespaceId]/settings/components/skeleton.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/settings/billing/client.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/settings/billing/components/cancel-alert.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/settings/billing/components/cancel-plan.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/settings/billing/components/current-plan-card.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/settings/billing/components/shell.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/settings/billing/components/usage.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/settings/billing/page.tsx
  • web/internal/ui/src/components/settings-card.tsx
💤 Files with no reviewable changes (6)
  • web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/update-api-name.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/default-prefix.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/copy-key-space-id.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/settings/billing/components/shell.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/settings/billing/components/usage.tsx
  • web/apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/settings/components/default-bytes.tsx

@ogzhanolguncu ogzhanolguncu added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 804ff16 Mar 26, 2026
19 checks passed
@ogzhanolguncu ogzhanolguncu deleted the setting-danger-zones branch March 26, 2026 14:27
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