Browse Source

feat(profile): integrate internationalization for new workout button and update routing to improve user experience
feat(locales): add translations for new workout button in English and French locales

Mathias 1 month ago
parent
commit
b2ef5ab0f1
3 changed files with 13 additions and 3 deletions
  1. 5 3
      app/[locale]/profile/page.tsx
  2. 4 0
      locales/en.ts
  3. 4 0
      locales/fr.ts

+ 5 - 3
app/[locale]/profile/page.tsx

@@ -1,6 +1,7 @@
 "use client";
 import { useRouter } from "next/navigation";
 
+import { useI18n } from "locales/client";
 import { workoutSessionLocal } from "@/shared/lib/workout-session/workout-session.local";
 import { WorkoutSessionList } from "@/features/workout-session/ui/workout-session-list";
 import { WorkoutSessionHeatmap } from "@/features/workout-session/ui/workout-session-heatmap";
@@ -8,6 +9,7 @@ import { Button } from "@/components/ui/button";
 
 export default function ProfilePage() {
   const router = useRouter();
+  const t = useI18n();
 
   const sessions = typeof window !== "undefined" ? workoutSessionLocal.getAll() : [];
   const values: Record<string, number> = {};
@@ -23,10 +25,10 @@ export default function ProfilePage() {
   return (
     <div>
       <WorkoutSessionHeatmap until={until} values={values} />
-      <WorkoutSessionList onSelect={(id) => router.push(`/workout-builder?sessionId=${id}`)} />
+      <WorkoutSessionList onSelect={(id) => router.push(`/?sessionId=${id}`)} />
       <div className="mt-8 flex justify-center">
-        <Button onClick={() => router.push("/workout-builder")} size="large">
-          Nouvelle séance
+        <Button onClick={() => router.push("/")} size="large">
+          {t("profile.new_workout")}
         </Button>
       </div>
     </div>

+ 4 - 0
locales/en.ts

@@ -10,6 +10,10 @@ export default {
     invalid_credentials: "Invalid credentials or account does not exist",
   },
 
+  profile: {
+    new_workout: "New Workout",
+  },
+
   // Release Notes
   release_notes: {
     title: "What's New",

+ 4 - 0
locales/fr.ts

@@ -10,6 +10,10 @@ export default {
     invalid_credentials: "Identifiants invalides ou compte inexistant",
   },
 
+  profile: {
+    new_workout: "Nouvelle séance",
+  },
+
   // Release Notes
   release_notes: {
     title: "Nouveautés",