Animate the ETA, hide delays, and tidy the order card actions
- Slide the "Ready in about" value when it changes (new EtaMessage) - Drop the "Running late" banner; delays only move the ETA now - Remove the cancel-info tooltip and its icon button - Shorten the steps toggle to "Steps" / "Hide" - Add icons and more padding to the order card action buttons Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+18
-6
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { formatDuration, formatEtaClock, formatEtaMessage } from '#/lib/format.ts'
|
||||
import { formatDuration, formatEtaClock, formatEtaParts } from '#/lib/format.ts'
|
||||
|
||||
describe('formatDuration', () => {
|
||||
it('rounds up to at least 1 minute', () => {
|
||||
@@ -39,16 +39,28 @@ describe('formatEtaClock', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('formatEtaMessage', () => {
|
||||
describe('formatEtaParts', () => {
|
||||
const noon = new Date(2026, 0, 15, 12, 0, 0)
|
||||
|
||||
it('shows the relative time at or under the 3 hour threshold', () => {
|
||||
expect(formatEtaMessage(34 * 60, noon)).toBe('Ready in about 34 min')
|
||||
expect(formatEtaMessage(3 * 60 * 60, noon)).toBe('Ready in about 3 hr')
|
||||
expect(formatEtaParts(34 * 60, noon)).toEqual({
|
||||
prefix: 'Ready in about',
|
||||
value: '34 min',
|
||||
})
|
||||
expect(formatEtaParts(3 * 60 * 60, noon)).toEqual({
|
||||
prefix: 'Ready in about',
|
||||
value: '3 hr',
|
||||
})
|
||||
})
|
||||
|
||||
it('shows the absolute time once the eta passes 3 hours', () => {
|
||||
expect(formatEtaMessage(3 * 60 * 60 + 60, noon)).toBe('Ready today, 03:01 PM')
|
||||
expect(formatEtaMessage(230 * 60, noon)).toBe('Ready today, 03:50 PM')
|
||||
expect(formatEtaParts(3 * 60 * 60 + 60, noon)).toEqual({
|
||||
prefix: 'Ready',
|
||||
value: 'today, 03:01 PM',
|
||||
})
|
||||
expect(formatEtaParts(230 * 60, noon)).toEqual({
|
||||
prefix: 'Ready',
|
||||
value: 'today, 03:50 PM',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user