perf(model-pricing): move pricing tabs into page title
- place the model pricing tab switcher beside the page title instead of spanning the content area. - keep the switcher width tied to its labels while preserving spacing around title status content.
This commit is contained in:
@@ -70,7 +70,7 @@ function SettingsPageFrame(props: SettingsPageFrameProps) {
|
|||||||
<span className='truncate'>{props.title}</span>
|
<span className='truncate'>{props.title}</span>
|
||||||
<span
|
<span
|
||||||
ref={setTitleStatusContainer}
|
ref={setTitleStatusContainer}
|
||||||
className='inline-flex shrink-0'
|
className='inline-flex min-w-0 shrink-0 items-center'
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</SectionPageLayout.Title>
|
</SectionPageLayout.Title>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import { toast } from 'sonner'
|
|||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
||||||
import { ConfirmDialog } from '@/components/confirm-dialog'
|
import { ConfirmDialog } from '@/components/confirm-dialog'
|
||||||
import { resetModelRatios } from '../api'
|
import { resetModelRatios } from '../api'
|
||||||
|
import { SettingsPageTitleStatusPortal } from '../components/settings-page-context'
|
||||||
import { SettingsSection } from '../components/settings-section'
|
import { SettingsSection } from '../components/settings-section'
|
||||||
import { useUpdateOption } from '../hooks/use-update-option'
|
import { useUpdateOption } from '../hooks/use-update-option'
|
||||||
import { GroupRatioForm } from './group-ratio-form'
|
import { GroupRatioForm } from './group-ratio-form'
|
||||||
@@ -439,25 +440,35 @@ export function RatioSettingsCard({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const renderTabSwitcher = () => (
|
||||||
|
<TabsList className={`grid w-fit max-w-full ${tabsGridClass}`}>
|
||||||
|
{visibleTabs.map((tab) => (
|
||||||
|
<TabsTrigger key={tab} value={tab}>
|
||||||
|
{t(tabLabels[tab])}
|
||||||
|
</TabsTrigger>
|
||||||
|
))}
|
||||||
|
</TabsList>
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SettingsSection title={t(titleKey)}>
|
<>
|
||||||
{visibleTabs.length === 1 ? (
|
{visibleTabs.length === 1 ? (
|
||||||
renderTabContent(defaultTab)
|
<SettingsSection title={t(titleKey)}>
|
||||||
|
{renderTabContent(defaultTab)}
|
||||||
|
</SettingsSection>
|
||||||
) : (
|
) : (
|
||||||
<Tabs defaultValue={defaultTab} className='space-y-6'>
|
<Tabs defaultValue={defaultTab} className='space-y-6'>
|
||||||
<TabsList className={`grid w-full ${tabsGridClass}`}>
|
<SettingsPageTitleStatusPortal>
|
||||||
{visibleTabs.map((tab) => (
|
{renderTabSwitcher()}
|
||||||
<TabsTrigger key={tab} value={tab}>
|
</SettingsPageTitleStatusPortal>
|
||||||
{t(tabLabels[tab])}
|
|
||||||
</TabsTrigger>
|
|
||||||
))}
|
|
||||||
</TabsList>
|
|
||||||
|
|
||||||
{visibleTabs.map((tab) => (
|
<SettingsSection title={t(titleKey)}>
|
||||||
<TabsContent key={tab} value={tab}>
|
{visibleTabs.map((tab) => (
|
||||||
{renderTabContent(tab)}
|
<TabsContent key={tab} value={tab}>
|
||||||
</TabsContent>
|
{renderTabContent(tab)}
|
||||||
))}
|
</TabsContent>
|
||||||
|
))}
|
||||||
|
</SettingsSection>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -473,6 +484,6 @@ export function RatioSettingsCard({
|
|||||||
handleConfirm={handleConfirmReset}
|
handleConfirm={handleConfirmReset}
|
||||||
confirmText={t('Reset')}
|
confirmText={t('Reset')}
|
||||||
/>
|
/>
|
||||||
</SettingsSection>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user