11/**
2- * Jedno źródło prawdy: typ pomiaru ćwiczenia → które metryki zbieramy .
3- * Używane przez: formularz logowania (które inputy) i hook SetLog (czyszczenie pól spoza typu ).
2+ * Single source of truth: exercise tracking type → which metrics we collect .
3+ * Used by: the logging form (which inputs to show) and the SetLog hook (clearing fields outside the type ).
44 */
55
66export type MetricField = 'weight' | 'reps' | 'rir' | 'distanceM' | 'durationSec'
@@ -11,34 +11,34 @@ export type MetricMeta = {
1111 label : string
1212 placeholder : string
1313 numeric : boolean
14- // Pole złożone: wejście min + sek, w bazie suma sekund
14+ // Composite field: input in min + sec, stored in DB as total seconds
1515 composite ?: 'duration'
16- // Jednostki wejścia na froncie; w bazie wartość bazowa (factor = ile jednostek bazowych na 1 wybraną )
16+ // Front-end input units; stored in DB as base value (factor = how many base units per 1 selected unit )
1717 units ?: { default : string ; options : UnitOption [ ] }
1818}
1919
2020export const METRIC_FIELDS : Record < MetricField , MetricMeta > = {
21- weight : { label : 'Ciężar (kg)' , placeholder : 'ciężar ' , numeric : true } ,
22- reps : { label : 'Powtórzenia ' , placeholder : 'powtórzenia ' , numeric : false } ,
23- rir : { label : 'RIR' , placeholder : 'RIR (rezerwa )' , numeric : false } ,
24- distanceM : { label : 'Dystans (m)' , placeholder : 'dystans ' , numeric : true } ,
25- durationSec : { label : 'Czas ' , placeholder : 'minuty / sekundy ' , numeric : true , composite : 'duration' } ,
21+ weight : { label : 'Weight (kg)' , placeholder : 'weight ' , numeric : true } ,
22+ reps : { label : 'Reps ' , placeholder : 'reps ' , numeric : false } ,
23+ rir : { label : 'RIR' , placeholder : 'RIR (reserve )' , numeric : false } ,
24+ distanceM : { label : 'Distance (m)' , placeholder : 'distance ' , numeric : true } ,
25+ durationSec : { label : 'Duration ' , placeholder : 'minutes / seconds ' , numeric : true , composite : 'duration' } ,
2626}
2727
2828export const ALL_METRIC_FIELDS = Object . keys ( METRIC_FIELDS ) as MetricField [ ]
2929
3030export const TRACKING : Record < TrackingType , { label : string ; fields : MetricField [ ] } > = {
31- strength : { label : 'Siłowe ' , fields : [ 'weight' , 'reps' , 'rir' ] } ,
31+ strength : { label : 'Strength ' , fields : [ 'weight' , 'reps' , 'rir' ] } ,
3232 cardio : { label : 'Cardio' , fields : [ 'distanceM' , 'durationSec' ] } ,
3333}
3434
3535export const DEFAULT_TRACKING : TrackingType = 'strength'
3636
37- /** Lista pól dla danego typu (z fallbackiem do domyślnego ). */
37+ /** List of fields for the given type (with fallback to the default ). */
3838export const trackingFields = ( t ?: string | null ) : MetricField [ ] =>
3939 t && t in TRACKING ? TRACKING [ t as TrackingType ] . fields : TRACKING [ DEFAULT_TRACKING ] . fields
4040
41- /** Opcje selecta dla Payload. */
41+ /** Select options for Payload. */
4242export const trackingOptions = ( Object . keys ( TRACKING ) as TrackingType [ ] ) . map ( ( value ) => ( {
4343 label : TRACKING [ value ] . label ,
4444 value,
0 commit comments