Alternating option for Unilateral exercises

This commit is contained in:
AG
2025-12-10 18:40:54 +02:00
parent 95a5e37748
commit 9243fec947
10 changed files with 59 additions and 8 deletions

View File

@@ -76,7 +76,7 @@ const History: React.FC<HistoryProps> = ({ lang }) => {
}
};
const handleUpdateSet = (setId: string, field: keyof WorkoutSet, value: number) => {
const handleUpdateSet = (setId: string, field: keyof WorkoutSet, value: number | string) => {
if (!editingSession) return;
const updatedSets = editingSession.sets.map(s =>
s.id === setId ? { ...s, [field]: value } : s
@@ -454,6 +454,26 @@ const History: React.FC<HistoryProps> = ({ lang }) => {
</div>
)}
</div>
{/* Side Selector - Full width on mobile, 1 col on desktop if space */}
{set.side && (
<div className="bg-surface-container-high rounded px-2 py-1 col-span-2 sm:col-span-1 border border-outline-variant/30">
<label className="text-[10px] text-on-surface-variant font-bold block mb-1">{t('unilateral', lang)}</label>
<div className="flex bg-surface-container-low rounded p-0.5">
{(['LEFT', 'RIGHT', 'ALTERNATELY'] as const).map((sideOption) => (
<button
key={sideOption}
onClick={() => handleUpdateSet(set.id, 'side', sideOption)}
className={`flex-1 text-[10px] py-1 rounded transition-colors ${set.side === sideOption
? 'bg-primary/10 text-primary font-bold'
: 'text-on-surface-variant hover:bg-surface-container'
}`}
>
{t(sideOption.toLowerCase() as any, lang).slice(0, 3)}
</button>
))}
</div>
</div>
)}
</div>
))}
</div>
@@ -466,8 +486,9 @@ const History: React.FC<HistoryProps> = ({ lang }) => {
</div>
</div>
</Modal>
)}
</div>
)
}
</div >
);
};

View File

@@ -106,6 +106,13 @@ const SetLogger: React.FC<SetLoggerProps> = ({ tracker, lang, onLogSet, isSporad
>
{t('left', lang)}
</button>
<button
onClick={() => setUnilateralSide('ALTERNATELY')}
className={`w-full text-center px-4 py-2 rounded-full text-sm font-medium transition-colors ${unilateralSide === 'ALTERNATELY' ? 'bg-tertiary-container text-on-tertiary-container' : 'text-on-surface-variant hover:bg-surface-container-high'
}`}
>
{t('alternately', lang) || 'Alternately'}
</button>
<button
onClick={() => setUnilateralSide('RIGHT')}
className={`w-full text-center px-4 py-2 rounded-full text-sm font-medium transition-colors ${unilateralSide === 'RIGHT' ? 'bg-secondary-container text-on-secondary-container' : 'text-on-surface-variant hover:bg-surface-container-high'