// Burst mode — fullscreen Pomodoro takeover.
// Locks the user to ONE task. Big clock. Calm dark space.
// ADHD pattern: kill the dashboard, one thing, time-boxed.
function BurstMode() {
const { state, closeBurst, pauseBurst, tickBurst, toggleTask, startBurst, setBurstLength } = useStore();
const b = state.burst;
if (!b.active) return null;
// Find the task being focused on
const priority = state.priorities.find((p) => p.id === b.priorityId);
const task = priority?.tasks.find((t) => t.id === b.taskId);
// ticker
React.useEffect(() => {
if (!b.running) return;
const id = setInterval(tickBurst, 1000);
return () => clearInterval(id);
}, [b.running, tickBurst]);
// ESC to close
React.useEffect(() => {
const k = (e) => { if (e.key === 'Escape') closeBurst(); };
window.addEventListener('keydown', k);
return () => window.removeEventListener('keydown', k);
}, [closeBurst]);
const mins = Math.floor(b.remaining / 60);
const secs = b.remaining % 60;
const timeLabel = `${String(mins).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
const pct = b.length > 0 ? 1 - b.remaining / b.length : 0;
const r = 150;
const C = 2 * Math.PI * r;
const dashOffset = C * (1 - pct);
const finished = b.remaining === 0;
return (
{priority?.tag || 'focus'}
{task ? task.label : (priority?.title || 'Pick a task to focus on')}
{priority && (
From priority · {priority.title}
)}
{timeLabel}
{finished ? 'finished — well done' : (b.running ? 'in flow' : 'paused')}
{finished ? (
<>
>
) : (
<>
{task && (
)}
>
)}
{b.completedToday}
bursts today
{b.streakDays}
day streak
{Math.round(b.completedToday * b.length / 60)}m
focused
{priority && priority.tasks.length > 1 && (
up next in this priority
{priority.tasks.filter((t) => !t.done && t.id !== b.taskId).slice(0, 3).map((t) => (
startBurst(priority.id, t.id, b.length)}>
{t.label}
))}
)}
);
}
function BurstLengthPicker({ length, setLength }) {
const opts = [
{ v: 25 * 60, label: '25' },
{ v: 30 * 60, label: '30' },
{ v: 45 * 60, label: '45' },
{ v: 52 * 60, label: '52' },
];
return (
{opts.map((o) => (
))}
);
}
Object.assign(window, { BurstMode });