Skip to content

Commit 6bbf222

Browse files
UI changes | Variant Fixes | Minor updates
[ADMIN] - redisigned UI - added left side navbar - added lucid-react icons - created new layout for product-form - fixed add variant to product - added react-color and color-picker into Color Value Input [STORE] - started creating logic for filtering products and useCart
1 parent cbe9ca3 commit 6bbf222

File tree

24 files changed

+595
-401
lines changed

24 files changed

+595
-401
lines changed

TODO.txt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
[ADMIN]
2-
- connected all routes from chekout and webhook to Stripe payments
3-
- manage error handling in there are not enough products in store (toast message of what item is missing)
4-
[STORE]
5-
- redisigned cart-item tab and cart-item-dialog
6-
- created
7-
- added additionl summary of products to Checkout
8-
- added className attribute to Currency
9-
- implemented skeleton loading for products
10-
- created new gallery and adapted it to modal-dialog
11-
- changed billboard in categories
2+
- redisigned UI
3+
- added left side navbar
4+
- added lucid-react icons
5+
- created new layout for product-form
6+
- fixed add variant to product
7+
- added react-color and color-picker into Color Value Input
8+
9+
[STORE]

ecommerce-admin/app/(dashboard)/[storeId]/(routes)/billboards/[billboardId]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const BillboardPage = async ({
1313
});
1414

1515
return (
16-
<div className="flex-col">
16+
<div className="flex-col ml-56">
1717
<div className="flex-1 p-8 pt-6 space-y-4">
1818
<BillboardForm initialData={billboard} />
1919
</div>

ecommerce-admin/app/(dashboard)/[storeId]/(routes)/billboards/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const BillboardsPage = async ({ params }: { params: { storeId: string } }) => {
2222
}));
2323

2424
return (
25-
<div className="flex-col">
25+
<div className="flex-col ml-56">
2626
<div className="flex-1 p-8 pt-6 space-y-4">
2727
<BillboardsClient data={formattedBillboards} />
2828
</div>

ecommerce-admin/app/(dashboard)/[storeId]/(routes)/categories/[categoryId]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const CategoryPage = async ({
2020
});
2121

2222
return (
23-
<div className="flex-col">
23+
<div className="flex-col ml-56">
2424
<div className="flex-1 p-8 pt-6 space-y-4">
2525
<CategoryForm initialData={category} billboards={billboards} />
2626
</div>

ecommerce-admin/app/(dashboard)/[storeId]/(routes)/categories/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const CategoriesPage = async ({ params }: { params: { storeId: string } }) => {
2626
}));
2727

2828
return (
29-
<div className="flex-col">
29+
<div className="flex-col ml-56">
3030
<div className="flex-1 p-8 pt-6 space-y-4">
3131
<CategoriesClient data={formattedCategories} />
3232
</div>

ecommerce-admin/app/(dashboard)/[storeId]/(routes)/colors/[colorId]/components/color-form.tsx

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import { useState } from "react";
66
import { useParams, useRouter } from "next/navigation";
77
import { toast } from "react-hot-toast";
88
import { Color } from "@prisma/client";
9-
import { Trash } from "lucide-react";
9+
import { Palette, Trash } from "lucide-react";
1010
import { useForm } from "react-hook-form";
1111
import { zodResolver } from "@hookform/resolvers/zod";
12+
import { SketchPicker } from "react-color";
1213

1314
import { Input } from "@/components/ui/input";
1415
import { Button } from "@/components/ui/button";
@@ -41,6 +42,8 @@ export const ColorForm: React.FC<ColorFormProps> = ({ initialData }) => {
4142

4243
const [open, setOpen] = useState(false);
4344
const [loading, setLoading] = useState(false);
45+
const [color, setColor] = useState("Pick a color...");
46+
const [displayColorPicker, setDisplayColorPicker] = useState(false);
4447

4548
const title = initialData ? "Edit color" : "Create color";
4649
const description = initialData ? "Edit color" : "Add a new color";
@@ -55,6 +58,19 @@ export const ColorForm: React.FC<ColorFormProps> = ({ initialData }) => {
5558
},
5659
});
5760

61+
const popover: React.CSSProperties = {
62+
position: "absolute",
63+
zIndex: "2",
64+
};
65+
66+
const cover: React.CSSProperties = {
67+
position: "fixed",
68+
top: "0px",
69+
right: "0px",
70+
bottom: "0px",
71+
left: "0px",
72+
};
73+
5874
const onSubmit = async (data: ColorFormValues) => {
5975
try {
6076
setLoading(true);
@@ -118,7 +134,7 @@ export const ColorForm: React.FC<ColorFormProps> = ({ initialData }) => {
118134
onSubmit={form.handleSubmit(onSubmit)}
119135
className="w-full space-y-8"
120136
>
121-
<div className="grid grid-cols-3 gap-8">
137+
<div className="grid grid-cols-4 gap-8">
122138
<FormField
123139
control={form.control}
124140
name="name"
@@ -142,13 +158,34 @@ export const ColorForm: React.FC<ColorFormProps> = ({ initialData }) => {
142158
render={({ field }) => (
143159
<FormItem>
144160
<FormLabel>Value</FormLabel>
145-
<FormControl>
146-
<Input
147-
disabled={loading}
148-
placeholder="Color value"
149-
{...field}
150-
/>
151-
</FormControl>
161+
<div>
162+
<FormControl>
163+
<Input
164+
disabled={loading}
165+
placeholder="Color value"
166+
{...field}
167+
value={color}
168+
onClick={() =>
169+
setDisplayColorPicker(!displayColorPicker)
170+
}
171+
/>
172+
</FormControl>
173+
{displayColorPicker ? (
174+
<div style={popover}>
175+
<div
176+
style={cover}
177+
onClick={() => setDisplayColorPicker(false)}
178+
/>
179+
<SketchPicker
180+
color={color}
181+
onChange={(updatedColor) => {
182+
setColor(updatedColor.hex);
183+
form.setValue("value", updatedColor.hex);
184+
}}
185+
/>
186+
</div>
187+
) : null}
188+
</div>{" "}
152189
<FormMessage />
153190
</FormItem>
154191
)}

ecommerce-admin/app/(dashboard)/[storeId]/(routes)/colors/[colorId]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const ColorPage = async ({ params }: { params: { colorId: string } }) => {
99
});
1010

1111
return (
12-
<div className="flex-col">
12+
<div className="flex-col ml-56">
1313
<div className="flex-1 p-8 pt-6 space-y-4">
1414
<ColorForm initialData={color} />
1515
</div>

ecommerce-admin/app/(dashboard)/[storeId]/(routes)/colors/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const ColorsPage = async ({ params }: { params: { storeId: string } }) => {
2323
}));
2424

2525
return (
26-
<div className="flex-col">
26+
<div className="flex-col ml-56">
2727
<div className="flex-1 p-8 pt-6 space-y-4">
2828
<ColorsClient data={formattedColors} />
2929
</div>

ecommerce-admin/app/(dashboard)/[storeId]/(routes)/orders/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const OrdersPage = async ({ params }: { params: { storeId: string } }) => {
4040
}));
4141

4242
return (
43-
<div className="flex-col">
43+
<div className="flex-col ml-56">
4444
<div className="flex-1 p-8 pt-6 space-y-4">
4545
<OrderClient data={formattedOrders} />
4646
</div>

ecommerce-admin/app/(dashboard)/[storeId]/(routes)/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const DashboardPage: React.FC<DashboardPageProps> = async ({ params }) => {
2323
const stockCount = await getStockCount(params.storeId);
2424

2525
return (
26-
<div className="flex-col">
26+
<div className="flex-col ml-56">
2727
<div className="flex-1 p-8 pt-6 space-y-4">
2828
<Heading title="Dashboard" description="Overview of your store" />
2929
<Separator />

0 commit comments

Comments
 (0)