import { useState } from 'react' import { Modal } from '@deepseek-ai/dsh-client-ui-primitives' import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots' import type {} from '@deepseek-ai/dsh-client-ui-sidebar/client' import { NS } from './locales.ts' import css from './TokenUsageStatsAction.module.css' /** Full props for the sidebar footer usage-stats action. */ export type TokenUsageStatsActionProps = PropsRuntime<'sidebar.footer.action'> & PropsLocale /** Minimal bar-chart glyph used on the collapsed sidebar rail. */ function ChartGlyph({ size }: { size: number }) { return ( ) } /** * Sidebar footer trigger for the token usage dashboard. Clicking opens an * in-page modal that embeds the host-served dashboard page, so desktop users * stay in the same application window. * @param props - footer slot share (wide/rail state) plus the namespace translator. * @returns the trigger button and the controlled modal. */ export function TokenUsageStatsAction({ wide, t }: TokenUsageStatsActionProps) { const [open, setOpen] = useState(false) const label = t('label') return ( <> { setOpen(false) }} title={t('dialogTitle')} closeLabel={t('close')} className={css.dialog ?? ''} contentClassName={css.dialogBody ?? ''} >