droboticflow/src/components/AnnotationWorkModeToggle.tsx

36 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export function AnnotationWorkModeToggle({
enabled,
disabled,
onToggle,
}: {
enabled: boolean;
disabled: boolean;
onToggle: () => void;
}) {
return (
<div className="inline-flex items-center gap-2" role="group" aria-label="工作模式">
<span
className={`rounded-full border px-3 py-1 font-semibold ${enabled ? "border-emerald-500 bg-emerald-500/15 text-emerald-600" : "border-blue-500 bg-blue-500/15 text-blue-700 dark:text-blue-300"}`}
>
当前:{enabled ? "自动接取" : "手动接取"}
</span>
<button
type="button"
role="switch"
aria-label="自动接取连续工作"
aria-checked={enabled}
onClick={onToggle}
disabled={!enabled && disabled}
title={
enabled
? "停止后保留已领取任务与当前编辑"
: "手动模式仅在点击随机领取时领取新任务;开启后按任务池容量自动接取"
}
className="rounded border px-2 py-1 font-medium disabled:opacity-50"
>
{enabled ? "停止自动接取" : "开启自动接取"}
</button>
</div>
);
}