Skip to content

Commit 8455389

Browse files
committed
Merge branch 'main' into add-pricing-module
2 parents d9d7c86 + 4945449 commit 8455389

File tree

6 files changed

+39
-9
lines changed

6 files changed

+39
-9
lines changed

src/app/api/categories/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { notFound } from "next/navigation"
44

55
/**
66
* This endpoint uses the serverless Product Module to list and count all product categories.
7-
* The module connects directly to you Medusa database to retrieve and manipulate data, without the need for a dedicated server.
7+
* The module connects directly to your Medusa database to retrieve and manipulate data, without the need for a dedicated server.
88
* Read more about the Product Module here: https://docs.medusajs.com/modules/products/serverless-module
99
*/
1010
export async function GET(request: NextRequest) {

src/app/api/collections/[handle]/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ProductCollectionDTO, ProductDTO } from "@medusajs/types/dist/product"
77

88
/**
99
* This endpoint uses the serverless Product Module to retrieve a collection and its products by handle.
10-
* The module connects directly to you Medusa database to retrieve and manipulate data, without the need for a dedicated server.
10+
* The module connects directly to your Medusa database to retrieve and manipulate data, without the need for a dedicated server.
1111
* Read more about the Product Module here: https://docs.medusajs.com/modules/products/serverless-module
1212
*/
1313
export async function GET(

src/app/api/collections/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { notFound } from "next/navigation"
44

55
/**
66
* This endpoint uses the serverless Product Module to list and count all product collections.
7-
* The module connects directly to you Medusa database to retrieve and manipulate data, without the need for a dedicated server.
7+
* The module connects directly to your Medusa database to retrieve and manipulate data, without the need for a dedicated server.
88
* Read more about the Product Module here: https://docs.medusajs.com/modules/products/serverless-module
99
*/
1010
export async function GET(request: NextRequest) {

src/app/api/products/[handle]/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { NextResponse, NextRequest } from "next/server"
22
import { initialize as initializeProductModule } from "@medusajs/product"
33

44
/**
5-
* This endpoint uses the serverless Product Modules to retrieve a product by handle.
6-
* The modules connect directly to your Medusa database to retrieve and manipulate data, without the need for a dedicated server.
5+
* This endpoint uses the serverless Product Module to retrieve a product by handle.
6+
* The module connects directly to your Medusa database to retrieve and manipulate data, without the need for a dedicated server.
77
* Read more about the Product Module here: https://docs.medusajs.com/modules/products/serverless-module
88
*/
99
export async function GET(
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import Button from "@modules/common/components/button"
2+
3+
const ProductOnboardingCta = () => {
4+
return (
5+
<div className="max-w-4xl h-full bg-gray-100 w-full mb-4 p-8">
6+
<div className="flex flex-col gap-y-6 center">
7+
<span className="text-gray-700 text-xl">
8+
Your demo product was successfully created! 🎉
9+
</span>
10+
<span className="text-gray-700 text-small-regular">
11+
You can now continue setting up your store in the admin.
12+
</span>
13+
<a href="http://localhost:7001/a/orders?onboarding_step=create_order_nextjs">
14+
<Button className="md:w-80">Continue setup in admin</Button>
15+
</a>
16+
</div>
17+
</div>
18+
)
19+
}
20+
21+
export default ProductOnboardingCta

src/modules/products/templates/index.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
"use client"
22

3+
import React, { useEffect, useRef, useState } from "react"
34
import { ProductProvider } from "@lib/context/product-context"
45
import { useIntersection } from "@lib/hooks/use-in-view"
6+
import ProductInfo from "@modules/products/templates/product-info"
57
import ProductTabs from "@modules/products/components/product-tabs"
68
import RelatedProducts from "@modules/products/components/related-products"
7-
import ProductInfo from "@modules/products/templates/product-info"
8-
import React, { useRef } from "react"
9-
import ImageGallery from "../components/image-gallary"
10-
import MobileActions from "../components/mobile-actions"
9+
import ImageGallery from "@modules/products/components/image-gallary"
10+
import MobileActions from "@modules/products/components/mobile-actions"
11+
import ProductOnboardingCta from "@modules/products/components/product-onboarding-cta"
1112
import { PricedProduct } from "@medusajs/medusa/dist/types/pricing"
1213

1314
type ProductTemplateProps = {
1415
product: PricedProduct
1516
}
1617

1718
const ProductTemplate: React.FC<ProductTemplateProps> = ({ product }) => {
19+
const [isOnboarding, setIsOnboarding] = useState<boolean>(false)
20+
1821
const info = useRef<HTMLDivElement>(null)
1922

2023
const inView = useIntersection(info, "0px")
2124

25+
useEffect(() => {
26+
const onboarding = window.sessionStorage.getItem("onboarding")
27+
setIsOnboarding(onboarding === "true")
28+
}, [])
29+
2230
return (
2331
<ProductProvider product={product}>
2432
<div className="content-container flex flex-col small:flex-row small:items-start py-6 relative">
@@ -29,6 +37,7 @@ const ProductTemplate: React.FC<ProductTemplateProps> = ({ product }) => {
2937
className="small:sticky small:top-20 w-full py-8 small:py-0 small:max-w-[344px] medium:max-w-[400px] flex flex-col gap-y-12"
3038
ref={info}
3139
>
40+
{isOnboarding && <ProductOnboardingCta />}
3241
<ProductInfo product={product} />
3342
<ProductTabs product={product} />
3443
</div>

0 commit comments

Comments
 (0)