Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | 3x 5x 3x 5x 1x 1x 1x 1x 1x | import type { TimerSnapshot } from '@shared/types'
export type TimerActionConfirmationRequest =
| { kind: 'startFocus' }
| { kind: 'skip' }
| { kind: 'startShortBreak'; minutes: number }
| { kind: 'startLongBreak'; minutes: number }
| { kind: 'startFocusWithTask'; taskTitle: string }
export interface TimerActionConfirmationCopy {
subtitle: string
title: string
body: string
confirmLabel: string
tone: 'danger'
}
export const shouldConfirmTimerAction = (snapshot: Pick<TimerSnapshot, 'status'>): boolean =>
snapshot.status === 'running' || snapshot.status === 'paused'
export const getTimerActionConfirmation = (
action: TimerActionConfirmationRequest
): TimerActionConfirmationCopy => {
switch (action.kind) {
case 'startFocus':
return {
subtitle: '计时确认',
title: '确认结束当前计时并开始新的专注吗?',
body: '当前计时将立即结束,且不会保留当前进度。',
confirmLabel: '仍然开始专注',
tone: 'danger'
}
case 'skip':
return {
subtitle: '计时确认',
title: '确认跳过当前阶段吗?',
body: '当前计时将立即结束,并返回待开始状态。',
confirmLabel: '确认跳过',
tone: 'danger'
}
case 'startShortBreak':
return {
subtitle: '计时确认',
title: '确认结束当前计时并开始短休吗?',
body: `当前计时将立即结束,并切换到 ${action.minutes} 分钟短休。`,
confirmLabel: '仍然开始短休',
tone: 'danger'
}
case 'startLongBreak':
return {
subtitle: '计时确认',
title: '确认结束当前计时并开始长休吗?',
body: `当前计时将立即结束,并切换到 ${action.minutes} 分钟长休。`,
confirmLabel: '仍然开始长休',
tone: 'danger'
}
case 'startFocusWithTask':
return {
subtitle: '计时确认',
title: `确认结束当前计时并开始任务「${action.taskTitle}」吗?`,
body: '当前计时将立即结束,并切换到该任务的新一轮专注。',
confirmLabel: '仍然开始专注',
tone: 'danger'
}
}
}
|