Skip to content

Commit 4fa9efa

Browse files
authored
Merge pull request #127 from medusajs/feat/next-13
feat: upgrade Next to v13
2 parents fc83e9f + 8034241 commit 4fa9efa

File tree

29 files changed

+670
-1074
lines changed

29 files changed

+670
-1074
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
22

3+
# IDEs
4+
.idea
5+
.vscode
6+
37
# dependencies
48
/node_modules
59
/.pnp
@@ -40,4 +44,4 @@ yarn-error.log*
4044
node_modules
4145

4246
.yarn
43-
.swc
47+
.swc

next-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3+
/// <reference types="next/navigation-types/compat/navigation" />
34

45
// NOTE: This file should not be edited
56
// see https://nextjs.org/docs/basic-features/typescript for more information.

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
"clsx": "^1.1.1",
3333
"lodash": "^4.17.21",
3434
"medusa-react": "^8.0.0",
35-
"next": "^12.2.0",
36-
"react": "17.0.2",
35+
"next": "^13.4.5",
36+
"react": "^18.2.0",
3737
"react-country-flag": "^3.0.2",
38-
"react-dom": "17.0.2",
38+
"react-dom": "^18.2.0",
3939
"react-hook-form": "^7.30.0",
4040
"react-instantsearch-hooks-web": "^6.29.0",
4141
"react-intersection-observer": "^9.3.4",
@@ -44,16 +44,18 @@
4444
"devDependencies": {
4545
"@babel/core": "^7.17.5",
4646
"@medusajs/client-types": "^0.2.2",
47-
"@medusajs/medusa": "^1.7.5",
47+
"@medusajs/medusa": "^1.12.1",
48+
"@types/lodash": "^4.14.195",
4849
"@types/node": "17.0.21",
4950
"@types/react": "17.0.40",
5051
"@types/react-instantsearch-dom": "^6.12.3",
5152
"autoprefixer": "^10.4.2",
5253
"babel-loader": "^8.2.3",
5354
"cypress": "^9.5.2",
5455
"eslint": "8.10.0",
55-
"eslint-config-next": "12.1.0",
56+
"eslint-config-next": "^13.4.5",
5657
"postcss": "^8.4.8",
58+
"prettier": "^2.8.8",
5759
"tailwindcss": "^3.0.23",
5860
"typescript": "4.6.2"
5961
}

src/app/layout.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function RootLayout({ children }: { children: React.ReactNode }) {
2+
return (
3+
<html lang="en">
4+
<body>{children}</body>
5+
</html>
6+
)
7+
}
8+
9+
export default RootLayout

src/modules/account/components/account-nav/index.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ const AccountNav = () => {
1212
<div>
1313
<div className="small:hidden">
1414
{route !== "/account" && (
15-
<Link href="/account">
16-
<a className="flex items-center gap-x-2 text-small-regular py-2">
15+
<Link
16+
href="/account"
17+
className="flex items-center gap-x-2 text-small-regular py-2"
18+
>
19+
<>
1720
<ChevronDown className="transform rotate-90" />
1821
<span>Account</span>
19-
</a>
22+
</>
2023
</Link>
2124
)}
2225
</div>
@@ -69,14 +72,13 @@ type AccountNavLinkProps = {
6972
const AccountNavLink = ({ href, route, children }: AccountNavLinkProps) => {
7073
const active = route === href
7174
return (
72-
<Link href={href}>
73-
<a
74-
className={clsx("text-gray-700", {
75-
"text-gray-900 font-semibold": active,
76-
})}
77-
>
78-
{children}
79-
</a>
75+
<Link
76+
href={href}
77+
className={clsx("text-gray-700", {
78+
"text-gray-900 font-semibold": active,
79+
})}
80+
>
81+
<>{children}</>
8082
</Link>
8183
)
8284
}

src/modules/account/components/order-card/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ const OrderCard = ({ order }: OrderCardProps) => {
6666
</div>
6767
<div className="flex justify-end">
6868
<Link href={`/order/details/${order.id}`}>
69-
<a>
70-
<Button variant="secondary">See details</Button>
71-
</a>
69+
<Button variant="secondary">See details</Button>
7270
</Link>
7371
</div>
7472
</div>

src/modules/account/components/overview/index.tsx

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -21,36 +21,45 @@ const Overview = ({ orders, customer }: OverviewProps) => {
2121
<div className="text-base-regular">
2222
<ul>
2323
<li>
24-
<Link href="/account/profile">
25-
<a className="flex items-center justify-between py-4 border-b border-gray-200 px-8">
24+
<Link
25+
href="/account/profile"
26+
className="flex items-center justify-between py-4 border-b border-gray-200 px-8"
27+
>
28+
<>
2629
<div className="flex items-center gap-x-2">
2730
<User size={16} />
2831
<span>Profile</span>
2932
</div>
3033
<ChevronDown className="transform -rotate-90" />
31-
</a>
34+
</>
3235
</Link>
3336
</li>
3437
<li>
35-
<Link href="/account/addresses">
36-
<a className="flex items-center justify-between py-4 border-b border-gray-200 px-8">
38+
<Link
39+
href="/account/addresses"
40+
className="flex items-center justify-between py-4 border-b border-gray-200 px-8"
41+
>
42+
<>
3743
<div className="flex items-center gap-x-2">
3844
<MapPin size={16} />
3945
<span>Addresses</span>
4046
</div>
4147
<ChevronDown className="transform -rotate-90" />
42-
</a>
48+
</>
4349
</Link>
4450
</li>
4551
<li>
46-
<Link href="/account/orders">
47-
<a className="flex items-center justify-between py-4 border-b border-gray-200 px-8">
52+
<Link
53+
href="/account/orders"
54+
className="flex items-center justify-between py-4 border-b border-gray-200 px-8"
55+
>
56+
<>
4857
<div className="flex items-center gap-x-2">
4958
<Package size={16} />
5059
<span>Orders</span>
5160
</div>
5261
<ChevronDown className="transform -rotate-90" />
53-
</a>
62+
</>
5463
</Link>
5564
</li>
5665
</ul>
@@ -103,41 +112,37 @@ const Overview = ({ orders, customer }: OverviewProps) => {
103112
return (
104113
<li key={order.id}>
105114
<Link href={`/order/details/${order.id}`}>
106-
<a>
107-
<div className="bg-gray-50 flex justify-between items-center p-4">
108-
<div className="grid grid-cols-3 grid-rows-2 text-small-regular gap-x-4 flex-1">
109-
<span className="font-semibold">
110-
Date placed
111-
</span>
112-
<span className="font-semibold">
113-
Order number
114-
</span>
115-
<span className="font-semibold">
116-
Total amount
117-
</span>
118-
<span>
119-
{new Date(order.created_at).toDateString()}
120-
</span>
121-
<span>#{order.display_id}</span>
122-
<span>
123-
{formatAmount({
124-
amount: order.total,
125-
region: order.region,
126-
includeTaxes: false,
127-
})}
128-
</span>
129-
</div>
130-
<button
131-
className="flex items-center justify-between"
132-
onClick={close}
133-
>
134-
<span className="sr-only">
135-
Go to order #{order.display_id}
136-
</span>
137-
<ChevronDown className="-rotate-90" />
138-
</button>
115+
<div className="bg-gray-50 flex justify-between items-center p-4">
116+
<div className="grid grid-cols-3 grid-rows-2 text-small-regular gap-x-4 flex-1">
117+
<span className="font-semibold">Date placed</span>
118+
<span className="font-semibold">
119+
Order number
120+
</span>
121+
<span className="font-semibold">
122+
Total amount
123+
</span>
124+
<span>
125+
{new Date(order.created_at).toDateString()}
126+
</span>
127+
<span>#{order.display_id}</span>
128+
<span>
129+
{formatAmount({
130+
amount: order.total,
131+
region: order.region,
132+
includeTaxes: false,
133+
})}
134+
</span>
139135
</div>
140-
</a>
136+
<button
137+
className="flex items-center justify-between"
138+
onClick={close}
139+
>
140+
<span className="sr-only">
141+
Go to order #{order.display_id}
142+
</span>
143+
<ChevronDown className="-rotate-90" />
144+
</button>
145+
</div>
141146
</Link>
142147
</li>
143148
)

src/modules/account/components/register/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ const Register = () => {
9999
)}
100100
<span className="text-center text-gray-700 text-small-regular mt-6">
101101
By creating an account, you agree to Acme&apos;s{" "}
102-
<Link href="/content/privacy-policy">
103-
<a className="underline">Privacy Policy</a>
102+
<Link href="/content/privacy-policy" className="underline">
103+
Privacy Policy
104104
</Link>{" "}
105105
and{" "}
106-
<Link href="/content/terms-of-use">
107-
<a className="underline">Terms of Use</a>
106+
<Link href="/content/terms-of-use" className="underline">
107+
Terms of Use
108108
</Link>
109109
.
110110
</span>

src/modules/cart/components/sign-in-prompt/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ const SignInPrompt = () => {
1212
</div>
1313
<div>
1414
<Link href="/account/login">
15-
<a>
16-
<Button variant="secondary">Sign in</Button>
17-
</a>
15+
<Button variant="secondary">Sign in</Button>
1816
</Link>
1917
</div>
2018
</div>

src/modules/cart/templates/summary.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ const Summary = ({ cart }: SummaryProps) => {
1212
<div className="grid grid-cols-1 gap-y-6">
1313
<CartTotals cart={cart} />
1414
<Link href="/checkout">
15-
<a>
16-
<Button>Go to checkout</Button>
17-
</a>
15+
<Button>Go to checkout</Button>
1816
</Link>
1917
</div>
2018
)

0 commit comments

Comments
 (0)