From da42cd48ac80f0d19624e41f90704eb2b18ea064 Mon Sep 17 00:00:00 2001 From: Mahen Date: Sat, 14 Feb 2026 10:27:50 +0700 Subject: [PATCH] style: improve profile card UI --- .../migration.sql | 8 + prisma/schema.prisma | 1 - src/app/profile/lib/action.ts | 20 +- src/app/profile/page.tsx | 13 +- src/components/dashboards/AnalysisClient.tsx | 26 ++- src/components/dashboards/CustomToolTip.tsx | 7 +- src/components/dashboards/DashboardClient.tsx | 20 +- src/components/dashboards/Footer.tsx | 18 ++ src/components/dashboards/ModelInfo.tsx | 2 +- src/components/dashboards/ProfileCard.tsx | 166 ++++++++++++++ src/components/dashboards/ProfileClient.tsx | 85 ++----- src/components/dashboards/ResultSection.tsx | 11 +- .../dashboards/SentimentAnalyzer.tsx | 212 ------------------ src/components/dashboards/WordCloudItem.tsx | 2 +- .../skeletons/ModelInfoSkeleton.tsx | 2 +- src/hooks/useSentimentForm.ts | 2 +- src/hooks/useTrendChart.ts | 9 - src/hooks/useWordCloud.ts | 2 +- src/types/index.ts | 15 +- src/utils/const.ts | 28 +++ src/utils/dImports.ts | 8 +- src/utils/datas.ts | 52 +++-- 22 files changed, 318 insertions(+), 391 deletions(-) create mode 100644 prisma/migrations/20260214025107_delete_model_version_rows/migration.sql create mode 100644 src/components/dashboards/Footer.tsx create mode 100644 src/components/dashboards/ProfileCard.tsx delete mode 100644 src/components/dashboards/SentimentAnalyzer.tsx delete mode 100644 src/hooks/useTrendChart.ts create mode 100644 src/utils/const.ts 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 ( - <> +
- - + +
); } diff --git a/src/components/dashboards/AnalysisClient.tsx b/src/components/dashboards/AnalysisClient.tsx index ae78771..07cf614 100644 --- a/src/components/dashboards/AnalysisClient.tsx +++ b/src/components/dashboards/AnalysisClient.tsx @@ -12,7 +12,7 @@ import { import { Input } from "../ui/input"; import { Button } from "../ui/button"; import ResultSection from "./ResultSection"; -import { professions } from "@/src/utils/datas"; +import { professions } from "@/src/utils/const"; export default function AnalysisClient() { const { @@ -49,18 +49,30 @@ export default function AnalysisClient() { - + - {professions.map((item) => ( - - {item.label} - - ))} + {professions.map((item) => { + const PIcon = item.icon; + return ( + +
+ + + + {item.label} +
+
+ ); + })}
diff --git a/src/components/dashboards/CustomToolTip.tsx b/src/components/dashboards/CustomToolTip.tsx index 68e42c2..5ce5ab6 100644 --- a/src/components/dashboards/CustomToolTip.tsx +++ b/src/components/dashboards/CustomToolTip.tsx @@ -1,11 +1,6 @@ import { CustomTooltipProps } from "@/src/types"; -import React from "react"; -const CustomTooltip: React.FC = ({ - active, - payload, - total, -}) => { +const CustomTooltip = ({ active, payload, total }: CustomTooltipProps) => { if (active && payload && payload.length) { const item = payload[0].payload; const percentage = ((item.value / total) * 100).toFixed(1); diff --git a/src/components/dashboards/DashboardClient.tsx b/src/components/dashboards/DashboardClient.tsx index b389a2e..2409af9 100644 --- a/src/components/dashboards/DashboardClient.tsx +++ b/src/components/dashboards/DashboardClient.tsx @@ -14,11 +14,9 @@ import { BrandFilter } from "./BrandFilter"; import { ReviewTable } from "./ReviewTable"; import { SentimentChart, TrendChart } from "@/src/utils/dImports"; import { useDashboards } from "@/src/hooks/useDashboard"; -import SentimentForm from "./SentimentAnalyzer"; import { WordCloud } from "./WordCloud"; -import AnalysisPage from "@/src/app/analyze/page"; -import SentimentAnalyzer from "./SentimentAnalyzer"; import AnalysisClient from "./AnalysisClient"; +import Footer from "./Footer"; export default function DashboardClient() { const { @@ -133,7 +131,6 @@ export default function DashboardClient() {
- {/* */}
@@ -154,20 +151,7 @@ export default function DashboardClient() { -
-
-
-

- SentiLaptop - Analisis Sentimen -

-

Skripsi oleh Syafrizal Wd Mahendra (E41222719)

-
-
-

Politeknik Negeri Jember

-

PSDKU Teknik Informatika Kampus 3 Nganjuk

-
-
-
+