Changeset 447c39f for frontend


Ignore:
Timestamp:
06/22/26 16:56:41 (2 weeks ago)
Author:
Andrej <asumanovski@…>
Branches:
master
Children:
194c016
Parents:
42da64d
Message:

Improved UI and small fixes

Location:
frontend
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • frontend/index.html

    r42da64d r447c39f  
    33  <head>
    44    <meta charset="UTF-8" />
    5     <link rel="icon" type="image/svg+xml" href="/vite.svg" />
     5    <link rel="icon" type="image/svg+xml" href="/favicon.png" />
    66    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    7     <title>frontend</title>
     7    <title>Trekr</title>
    88  </head>
    99  <body>
  • frontend/src/pages/Dashboard/pages/Discipline/DisciplineTracking.jsx

    r42da64d r447c39f  
    293293
    294294  const isTodayClosed = useMemo(() => {
     295    console.log('todayIso:', todayIso);
    295296    return (dailyCompletions ?? []).some((dc) => dc?.date === todayIso);
    296297  }, [dailyCompletions, todayIso]);
  • frontend/src/pages/Dashboard/pages/Finance/components/NewIncomeForm.jsx

    r42da64d r447c39f  
    44  const [date, setDate] = useState(() => {
    55    const d = new Date();
     6    console.log('Date:', d);
    67    return d.toISOString().slice(0, 10);
    78  });
  • frontend/src/pages/Dashboard/pages/Training/NewTrainingSession.jsx

    r42da64d r447c39f  
    1818  const [autoCalculateCalories, setAutoCalculateCalories] = useState(true);
    1919  const [calories, setCalories] = useState("");
     20  const [date, setDate] = useState(() => new Date().toISOString().slice(0, 10));
    2021
    2122  const [error, setError] = useState("");
     
    9596    }
    9697
     98    // Date must not be in the future (allow past or today)
     99    const todayStr = new Date().toISOString().slice(0, 10);
     100    if (!date || date > todayStr) {
     101      setError("Date cannot be in the future.");
     102      return;
     103    }
     104
    97105    const caloriesNum = calories === "" ? NaN : Number(calories);
    98106    if (!autoCalculateCalories) {
     
    108116        type,
    109117        durationMinutes: durationNum,
     118        date,
    110119        autoCalculateCalories,
    111120        calories: autoCalculateCalories ? null : caloriesNum,
     
    145154          ) : null}
    146155
    147           <div className="mt-4 grid grid-cols-1 gap-4 md:grid-cols-2">
     156          <div className="mt-4 grid grid-cols-1 gap-4 md:grid-cols-3">
    148157            <WorkoutTypeSelect
    149158              workoutTypes={workoutTypes}
     
    165174                disabled={isLoading}
    166175              />
     176            </div>
     177
     178            <div>
     179              <label className="label">Date</label>
     180              <input
     181                type="date"
     182                className="input input-bordered w-full"
     183                value={date}
     184                onChange={(e) => setDate(e.target.value)}
     185                max={new Date().toISOString().slice(0, 10)}
     186                required
     187                disabled={isLoading}
     188              />
     189              <p className="text-xs opacity-70 mt-1">Choose a past date or today (no future dates).</p>
    167190            </div>
    168191          </div>
Note: See TracChangeset for help on using the changeset viewer.