2026-01-30 06:13:37 -03:00
|
|
|
import React from 'react';
|
|
|
|
|
import { cn } from '@/lib/utils';
|
|
|
|
|
import { useConfigStore } from '@/stores/useConfigStore';
|
2026-03-31 18:47:00 +03:00
|
|
|
import { useSessionUIStore } from '@/sync/session-ui-store';
|
2026-01-30 06:13:37 -03:00
|
|
|
import { useContextStore } from '@/stores/contextStore';
|
|
|
|
|
import { formatEffortLabel, getAgentDisplayName, getModelDisplayName } from './mobileControlsUtils';
|
|
|
|
|
|
|
|
|
|
interface StatusChipProps {
|
|
|
|
|
onClick: () => void;
|
|
|
|
|
className?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const StatusChip: React.FC<StatusChipProps> = ({ onClick, className }) => {
|
|
|
|
|
const {
|
|
|
|
|
currentModelId,
|
|
|
|
|
currentVariant,
|
|
|
|
|
currentAgentName,
|
|
|
|
|
getCurrentProvider,
|
|
|
|
|
getCurrentModelVariants,
|
|
|
|
|
getVisibleAgents,
|
|
|
|
|
} = useConfigStore();
|
2026-03-31 18:47:00 +03:00
|
|
|
const currentSessionId = useSessionUIStore((state) => state.currentSessionId);
|
2026-01-30 06:13:37 -03:00
|
|
|
const sessionAgentName = useContextStore((state) =>
|
|
|
|
|
currentSessionId ? state.getSessionAgentSelection(currentSessionId) : null
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const agents = getVisibleAgents();
|
|
|
|
|
const uiAgentName = currentSessionId ? (sessionAgentName || currentAgentName) : currentAgentName;
|
|
|
|
|
const agentLabel = getAgentDisplayName(agents, uiAgentName);
|
|
|
|
|
const currentProvider = getCurrentProvider();
|
|
|
|
|
const modelLabel = getModelDisplayName(currentProvider, currentModelId);
|
|
|
|
|
const hasEffort = getCurrentModelVariants().length > 0;
|
|
|
|
|
const effortLabel = hasEffort ? formatEffortLabel(currentVariant) : null;
|
2026-01-30 13:23:50 +02:00
|
|
|
const fullLabel = [agentLabel, modelLabel, effortLabel].filter(Boolean).join(' · ');
|
2026-01-30 06:13:37 -03:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={onClick}
|
|
|
|
|
className={cn(
|
2026-01-30 13:23:50 +02:00
|
|
|
'inline-flex min-w-0 items-center justify-center',
|
2026-02-04 01:14:10 -08:00
|
|
|
'rounded-md border border-border/50 px-1.5',
|
|
|
|
|
'text-[11px] font-medium text-foreground/80',
|
2026-02-01 18:29:34 +02:00
|
|
|
'focus:outline-none hover:bg-[var(--interactive-hover)]',
|
2026-01-30 06:13:37 -03:00
|
|
|
className
|
|
|
|
|
)}
|
2026-01-30 13:23:50 +02:00
|
|
|
style={{
|
2026-02-04 01:14:10 -08:00
|
|
|
height: '28px',
|
|
|
|
|
maxHeight: '28px',
|
|
|
|
|
minHeight: '28px',
|
2026-01-30 13:23:50 +02:00
|
|
|
}}
|
|
|
|
|
title={fullLabel}
|
2026-01-30 06:13:37 -03:00
|
|
|
>
|
2026-01-30 13:23:50 +02:00
|
|
|
<span className="shrink-0">{agentLabel}</span>
|
2026-02-04 01:14:10 -08:00
|
|
|
<span className="shrink-0 text-muted-foreground mx-0.5">·</span>
|
2026-01-30 13:23:50 +02:00
|
|
|
<span className="min-w-0 truncate">{modelLabel}</span>
|
|
|
|
|
{effortLabel && (
|
|
|
|
|
<>
|
2026-02-04 01:14:10 -08:00
|
|
|
<span className="shrink-0 text-muted-foreground mx-0.5">·</span>
|
2026-01-30 13:23:50 +02:00
|
|
|
<span className="shrink-0">{effortLabel}</span>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
2026-01-30 06:13:37 -03:00
|
|
|
</button>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default StatusChip;
|