fix(web): 修正治理頁 tab 深連結
This commit is contained in:
@@ -25,7 +25,13 @@ import { QueueTab } from './tabs/queue-tab'
|
||||
import { AgentMarketTab } from './tabs/agent-market-tab'
|
||||
import { AutomationInventoryTab } from './tabs/automation-inventory-tab'
|
||||
|
||||
export default function GovernancePage({ params }: { params: { locale: string } }) {
|
||||
export default function GovernancePage({
|
||||
params,
|
||||
searchParams,
|
||||
}: {
|
||||
params: { locale: string }
|
||||
searchParams?: { tab?: string | string[] }
|
||||
}) {
|
||||
const t = useTranslations('governance')
|
||||
|
||||
const tabs: TabConfig[] = [
|
||||
@@ -35,6 +41,8 @@ export default function GovernancePage({ params }: { params: { locale: string }
|
||||
{ id: 'agent-market', label: t('tabs.agentMarket'), content: <AgentMarketTab /> },
|
||||
{ id: 'automation-inventory', label: t('tabs.automationInventory'), content: <AutomationInventoryTab /> },
|
||||
]
|
||||
const requestedTab = Array.isArray(searchParams?.tab) ? searchParams?.tab[0] : searchParams?.tab
|
||||
const defaultTab = tabs.some(tab => tab.id === requestedTab) ? requestedTab : 'slo'
|
||||
|
||||
return (
|
||||
<AppLayout locale={params.locale}>
|
||||
@@ -50,7 +58,7 @@ export default function GovernancePage({ params }: { params: { locale: string }
|
||||
|
||||
<IwoooSReadOnlyBridge />
|
||||
|
||||
<PageTabs tabs={tabs} defaultTab="slo" syncWithUrl={true} />
|
||||
<PageTabs tabs={tabs} defaultTab={defaultTab} syncWithUrl={true} />
|
||||
</AppLayout>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user