diff --git a/web-app/app/(profile)/profile/_components/image-scroll.tsx b/web-app/app/(profile)/profile/_components/image-scroll.tsx new file mode 100644 index 0000000..78f671f --- /dev/null +++ b/web-app/app/(profile)/profile/_components/image-scroll.tsx @@ -0,0 +1,123 @@ +"use client" + +import { useState } from "react" +import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area" +import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog" +import { Button } from "@/components/ui/button" +import { Plus } from "lucide-react" + +type ImageItem = { + id: string + file?: File + url: string +} + +export default function ProfileImageScroll() { + const [images, setImages] = useState([]) + const [open, setOpen] = useState(false) + + return ( +
+ +
+ + {/* Add Image Button */} + + + + + + + + Manage Images + + + setOpen(false)} + /> + + + + {images.map((img) => ( + Profile + ))} +
+ +
+
+ ) + + type ImageManagerProps = { + images: ImageItem[] + setImages: React.Dispatch> + onClose: () => void +} + +function ImageManager({ images, setImages, onClose }: ImageManagerProps) { + const [localImages, setLocalImages] = useState(images) + + const handleFileChange = (e: React.ChangeEvent) => { + if (!e.target.files) return + + const newFiles = Array.from(e.target.files) + + const newImages = newFiles.map((file) => ({ + id: crypto.randomUUID(), + file, + url: URL.createObjectURL(file), + })) + + setLocalImages((prev) => [...prev, ...newImages]) + } + + const removeImage = (id: string) => { + setLocalImages((prev) => prev.filter((img) => img.id !== id)) + } + + const handleSave = () => { + setImages(localImages) + onClose() + } + + return ( +
+ + +
+ {localImages.map((img) => ( +
+ + +
+ ))} +
+ + +
+ ) +} +} \ No newline at end of file diff --git a/web-app/app/(profile)/profile/page.tsx b/web-app/app/(profile)/profile/page.tsx index a9a813e..696b884 100644 --- a/web-app/app/(profile)/profile/page.tsx +++ b/web-app/app/(profile)/profile/page.tsx @@ -1,4 +1,5 @@ import { requireAuth } from "@/lib/auth"; +import ProfileImageScroll from "./_components/image-scroll"; export default async function ProfilePage() { const user = await requireAuth(); diff --git a/web-app/components/ui/scroll-area.tsx b/web-app/components/ui/scroll-area.tsx new file mode 100644 index 0000000..0f873dc --- /dev/null +++ b/web-app/components/ui/scroll-area.tsx @@ -0,0 +1,58 @@ +"use client" + +import * as React from "react" +import { ScrollArea as ScrollAreaPrimitive } from "radix-ui" + +import { cn } from "@/lib/utils" + +function ScrollArea({ + className, + children, + ...props +}: React.ComponentProps) { + return ( + + + {children} + + + + + ) +} + +function ScrollBar({ + className, + orientation = "vertical", + ...props +}: React.ComponentProps) { + return ( + + + + ) +} + +export { ScrollArea, ScrollBar }