1 import { IconProps } from "@medusajs/icons/dist/types"
2 import { HeadlineTags, ShadedBlock } from "docs-ui"
3 import {
4 Buildings,
5 BuildingTax,
6 Cash,
7 Channels,
8 CreditCard,
9 CurrencyDollar,
10 FlyingBox,
11 IdBadge,
12 Key,
13 ListCheckbox,
14 Map,
15 MapPin,
16 ReceiptPercent,
17 ShoppingCart,
18 Tag,
19 User,
20 Users,
21 } from "@medusajs/icons"
22 import clsx from "clsx"
23 import HomepageNewsletter from "./Newsletter"
24 import Link from "next/link"
25
26 type SectionProps = {
27 title: string
28 modules: {
29 name: string
30 description: string
31 link: string
32 Icon: React.FC<IconProps>
33 }[]
34 }
35
36 const HomepageCommerceModulesSection = () => {
37 const sections: SectionProps[] = [
38 {
39 title: "Cart & Purchase",
40 modules: [
41 {
42 name: "Cart",
43 description: "Add to cart, checkout, and totals",
44 link: "/resources/commerce-modules/cart",
45 Icon: ShoppingCart,
46 },
47 {
48 name: "Payment",
49 description: "Process any payment type",
50 link: "/resources/commerce-modules/payment",
51 Icon: CreditCard,
52 },
53 {
54 name: "Customer",
55 description: "Customer and group management",
56 link: "/resources/commerce-modules/customer",
57 Icon: Users,
58 },
59 ],
60 },
61 {
62 title: "Merchandising",
63 modules: [
64 {
65 name: "Pricing",
66 description: "Configurable pricing engine",
67 link: "/resources/commerce-modules/pricing",
68 Icon: CurrencyDollar,
69 },
70 {
71 name: "Promotion",
72 description: "Discounts and promotions",
73 link: "/resources/commerce-modules/promotion",
74 Icon: ReceiptPercent,
75 },
76 {
77 name: "Product",
78 description: "Variants, categories, and bulk edits",
79 link: "/resources/commerce-modules/product",
80 Icon: Tag,
81 },
82 ],
83 },
84 {
85 title: "Fulfillment",
86 modules: [
87 {
88 name: "Order",
89 description: "Omnichannel order management",
90 link: "/resources/commerce-modules/order",
91 Icon: ListCheckbox,
92 },
93 {
94 name: "Inventory",
95 description: "Multi-warehouse and reservations",
96 link: "/resources/commerce-modules/inventory",
97 Icon: Buildings,
98 },
99 {
100 name: "Fulfillment",
101 description: "Order fulfillment and shipping",
102 link: "/resources/commerce-modules/fulfillment",
103 Icon: FlyingBox,
104 },
105 {
106 name: "Stock Location",
107 description: "Locations of stock-kept items",
108 link: "/resources/commerce-modules/stock-location",
109 Icon: MapPin,
110 },
111 ],
112 },
113 {
114 title: "Regions & Channels",
115 modules: [
116 {
117 name: "Region",
118 description: "Cross-border commerce",
119 link: "/resources/commerce-modules/region",
120 Icon: Map,
121 },
122 {
123 name: "Sales Channel",
124 description: "Omnichannel sales",
125 link: "/resources/commerce-modules/sales-channel",
126 Icon: Channels,
127 },
128 {
129 name: "Tax",
130 description: "Granular tax control",
131 link: "/resources/commerce-modules/tax",
132 Icon: BuildingTax,
133 },
134 {
135 name: "Currency",
136 description: "Multi-currency support",
137 link: "/resources/commerce-modules/currency",
138 Icon: Cash,
139 },
140 ],
141 },
142 {
143 title: "User Access",
144 modules: [
145 {
146 name: "API Keys",
147 description: "Store and admin access",
148 link: "/resources/commerce-modules/api-key",
149 Icon: Key,
150 },
151 {
152 name: "User Module",
153 description: "Admin user management",
154 link: "/resources/commerce-modules/user",
155 Icon: User,
156 },
157 {
158 name: "Auth",
159 description: "Integrate authentication methods",
160 link: "/resources/commerce-modules/auth",
161 Icon: IdBadge,
162 },
163 ],
164 },
165 ]
166 return (
167 <div className="w-full border-b border-medusa-border-base">
168 <div className="p-2 flex gap-2 border-b border-medusa-border-base">
169 <h2 className="text-h1 text-medusa-fg-base min-w-max">
170 Commerce Modules
171 </h2>
172 <ShadedBlock className="w-full min-h-2" />
173 </div>
174 <div className="flex flex-wrap gap-0">
175 {sections.map((section, index) => (
176 <div
177 key={index}
178 className={clsx(
179 "py-2 w-full sm:w-1/2 lg:w-1/3",
180 "flex flex-col gap-1 items-start",
181 "border-medusa-border-base",
182 "border-b",
183 index === 3 && "lg:border-b-0",
184 index > 3 && "sm:border-b-0",
185 index % 3 !== 2 && "border-r",
186 index === 2 && "border-r lg:border-r-0"
187 )}
188 >
189 <HeadlineTags tags={[section.title]} className="px-2" />
190 {section.modules.map(({ Icon, ...module }, modIndex) => (
191 <div
192 key={modIndex}
193 className="flex flex-col gap-0 group relative px-2 w-full"
194 >
195 <span className="absolute top-0 left-0 lg:-left-px w-[2px] h-full bg-transparent group-hover:bg-medusa-fg-interactive" />
196 <div className="flex gap-0.5 items-center">
197 <Icon className="text-medusa-fg-subtle group-hover:text-medusa-fg-interactive" />
198 <span className="text-medusa-fg-base text-medium-plus">
199 {module.name}
200 </span>
201 </div>
202 <p className="text-medusa-fg-subtle text-medium">
203 {module.description}
204 </p>
205 <Link
206 href={module.link}
207 className="absolute left-0 top-0 w-full h-full opacity-0"
208 >
209 Learn more
210 </Link>
211 </div>
212 ))}
213 </div>
214 ))}
215 <HomepageNewsletter />
216 </div>
217 </div>
218 )
219 }
220
221 export default HomepageCommerceModulesSection