Skip to content

Commit 507f762

Browse files
committed
app/
1 parent a006383 commit 507f762

File tree

22 files changed

+417
-102
lines changed

22 files changed

+417
-102
lines changed

src/app/[countryCode]/(checkout)/checkout/page.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Metadata } from "next"
22
import { cookies } from "next/headers"
33
import { notFound } from "next/navigation"
4-
import { LineItem } from "@medusajs/medusa"
4+
import { Cart, LineItem } from "@medusajs/medusa"
5+
6+
import { getI18n } from "../../../../locales/server"
57

68
import { enrichLineItems } from "@modules/cart/actions"
79
import Wrapper from "@modules/checkout/components/payment-wrapper"
@@ -31,6 +33,9 @@ const fetchCart = async () => {
3133
}
3234

3335
export default async function Checkout() {
36+
const t = await getI18n()
37+
metadata.title = t("checkout.title")
38+
3439
const cart = await fetchCart()
3540

3641
if (!cart) {

src/app/[countryCode]/(checkout)/layout.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ import LocalizedClientLink from "@modules/common/components/localized-client-lin
22
import ChevronDown from "@modules/common/icons/chevron-down"
33
import MedusaCTA from "@modules/layout/components/medusa-cta"
44

5-
export default function CheckoutLayout({
5+
import { getI18n } from "../../../locales/server"
6+
7+
export default async function CheckoutLayout({
68
children,
79
}: {
810
children: React.ReactNode
911
}) {
12+
const t = await getI18n()
13+
1014
return (
1115
<div className="w-full bg-white relative small:min-h-screen">
1216
<div className="h-16 bg-white border-b ">
@@ -18,23 +22,25 @@ export default function CheckoutLayout({
1822
>
1923
<ChevronDown className="rotate-90" size={16} />
2024
<span className="mt-px hidden small:block txt-compact-plus text-ui-fg-subtle hover:text-ui-fg-base ">
21-
Back to shopping cart
25+
{t("checkout.back")}
2226
</span>
2327
<span className="mt-px block small:hidden txt-compact-plus text-ui-fg-subtle hover:text-ui-fg-base">
24-
Back
28+
{t("generic.back")}
2529
</span>
2630
</LocalizedClientLink>
2731
<LocalizedClientLink
2832
href="/"
2933
className="txt-compact-xlarge-plus text-ui-fg-subtle hover:text-ui-fg-base uppercase"
3034
data-testid="store-link"
3135
>
32-
Medusa Store
36+
{t("store.name")}
3337
</LocalizedClientLink>
3438
<div className="flex-1 basis-0" />
3539
</nav>
3640
</div>
37-
<div className="relative" data-testid="checkout-container">{children}</div>
41+
<div className="relative" data-testid="checkout-container">
42+
{children}
43+
</div>
3844
<div className="py-4 w-full flex items-center justify-center">
3945
<MedusaCTA />
4046
</div>
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1+
import { getI18n } from "../../../locales/server"
12
import InteractiveLink from "@modules/common/components/interactive-link"
23
import { Metadata } from "next"
34

45
export const metadata: Metadata = {
56
title: "404",
6-
description: "Something went wrong",
7+
description: "generic.somethingwrong",
78
}
89

910
export default async function NotFound() {
11+
const t = await getI18n()
12+
13+
metadata.description = t("generic.somethingwrong")
14+
1015
return (
1116
<div className="flex flex-col gap-4 items-center justify-center min-h-[calc(100vh-64px)]">
12-
<h1 className="text-2xl-semi text-ui-fg-base">Page not found</h1>
17+
<h1 className="text-2xl-semi text-ui-fg-base">
18+
{t("generic.notfound_title")}
19+
</h1>
1320
<p className="text-small-regular text-ui-fg-base">
14-
The page you tried to access does not exist.
21+
{t("generic.notfound_desc")}
1522
</p>
16-
<InteractiveLink href="/">Go to frontpage</InteractiveLink>
23+
<InteractiveLink href="/">{t("generic.notfound_link")}</InteractiveLink>
1724
</div>
1825
)
1926
}

src/app/[countryCode]/(main)/account/@dashboard/addresses/page.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
import { Metadata } from "next"
22
import { notFound } from "next/navigation"
33

4+
import { getI18n } from "../../../../../../locales/server"
5+
46
import AddressBook from "@modules/account/components/address-book"
57

68
import { getCustomer, getRegion } from "@lib/data"
79

810
import { headers } from "next/headers"
911

1012
export const metadata: Metadata = {
11-
title: "Addresses",
12-
description: "View your addresses",
13+
title: "page.adresses.title",
14+
description: "page.adresses.desc",
1315
}
1416

1517
export default async function Addresses() {
18+
const t = await getI18n()
19+
metadata.title = t("page.adresses.title")
20+
metadata.description = t("page.adresses.desc")
21+
1622
const nextHeaders = headers()
1723
const countryCode = nextHeaders.get("next-url")?.split("/")[1] || ""
1824
const customer = await getCustomer()
@@ -25,10 +31,11 @@ export default async function Addresses() {
2531
return (
2632
<div className="w-full" data-testid="addresses-page-wrapper">
2733
<div className="mb-8 flex flex-col gap-y-4">
28-
<h1 className="text-2xl-semi">Shipping Addresses</h1>
34+
<h1 className="text-2xl-semi">
35+
{t("page.adresses.shipping.title")}
36+
</h1>
2937
<p className="text-base-regular">
30-
View and update your shipping addresses, you can add as many as you
31-
like. Saving your addresses will make them available during checkout.
38+
{t("page.adresses.shipping.desc")}
3239
</p>
3340
</div>
3441
<AddressBook customer={customer} region={region} />

src/app/[countryCode]/(main)/account/@dashboard/orders/details/[id]/page.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Metadata } from "next"
22
import { notFound } from "next/navigation"
33

4+
import { getI18n } from "../../../../../../../../locales/server"
5+
46
import { retrieveOrder } from "@lib/data"
57
import OrderDetailsTemplate from "@modules/order/templates/order-details-template"
68

@@ -9,15 +11,16 @@ type Props = {
911
}
1012

1113
export async function generateMetadata({ params }: Props): Promise<Metadata> {
14+
const t = await getI18n()
1215
const order = await retrieveOrder(params.id).catch(() => null)
1316

1417
if (!order) {
1518
notFound()
1619
}
1720

1821
return {
19-
title: `Order #${order.display_id}`,
20-
description: `View your order`,
22+
title: t("page.order.title") + ` #${order.display_id}`,
23+
description: t("page.order.desc"),
2124
}
2225
}
2326

src/app/[countryCode]/(main)/account/@dashboard/orders/page.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
import { Metadata } from "next"
22

3+
import { getI18n } from "../../../../../../locales/server"
4+
35
import OrderOverview from "@modules/account/components/order-overview"
46
import { listCustomerOrders } from "@lib/data"
57
import { notFound } from "next/navigation"
68

79
export const metadata: Metadata = {
8-
title: "Orders",
9-
description: "Overview of your previous orders.",
10+
title: "page.orders.title",
11+
description: "page.orders.desc",
1012
}
1113

1214
export default async function Orders() {
15+
const t = await getI18n()
16+
metadata.title = t("page.orders.title")
17+
metadata.description = t("page.orders.desc")
18+
1319
const orders = await listCustomerOrders()
1420

1521
if (!orders) {
@@ -19,11 +25,8 @@ export default async function Orders() {
1925
return (
2026
<div className="w-full" data-testid="orders-page-wrapper">
2127
<div className="mb-8 flex flex-col gap-y-4">
22-
<h1 className="text-2xl-semi">Orders</h1>
23-
<p className="text-base-regular">
24-
View your previous orders and their status. You can also create
25-
returns or exchanges for your orders if needed.
26-
</p>
28+
<h1 className="text-2xl-semi">{t("page.orders.title")}</h1>
29+
<p className="text-base-regular">{t("page.orders.details")}</p>
2730
</div>
2831
<div>
2932
<OrderOverview orders={orders} />

src/app/[countryCode]/(main)/account/@dashboard/page.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
import { Metadata } from "next"
22

3+
import { getI18n } from "../../../../../locales/server"
4+
35
import { getCustomer, listCustomerOrders } from "@lib/data"
46
import Overview from "@modules/account/components/overview"
57
import { notFound } from "next/navigation"
68

79
export const metadata: Metadata = {
8-
title: "Account",
9-
description: "Overview of your account activity.",
10+
title: "page.account.title",
11+
description: "page.account.desc",
1012
}
1113

1214
export default async function OverviewTemplate() {
15+
const t = await getI18n()
16+
metadata.title = t("page.account.title")
17+
metadata.description = t("page.account.desc")
18+
1319
const customer = await getCustomer().catch(() => null)
1420
const orders = (await listCustomerOrders().catch(() => null)) || null
1521

src/app/[countryCode]/(main)/account/@dashboard/profile/page.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { Metadata } from "next"
22

3+
import { getI18n } from "../../../../../../locales/server"
4+
35
import ProfilePhone from "@modules/account//components/profile-phone"
46
import ProfileBillingAddress from "@modules/account/components/profile-billing-address"
57
import ProfileEmail from "@modules/account/components/profile-email"
@@ -10,11 +12,15 @@ import { getCustomer, listRegions } from "@lib/data"
1012
import { notFound } from "next/navigation"
1113

1214
export const metadata: Metadata = {
13-
title: "Profile",
14-
description: "View and edit your Medusa Store profile.",
15+
title: "page.profile.title",
16+
description: "page.profile.desc",
1517
}
1618

1719
export default async function Profile() {
20+
const t = await getI18n()
21+
metadata.title = t("page.profile.title")
22+
metadata.description = t("page.profile.desc")
23+
1824
const customer = await getCustomer()
1925
const regions = await listRegions()
2026

@@ -25,12 +31,8 @@ export default async function Profile() {
2531
return (
2632
<div className="w-full" data-testid="profile-page-wrapper">
2733
<div className="mb-8 flex flex-col gap-y-4">
28-
<h1 className="text-2xl-semi">Profile</h1>
29-
<p className="text-base-regular">
30-
View and update your profile information, including your name, email,
31-
and phone number. You can also update your billing address, or change
32-
your password.
33-
</p>
34+
<h1 className="text-2xl-semi">{metadata.title}</h1>
35+
<p className="text-base-regular">{t("page.profile.details")}</p>
3436
</div>
3537
<div className="flex flex-col gap-y-8 w-full">
3638
<ProfileName customer={customer} />
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import { Metadata } from "next"
22

3+
import { getI18n } from "../../../../../locales/server"
4+
35
import LoginTemplate from "@modules/account/templates/login-template"
46

57
export const metadata: Metadata = {
6-
title: "Sign in",
7-
description: "Sign in to your Medusa Store account.",
8+
title: "page.login.title",
9+
description: "page.login.desc",
810
}
911

10-
export default function Login() {
12+
export default async function Login() {
13+
const t = await getI18n()
14+
metadata.title = t("page.login.title")
15+
metadata.description = t("page.login.desc")
16+
1117
return <LoginTemplate />
1218
}
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
import { Metadata } from "next"
22

3+
import { getI18n } from "../../../../locales/server"
4+
35
import InteractiveLink from "@modules/common/components/interactive-link"
46

57
export const metadata: Metadata = {
68
title: "404",
7-
description: "Something went wrong",
9+
description: "generic.somethingwrong",
810
}
911

10-
export default function NotFound() {
12+
export default async function NotFound() {
13+
const t = await getI18n()
14+
15+
metadata.description = t("generic.somethingwrong")
16+
1117
return (
1218
<div className="flex flex-col items-center justify-center min-h-[calc(100vh-64px)]">
13-
<h1 className="text-2xl-semi text-ui-fg-base">Page not found</h1>
19+
<h1 className="text-2xl-semi text-ui-fg-base">
20+
{t("generic.notfound_title")}
21+
</h1>
1422
<p className="text-small-regular text-ui-fg-base">
15-
The cart you tried to access does not exist. Clear your cookies and try
16-
again.
23+
{t("generic.notfound_desc_cart")}
1724
</p>
18-
<InteractiveLink href="/">Go to frontpage</InteractiveLink>
25+
<InteractiveLink href="/">{t("generic.notfound_link")}</InteractiveLink>
1926
</div>
2027
)
2128
}

src/app/[countryCode]/(main)/cart/page.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { LineItem } from "@medusajs/medusa"
22
import { Metadata } from "next"
33
import { cookies } from "next/headers"
44

5+
import { getI18n } from "../../../../locales/server"
6+
57
import CartTemplate from "@modules/cart/templates"
68

79
import { enrichLineItems } from "@modules/cart/actions"
@@ -10,8 +12,8 @@ import { CartWithCheckoutStep } from "types/global"
1012
import { getCart, getCustomer } from "@lib/data"
1113

1214
export const metadata: Metadata = {
13-
title: "Cart",
14-
description: "View your cart",
15+
title: "cart.title",
16+
description: "cart.desc",
1517
}
1618

1719
const fetchCart = async () => {
@@ -40,6 +42,10 @@ const fetchCart = async () => {
4042
}
4143

4244
export default async function Cart() {
45+
const t = await getI18n()
46+
metadata.title = t("cart.title")
47+
metadata.description = t("cart.desc")
48+
4349
const cart = await fetchCart()
4450
const customer = await getCustomer()
4551

src/app/[countryCode]/(main)/categories/[...category]/page.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Metadata } from "next"
22
import { notFound } from "next/navigation"
33

4+
import { getI18n } from "../../../../../locales/server"
5+
46
import { getCategoryByHandle, listCategories, listRegions } from "@lib/data"
57
import CategoryTemplate from "@modules/categories/templates"
68
import { SortOptions } from "@modules/store/components/refinement-list/sort-products"
@@ -52,8 +54,11 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
5254
product_categories[product_categories.length - 1].description ??
5355
`${title} category.`
5456

57+
const t = await getI18n()
58+
const storeName = t("store.name")
59+
5560
return {
56-
title: `${title} | Medusa Store`,
61+
title: `${title} | ${storeName}`,
5762
description,
5863
alternates: {
5964
canonical: `${params.category.join("/")}`,

0 commit comments

Comments
 (0)