Files
gymflow/types.ts

93 lines
2.2 KiB
TypeScript

export enum ExerciseType {
STRENGTH = 'STRENGTH', // Reps, Weight
CARDIO = 'CARDIO', // Duration, Distance
STATIC = 'STATIC', // Duration, Weight (optional)
BODYWEIGHT = 'BODYWEIGHT', // Reps, Weighted (optional)
HIGH_JUMP = 'HIGH_JUMP', // Height
LONG_JUMP = 'LONG_JUMP', // Distance
PLYOMETRIC = 'PLYOMETRIC' // Reps
}
export interface WorkoutSet {
id: string;
exerciseId: string;
exerciseName: string;
type: ExerciseType;
reps?: number;
weight?: number;
durationSeconds?: number;
distanceMeters?: number;
height?: number;
bodyWeightPercentage?: number; // Percentage of bodyweight used (e.g. 65 for pushups)
timestamp: number;
side?: 'LEFT' | 'RIGHT'; // For unilateral exercises
completed: boolean;
}
export interface WorkoutSession {
id: string;
startTime: number;
endTime?: number;
sets: WorkoutSet[];
note?: string;
userBodyWeight?: number;
planId?: string; // Link to a plan if used
planName?: string;
type: 'STANDARD' | 'QUICK_LOG';
}
export interface ExerciseDef {
id: string;
name: string;
type: ExerciseType;
defaultRestSeconds?: number;
bodyWeightPercentage?: number; // Default percentage
isArchived?: boolean;
isUnilateral?: boolean; // For exercises requiring separate left/right tracking
}
export interface PlannedSet {
id: string;
exerciseId: string;
exerciseName: string; // Denormalized for easier display
exerciseType: ExerciseType;
isWeighted: boolean; // Prompt specifically asked for this flag
}
export interface WorkoutPlan {
id: string;
name: string;
description?: string; // Prep instructions
steps: PlannedSet[];
}
export type TabView = 'TRACK' | 'PLANS' | 'HISTORY' | 'STATS' | 'AI_COACH' | 'PROFILE';
export type UserRole = 'ADMIN' | 'USER';
export type Language = 'en' | 'ru';
export interface UserProfile {
weight?: number;
height?: number;
gender?: 'MALE' | 'FEMALE' | 'OTHER';
birthDate?: number | string; // timestamp or ISO string
language?: Language;
}
export interface BodyWeightRecord {
id: string;
weight: number;
date: string; // ISO string
dateStr: string; // YYYY-MM-DD
}
export interface User {
id: string;
email: string;
role: UserRole;
profile: UserProfile;
isFirstLogin: boolean;
isBlocked?: boolean;
}