Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/app/[locale]/[...rest]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { notFound } from "next/navigation";

export default function CatchAllPage() {
notFound();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PageBreadcrumb } from "@/components/page-breadcrumb";
import type { Metadata, ResolvingMetadata } from "next";
import { getTranslations } from "next-intl/server";
import { PropsWithChildren } from "react";
import type { PropsWithChildren } from "react";

export async function generateMetadata(
{},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PageBreadcrumb } from "@/components/page-breadcrumb";
import type { Metadata, ResolvingMetadata } from "next";
import { getTranslations } from "next-intl/server";
import { PropsWithChildren } from "react";
import type { PropsWithChildren } from "react";

export async function generateMetadata(
{},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PageBreadcrumb } from "@/components/page-breadcrumb";
import type { Metadata, ResolvingMetadata } from "next";
import { getTranslations } from "next-intl/server";
import { PropsWithChildren } from "react";
import type { PropsWithChildren } from "react";

export async function generateMetadata(
{},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PageBreadcrumb } from "@/components/page-breadcrumb";
import type { Metadata, ResolvingMetadata } from "next";
import { getTranslations } from "next-intl/server";
import { PropsWithChildren } from "react";
import type { PropsWithChildren } from "react";

export async function generateMetadata(
{},
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PageBreadcrumb } from "@/components/page-breadcrumb";
import type { Metadata, ResolvingMetadata } from "next";
import { getTranslations } from "next-intl/server";
import { PropsWithChildren } from "react";
import type { PropsWithChildren } from "react";

export async function generateMetadata(
{},
Expand Down
File renamed without changes.
75 changes: 75 additions & 0 deletions src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { CookieToast } from "@/components/cookie/cookie-toast";
import { MainHeader } from "@/components/main-header";
import { Navbar } from "@/components/navbar";
import { ThemeProvider } from "@/components/theme-provider";
import { DrawerWrapper } from "@/components/ui/drawer";
import { Toaster } from "@/components/ui/sonner";
import { routing } from "@/i18n/routing";
import { cn } from "@/lib/utils";
import type { Metadata } from "next";
import { NextIntlClientProvider } from "next-intl";
import {
getMessages,
getTranslations,
setRequestLocale,
} from "next-intl/server";
import { Inter as FontSans } from "next/font/google";
import { notFound } from "next/navigation";
import type { PropsWithChildren } from "react";

import "../globals.css";

const fontSans = FontSans({
subsets: ["latin"],
variable: "--font-sans",
});

export function generateStaticParams() {
return routing.locales.map((locale) => ({ locale }));
}

export async function generateMetadata(): Promise<Metadata> {
const t = await getTranslations("organization");

return {
title: t("name"),
description: t("description"),
};
}

export default async function RootLayout({
children,
params: { locale },
}: Readonly<PropsWithChildren<{ params: { locale: string } }>>) {
if (!routing.locales.includes(locale as any)) {
notFound();
}

setRequestLocale(locale);

const messages = await getMessages();

return (
<html lang={locale} className="scroll-smooth" suppressHydrationWarning>
<body
className={cn(
"min-h-screen bg-background font-sans antialiased",
fontSans.variable,
)}
>
<NextIntlClientProvider messages={messages}>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
<DrawerWrapper>
<MainHeader nav={<Navbar />} />
<main className="container pt-8 mx-auto px-4 prose dark:prose-invert">
{children}
</main>
<Toaster />
<CookieToast />
</DrawerWrapper>
</ThemeProvider>
</NextIntlClientProvider>
</body>
</html>
);
}
17 changes: 17 additions & 0 deletions src/app/[locale]/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Link } from "@/i18n/routing";
import { getTranslations } from "next-intl/server";

export default async function NotFound({
params,
}: Readonly<{ params: Promise<{ locale: string }> }>) {
const { locale } = await params;
const t = await getTranslations({ locale, namespace: "notFound" });

return (
<div>
<h2>{t("title")}</h2>
<p>{t("subtitle")}</p>
<Link href="/">{t("backHome")}</Link>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { orgueNavigation } from "@/app/orgues/orgueNavigation";
import { PropsWithChildren } from "react";
import { orgueNavigation } from "@/app/[locale]/orgues/orgueNavigation";
import type { PropsWithChildren } from "react";
import { OrguesEdificiParams } from "../layout";

export const dynamicParams = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { orgueNavigation } from "@/app/orgues/orgueNavigation";
import { orgueNavigation } from "@/app/[locale]/orgues/orgueNavigation";
import { PageBreadcrumb } from "@/components/page-breadcrumb";
import { getTranslations } from "next-intl/server";
import { OrguesOrgueParams } from "./layout";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { orgueNavigation } from "@/app/orgues/orgueNavigation";
import { PropsWithChildren } from "react";
import { orgueNavigation } from "@/app/[locale]/orgues/orgueNavigation";
import type { PropsWithChildren } from "react";
import { OrguesMunicipiParams } from "../layout";

export const dynamicParams = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { orgueNavigation } from "@/app/orgues/orgueNavigation";
import { orgueNavigation } from "@/app/[locale]/orgues/orgueNavigation";
import { PageBreadcrumb } from "@/components/page-breadcrumb";
import { getTranslations } from "next-intl/server";
import { OrguesEdificiParams } from "./layout";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import orgues from "@/database/orgues.json" with { type: "json" };
import { PropsWithChildren } from "react";
import type { PropsWithChildren } from "react";
import { OrguesComarcaParams } from "../page";

export const dynamicParams = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { orgueNavigation } from "@/app/orgues/orgueNavigation";
import { orgueNavigation } from "@/app/[locale]/orgues/orgueNavigation";
import { PageBreadcrumb } from "@/components/page-breadcrumb";
import {
Card,
Expand All @@ -7,8 +7,9 @@ import {
CardTitle,
} from "@/components/ui/card";
import { orgues } from "@/database/orgues-repository";
import { Link } from "@/i18n/routing";
import { getTranslations } from "next-intl/server";
import Link from "next/link";

import { OrguesMunicipiParams } from "./layout";

export default async function Page({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import orgues from "@/database/orgues.json" with { type: "json" };
import { PropsWithChildren } from "react";
import type { PropsWithChildren } from "react";
import { OrguesProvinciaParams } from "../page";

export const dynamicParams = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import orgues from "@/database/orgues.json" with { type: "json" };
import { PropsWithChildren } from "react";
import type { PropsWithChildren } from "react";

export const dynamicParams = false;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Metadata, ResolvingMetadata } from "next";
import { getTranslations } from "next-intl/server";
import { PropsWithChildren } from "react";
import type { PropsWithChildren } from "react";

export async function generateMetadata(
{},
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 6 additions & 2 deletions src/app/page.tsx → src/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { getTranslations } from "next-intl/server";
import { getTranslations, setRequestLocale } from "next-intl/server";
import type { Organization, WithContext } from "schema-dts";

export default async function Home() {
export default async function Home({
params: { locale },
}: Readonly<{ params: { locale: string } }>) {
setRequestLocale(locale);

const t = await getTranslations("organization");

const jsonLD: WithContext<Organization> = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Button, buttonVariants } from "@/components/ui/button";
import { Link } from "@/i18n/routing";
import { cn } from "@/lib/utils";
import {
ExternalLinkIcon,
FileIcon,
FileTextIcon,
Pencil2Icon,
} from "@radix-ui/react-icons";
import Link from "next/link";

export function ProcedenciaDades() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PageBreadcrumb } from "@/components/page-breadcrumb";
import type { Metadata, ResolvingMetadata } from "next";
import { getTranslations } from "next-intl/server";
import { PropsWithChildren } from "react";
import type { PropsWithChildren } from "react";

export async function generateMetadata(
{},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PageBreadcrumb } from "@/components/page-breadcrumb";
import type { Metadata, ResolvingMetadata } from "next";
import { getTranslations } from "next-intl/server";
import { PropsWithChildren } from "react";
import type { PropsWithChildren } from "react";

export async function generateMetadata(
{},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/app/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function Error({

return (
<div>
<h2>{t("title")}</h2>
<h1>{t("title")}</h1>
<button onClick={reset}>{t("retry")}</button>
</div>
);
Expand Down
53 changes: 8 additions & 45 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,57 +1,20 @@
import { CookieToast } from "@/components/cookie/cookie-toast";
import { MainHeader } from "@/components/main-header";
import { Navbar } from "@/components/navbar";
import { ThemeProvider } from "@/components/theme-provider";
import { DrawerWrapper } from "@/components/ui/drawer";
import { Toaster } from "@/components/ui/sonner";
import { cn } from "@/lib/utils";
import type { Metadata } from "next";
import { NextIntlClientProvider } from "next-intl";
import { getLocale, getMessages, getTranslations } from "next-intl/server";
import { Inter as FontSans } from "next/font/google";
import { PropsWithChildren } from "react";
import { getMessages } from "next-intl/server";
import type { PropsWithChildren } from "react";

import "./globals.css";

const fontSans = FontSans({
subsets: ["latin"],
variable: "--font-sans",
});

export async function generateMetadata(): Promise<Metadata> {
const t = await getTranslations("organization");

return {
title: t("name"),
description: t("description"),
};
}

export default async function RootLayout({
children,
}: Readonly<PropsWithChildren>) {
const locale = await getLocale();
params: { locale },
}: Readonly<PropsWithChildren<{ params: { locale: string } }>>) {
const messages = await getMessages();

return (
<html lang={locale} className="scroll-smooth" suppressHydrationWarning>
<body
className={cn(
"min-h-screen bg-background font-sans antialiased",
fontSans.variable,
)}
>
<NextIntlClientProvider messages={messages}>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
<DrawerWrapper>
<MainHeader nav={<Navbar />} />
<main className="container pt-8 mx-auto px-4 prose dark:prose-invert">
{children}
</main>
<Toaster />
<CookieToast />
</DrawerWrapper>
</ThemeProvider>
<html lang={locale} suppressHydrationWarning>
<body>
<NextIntlClientProvider locale={locale} messages={messages}>
{children}
</NextIntlClientProvider>
</body>
</html>
Expand Down
17 changes: 8 additions & 9 deletions src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { getTranslations } from "next-intl/server";
import Link from "next/link";
"use client";

export default async function NotFound() {
const t = await getTranslations("notFound");
import Error from "next/error";

export default function NotFound() {
return (
<div>
<h2>{t("title")}</h2>
<p>{t("subtitle")}</p>
<Link href="/">{t("backHome")}</Link>
</div>
<html lang="en">
<body>
<Error statusCode={404} />
</body>
</html>
);
}
2 changes: 1 addition & 1 deletion src/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import orgues from "@/database/orgues.json";
import type { MetadataRoute } from "next";
import { OrguesEdifici } from "./orgues/orgueNavigation";
import { OrguesEdifici } from "./[locale]/orgues/orgueNavigation";

export const baseURL = new URL("https://www.acorgue.cat");

Expand Down
6 changes: 3 additions & 3 deletions src/components/button-link.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use client";

import { Button } from "@/components/ui/button";
import Link, { LinkProps } from "next/link";
import { PropsWithChildren } from "react";
import { Link } from "@/i18n/routing";
import type { PropsWithChildren } from "react";

export function ButtonLink({
className,
...rest
}: PropsWithChildren<LinkProps & { target?: string; className?: string }>) {
}: PropsWithChildren<{ href: string; target?: string; className?: string }>) {
return (
<Button variant="outline" asChild className={className}>
<Link className="no-underline" {...rest} />
Expand Down
2 changes: 1 addition & 1 deletion src/components/cookie/cookie-settings-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { CookieIcon } from "@radix-ui/react-icons";
import { useTranslations } from "next-intl";
import { PropsWithChildren } from "react";
import type { PropsWithChildren } from "react";
import { Button } from "../ui/button";
import { useCookie } from "./use-cookie";

Expand Down
Loading