Skip to content

Commit bfd6369

Browse files
committed
fix(web): keep locale on info page back link
The back link pointed at /, which now redirects through browser locale detection instead of always /it. Link to the current locale and match the localized href in the e2e specs.
1 parent 7e3b4d9 commit bfd6369

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

web/e2e/info.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test.describe("Info Page", () => {
2727

2828
test("should display back navigation button", async ({ page }) => {
2929
// Check that the back button (link to home) exists
30-
const backLink = page.locator('header a[href="/"]');
30+
const backLink = page.locator('header a[href^="/it"]');
3131
await expect(backLink).toBeVisible();
3232

3333
// Check that the back arrow SVG is present
@@ -73,7 +73,7 @@ test.describe("Info Page", () => {
7373
page,
7474
}) => {
7575
// Click the back button
76-
const backLink = page.locator('header a[href="/"]');
76+
const backLink = page.locator('header a[href^="/it"]');
7777
await backLink.click();
7878

7979
// Wait for navigation

web/src/app/[locale]/info/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { useEffect } from "react";
4-
import { useTranslations } from "@/lib/i18n";
4+
import { useTranslations, useLocale } from "@/lib/i18n";
55
import Link from "next/link";
66
import { useRestaurantStore } from "@/stores/restaurantStore";
77
import { LoadingScreen, ErrorScreen } from "@/components/ui/StatusScreen";
@@ -11,6 +11,7 @@ const DAYS = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday"
1111

1212
export default function InfoPage() {
1313
const t = useTranslations();
14+
const locale = useLocale();
1415
const { data, isLoading, error, loadRestaurant } = useRestaurantStore();
1516

1617
useEffect(() => {
@@ -37,7 +38,7 @@ export default function InfoPage() {
3738
<main className="min-h-screen bg-gray-100">
3839
<header className="bg-primary text-white p-4">
3940
<div className="flex items-center gap-4">
40-
<Link href="/" className="text-white">
41+
<Link href={`/${locale}`} className="text-white">
4142
<svg
4243
xmlns="http://www.w3.org/2000/svg"
4344
fill="none"

0 commit comments

Comments
 (0)