From b8d1880a95f9d717527811bede8f4edd910a8bbb Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Tue, 21 Jul 2026 13:19:35 -0700 Subject: [PATCH] improvement(emcn): consistent hugging tab bars via ChipModalTabs - Pin ChipModalTabs to w-fit so the segmented pill always hugs its tabs instead of stretching full-width when dropped into a flex column - Migrate the mothership settings tab bar off a hand-rolled full-width underline bar onto ChipModalTabs - Fix undefined --border-secondary token (fell back to currentColor) in mothership -> --border, matching the admin settings precedent --- .../components/mothership/mothership.tsx | 45 +++++++------------ .../src/components/chip-modal/chip-modal.tsx | 6 ++- 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/settings/components/mothership/mothership.tsx b/apps/sim/app/workspace/[workspaceId]/settings/components/mothership/mothership.tsx index 7c86d4721ff..b61f8353a24 100644 --- a/apps/sim/app/workspace/[workspaceId]/settings/components/mothership/mothership.tsx +++ b/apps/sim/app/workspace/[workspaceId]/settings/components/mothership/mothership.tsx @@ -1,7 +1,7 @@ 'use client' import { useCallback, useMemo, useState } from 'react' -import { Badge, Button, ChipInput, ChipSelect, cn, Label, Skeleton } from '@sim/emcn' +import { Badge, Button, ChipInput, ChipModalTabs, ChipSelect, Label, Skeleton } from '@sim/emcn' import { formatDateTime } from '@sim/utils/formatting' import { useQueryStates } from 'nuqs' import { AnthropicIcon, OpenAIIcon } from '@/components/icons' @@ -115,26 +115,11 @@ export function Mothership() { /> -
- {TABS.map((tab) => ( - - ))} -
+ ({ value: tab.id, label: tab.label }))} + value={activeTab} + onChange={(value) => setMothershipParams({ tab: value as MothershipTab })} + />
@@ -281,7 +266,7 @@ function OverviewTab({ )} {breakdown?.users && (
-
+
User ID Requests Cost @@ -296,7 +281,7 @@ function OverviewTab({ }) => (
{u.user_id} @@ -328,7 +313,7 @@ function OverviewTab({ {requests?.requests && (
-
+
Request ID Model Duration @@ -352,9 +337,9 @@ function OverviewTab({ }) => (
- + {r.request_id ?? '—'} @@ -452,7 +437,7 @@ function LicensesTab({ environment }: { environment: MothershipEnv }) {
{generatedKey && ( -
+

License key (only shown once):

@@ -479,7 +464,7 @@ function LicensesTab({ environment }: { environment: MothershipEnv }) { {data?.licenses && (
-
+
Name Validations Expiration @@ -498,7 +483,7 @@ function LicensesTab({ environment }: { environment: MothershipEnv }) { }) => (
{lic.name} @@ -529,7 +514,7 @@ function StatCard({ loading?: boolean }) { return ( -
+

{label}

{loading ? ( diff --git a/packages/emcn/src/components/chip-modal/chip-modal.tsx b/packages/emcn/src/components/chip-modal/chip-modal.tsx index e70d99f15e7..b722de672a2 100644 --- a/packages/emcn/src/components/chip-modal/chip-modal.tsx +++ b/packages/emcn/src/components/chip-modal/chip-modal.tsx @@ -237,6 +237,10 @@ export interface ChipModalTabsProps { * Reusing `ChipSwitch` keeps every tabbed modal visually identical to the * segmented toggles elsewhere in the app (e.g. the billing-period switch). * + * Pinned to `w-fit` so the pill always hugs its tabs: dropped directly into a + * flex column the `inline-flex` trough is otherwise blockified and stretched + * full-width by `align-items: stretch`. A caller-supplied width class still wins. + * * @example * ```tsx * @@ -262,7 +266,7 @@ function ChipModalTabs({ onChange={onChange} aria-label={ariaLabel} options={tabs.map((tab) => ({ value: tab.value, label: tab.label, icon: tab.icon }))} - className={className} + className={cn('w-fit', className)} /> ) }