Merge feat/history: Uebungsverlauf aus dem ⋯-Menue (#43)
# Conflicts: # frontend/src/sheets.jsx
This commit is contained in:
commit
1f47d5015c
21 files changed
+423
-5
No files matched your search
@@ -12,7 +12,7 @@ import { t, exerciseNameFor } from '../lib/i18n.js'
|
||||
import { api } from '../lib/api.js'
|
||||
import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor } from '../lib/supersetFlow.js'
|
||||
import Media from '../components/Media.jsx'
|
||||
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet, swapActiveWorkoutExercise, barWeightSheet, menuSheet, effortPickerSheet } from '../sheets.jsx'
|
||||
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet, swapActiveWorkoutExercise, barWeightSheet, menuSheet, effortPickerSheet, exerciseHistorySheet } from '../sheets.jsx'
|
||||
import { effortColor } from '../lib/effort.js'
|
||||
import Icon from '../components/Icon.jsx'
|
||||
import { Button, Check, NumberField } from '../components/ui.jsx'
|
||||
@@ -183,6 +183,7 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
items: [
|
||||
{ icon: 'pencil', label: entry.note ? t('Edit note') : t('Add note'), sub: entry.note || undefined, onClick: () => exerciseNoteSheet(entryIdx) },
|
||||
{ icon: 'info', label: t('Details'), onClick: () => exerciseDetailSheet(ex) },
|
||||
{ icon: 'history', label: t('History'), sub: last ? t('Last time') + ' ' + fmtDate(last.d) : undefined, onClick: () => exerciseHistorySheet(entry.id) },
|
||||
onProgressionSettings && { icon: 'chartLine', label: t('Progression settings'), sub: guidance ? t(guidance.policyLabel) : undefined, onClick: onProgressionSettings },
|
||||
barInfo && { icon: 'barbell', label: t('Bar weight'), sub: barInfo.text, onClick: () => barWeightSheet(entry.id) },
|
||||
{ icon: 'flame', label: t('Add warm-up set'), onClick: onAddWarmup },
|
||||
|
||||
@@ -23,6 +23,7 @@ const mocks = vi.hoisted(() => {
|
||||
swapActiveWorkoutExercise: vi.fn(),
|
||||
menuSheet: vi.fn(),
|
||||
effortPickerSheet: vi.fn(),
|
||||
exerciseHistorySheet: vi.fn(),
|
||||
}
|
||||
state.stopRest = vi.fn(() => { state.timer = null })
|
||||
state.stopWork = vi.fn(() => { state.work = null })
|
||||
@@ -76,6 +77,7 @@ vi.mock('../sheets.jsx', () => ({
|
||||
exerciseNoteSheet: vi.fn(),
|
||||
sessionNoteSheet: vi.fn(),
|
||||
effortPickerSheet: mocks.effortPickerSheet,
|
||||
exerciseHistorySheet: mocks.exerciseHistorySheet,
|
||||
}))
|
||||
vi.mock('../components/Media.jsx', () => ({ default: () => null }))
|
||||
// api.js reads navigator.userAgent at module scope. This file installs its own DOM inside the
|
||||
@@ -1109,6 +1111,16 @@ describe('workout controls: the more menu and the set menu', () => {
|
||||
expect(mocks.confirmSheet).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('opens the exercise history sheet from the More menu, for the tapped exercise', async () => {
|
||||
// the screen shows one exercise at a time, so "the tapped exercise" is the current one
|
||||
await mount([exercise('plain-bench', [false]), exercise('plain-row', [false])], 1)
|
||||
await act(async () => { container.querySelector('button[aria-label="More"]').dispatchEvent(new dom.Event('click', { bubbles: true })) })
|
||||
const history = item('History')
|
||||
expect(history.icon).toBe('history')
|
||||
history.onClick()
|
||||
expect(mocks.exerciseHistorySheet).toHaveBeenCalledWith('plain-row')
|
||||
})
|
||||
|
||||
it('opens a per-set menu from the set number with drop, burst and remove', async () => {
|
||||
await mount([exercise('plain-bench', [false, false])])
|
||||
await act(async () => { container.querySelector('button[aria-label="Set 2"]').dispatchEvent(new dom.Event('click', { bubbles: true })) })
|
||||
|
||||
Reference in new issue
Block a user