diff --git a/prisma/migrations/20260214025107_delete_model_version_rows/migration.sql b/prisma/migrations/20260214025107_delete_model_version_rows/migration.sql new file mode 100644 index 0000000..ab9d0fc --- /dev/null +++ b/prisma/migrations/20260214025107_delete_model_version_rows/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - You are about to drop the column `version` on the `Model` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE "Model" DROP COLUMN "version"; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 6765ba7..5df410e 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -166,7 +166,6 @@ model Model { id Int @id @default(autoincrement()) modelName String description String? - version String? accuracy Float macroF1 Float diff --git a/src/app/profile/lib/action.ts b/src/app/profile/lib/action.ts index 89a01aa..cef0306 100644 --- a/src/app/profile/lib/action.ts +++ b/src/app/profile/lib/action.ts @@ -8,14 +8,26 @@ export const getAnotherUserData = async () => { if (!session?.user?.email) return null; - const user = await prisma.user.findUnique({ - where: { email: session.user.email }, + const userData = await prisma.user.findUnique({ + where: { + email: session.user.email, + }, select: { - gender: true, + bio: true, + preference: { + select: { + id: true, + profession: true, + preferedBrand: true, + preferredOS: true, + budgetMin: true, + budgetMax: true, + }, + }, }, }); - return user; + return userData; } catch (error) { console.error("Error fetching user data:", error); return null; diff --git a/src/app/profile/page.tsx b/src/app/profile/page.tsx index a786348..1277617 100644 --- a/src/app/profile/page.tsx +++ b/src/app/profile/page.tsx @@ -1,18 +1,11 @@ import { Header } from "@/src/components/dashboards/Header"; -import { getAnotherUserData } from "./lib/action"; import ProfileClient from "@/src/components/dashboards/ProfileClient"; -import { UserGender } from "@prisma/client"; export default async function ProfilePage() { - const user = await getAnotherUserData(); - return ( - <> +
Data model tidak tersedia.
diff --git a/src/components/dashboards/ProfileCard.tsx b/src/components/dashboards/ProfileCard.tsx new file mode 100644 index 0000000..7b9a316 --- /dev/null +++ b/src/components/dashboards/ProfileCard.tsx @@ -0,0 +1,166 @@ +"use client"; + +import { motion } from "framer-motion"; +import Image from "next/image"; +import { Pencil, Briefcase, Wallet, Laptop, User, Monitor, Fan } from "lucide-react"; +import { ProfileClientProps } from "@/src/types"; +import { useSession } from "next-auth/react"; +import { Button } from "../ui/button"; +import { Separator } from "../ui/separator"; +import { brandFormat, formatRupiah } from "@/src/utils/datas"; + +export default function ProfileCard({ + bio, + preferenceBrand, + preferenceOS, + budgetMax, + budgetMin, + profession, +}: ProfileClientProps) { + const session = useSession(); + const { brands } = brandFormat({ preferenceBrand }); + + return ( ++ {session?.data?.user?.email || "Belum ada email"} +
+ + {profession && ( + ++ {bio + ? `"${bio}"` + : "Belum ada deskripsi profil. Ceritakan sedikit tentang aktivitas dan kebutuhan laptop Anda."} +
+Dari
++ {formatRupiah(budgetMin)} +
+ + + +Hingga
++ {formatRupiah(budgetMax)} +
++ Budget belum diatur. +
+- {session?.data?.user?.email || "Not logged in"} -
-Gender
-{gender || "Not specified"}
-Product Preference
-{productReference || "None"}
-Kata Kunci diff --git a/src/components/dashboards/SentimentAnalyzer.tsx b/src/components/dashboards/SentimentAnalyzer.tsx deleted file mode 100644 index 549b330..0000000 --- a/src/components/dashboards/SentimentAnalyzer.tsx +++ /dev/null @@ -1,212 +0,0 @@ -"use client"; - -import { Send, Loader2, AlertCircle, Sparkles } from "lucide-react"; -import { motion, AnimatePresence } from "framer-motion"; -import { cn } from "@/lib/utils"; -import { - Combobox, - ComboboxContent, - ComboboxEmpty, - ComboboxInput, - ComboboxItem, - ComboboxList, -} from "../ui/combobox"; -import { Item, ItemContent, ItemDescription, ItemTitle } from "../ui/item"; -import { Input } from "../ui/input"; -import { Textarea } from "../ui/textarea"; -import { Button } from "../ui/button"; -import { Badge } from "../ui/badge"; -import { getSentimentDisplay } from "@/src/utils/datas"; -import { useSentimentForm } from "@/src/hooks/useSentimentForm"; - -export default function SentimentAnalyzer() { - const { - selectedModel, - searchQuery, - laptopName, - text, - isAnalyzing, - result, - filteredItems, - isFormValid, - error, - analyzeText, - setSelectedModel, - setSearchQuery, - setLaptopName, - setText, - } = useSentimentForm(); - - return ( -
- Masukkan ulasan produk laptop untuk menganalisis sentimennya menggunakan - model XGBoost -
- - -