From 5f9f304aada15e6710fde5ce142ae310b285da0a Mon Sep 17 00:00:00 2001 From: Haxfx Date: Sun, 17 Mar 2024 09:27:32 +0100 Subject: [PATCH] fix(dashboard): updated database schema and form --- .../d3/Chart/ui/DetailScreen/DetailScreen.tsx | 59 +----------------- components/dashboard/create-project-form.tsx | 5 +- .../dashboard-create-project-form.tsx | 1 + components/project-card.tsx | 62 +++++++++++++++++++ 4 files changed, 70 insertions(+), 57 deletions(-) create mode 100644 components/project-card.tsx diff --git a/components/d3/Chart/ui/DetailScreen/DetailScreen.tsx b/components/d3/Chart/ui/DetailScreen/DetailScreen.tsx index 2ad745b..1dce85d 100644 --- a/components/d3/Chart/ui/DetailScreen/DetailScreen.tsx +++ b/components/d3/Chart/ui/DetailScreen/DetailScreen.tsx @@ -1,4 +1,4 @@ -import { Badge } from "@/components/ui/badge" +import { ProjectCardDetails } from "@/components/project-card" import { Button } from "@/components/ui/button" import { Project } from "@/database/schemas/projects.schema" import { Cross1Icon } from "@radix-ui/react-icons" @@ -56,61 +56,8 @@ export const DetailScreen = ({ nodes }: TProps) => { > - {selectedItems.map((item: Project) => ( -
-
-
-

- {item.id} Details -

-

- {item.name} -

-
-
-
- - -
-
- Labels -
- {item.tags.map((label: any) => ( - - {label} - - ))} -
-
-
-

- Id: {item.id} -

-

- Type: {item.projectType} -

-

- Name: {item.name} -

-

- Community size: {item.communitySize} -

- {/* Add more node details here */} -
-
+ {selectedItems.map((item: Project, key) => ( + ))} diff --git a/components/dashboard/create-project-form.tsx b/components/dashboard/create-project-form.tsx index 27dc7fd..88c6bb0 100644 --- a/components/dashboard/create-project-form.tsx +++ b/components/dashboard/create-project-form.tsx @@ -356,9 +356,12 @@ export default function CreateProjectForm({ placeholder="Token Supply" {...field} value={field.value || ""} + type="number" onChange={(e) => { const value = e.target.value.replace(/[^\d]/g, "") - field.onChange(value === "" ? undefined : value) + field.onChange( + value === "" ? undefined : parseInt(value) + ) }} /> diff --git a/components/dashboard/dashboard-create-project-form.tsx b/components/dashboard/dashboard-create-project-form.tsx index f86114a..a91555e 100644 --- a/components/dashboard/dashboard-create-project-form.tsx +++ b/components/dashboard/dashboard-create-project-form.tsx @@ -185,6 +185,7 @@ export default function DashboardCreateProjectForm() { placeholder="Token Supply" {...field} value={field.value || ""} + type="number" /> This is the url diff --git a/components/project-card.tsx b/components/project-card.tsx new file mode 100644 index 0000000..4c8d395 --- /dev/null +++ b/components/project-card.tsx @@ -0,0 +1,62 @@ +import { Project } from "@/database/schemas/projects.schema" +import { Badge } from "./ui/badge" +import { Button } from "./ui/button" + +type Props = { + key: number + item: Project +} + +export const ProjectCardDetails = ({ key, item }: Props) => { + return ( +
+
+
+

+ {item.id} Details +

+

{item.name}

+
+
+
+ + +
+
+ Labels +
+ {item.tags.map((label: any) => ( + + {label} + + ))} +
+
+
+

+ Id: {item.id} +

+

+ Type: {item.projectType} +

+

+ Name: {item.name} +

+

+ Community size: {item.communitySize} +

+ {/* Add more node details here */} +
+
+ ) +}