Khunndev
Cursor
Light CountThings theme, settings drawer, and results dock UX.
d30af0c
Raw History Blame Contribute Delete
2.27 kB
import { Eye, Plus, SquareDashed, Tag, Trash2 } from 'lucide-react'
import { cn } from '../lib/utils'
import { t } from '../lib/i18n'
import type { Lang, ToolMode } from '../lib/types'
const TOOLS: {
id: ToolMode
icon: typeof Eye
labelKey: 'toolView' | 'toolDelete' | 'toolAdd' | 'toolReassign' | 'toolArea'
activeClass: string
}[] = [
{ id: 'view', icon: Eye, labelKey: 'toolView', activeClass: 'bg-[var(--text)] text-white' },
{ id: 'delete', icon: Trash2, labelKey: 'toolDelete', activeClass: 'bg-[var(--danger)] text-white' },
{ id: 'add', icon: Plus, labelKey: 'toolAdd', activeClass: 'bg-[var(--success)] text-white' },
{ id: 'reassign', icon: Tag, labelKey: 'toolReassign', activeClass: 'bg-[var(--info)] text-white' },
{ id: 'area', icon: SquareDashed, labelKey: 'toolArea', activeClass: 'bg-[#7c3aed] text-white' },
]
interface Props {
lang: Lang
tool: ToolMode
onToolChange: (tool: ToolMode) => void
}
export function ToolBar({ lang, tool, onToolChange }: Props) {
return (
<section>
<p className="ct-section-label mb-2 px-1">{t(lang, 'tools')}</p>
<div className="ct-card overflow-hidden p-1.5">
<div className="flex gap-1 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
{TOOLS.map(({ id, icon: Icon, labelKey, activeClass }) => {
const active = tool === id
return (
<button
key={id}
type="button"
className={cn(
'flex shrink-0 items-center gap-1.5 rounded-xl px-3.5 py-2 text-sm font-semibold transition-all duration-200 active:scale-[0.96]',
active
? `${activeClass} shadow-sm`
: 'text-[var(--text-dim)] active:bg-[var(--surface-2)]',
)}
onClick={() => onToolChange(id)}
>
<Icon size={15} strokeWidth={active ? 2.5 : 2} />
<span className={active ? 'opacity-100' : 'opacity-80'}>
{t(lang, labelKey)}
</span>
</button>
)
})}
</div>
</div>
</section>
)
}