Skip to content

Commit

Permalink
fix(dashboard): updated database schema and form
Browse files Browse the repository at this point in the history
  • Loading branch information
Haxfx committed Mar 17, 2024
1 parent 47cccf5 commit 5f9f304
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 57 deletions.
59 changes: 3 additions & 56 deletions components/d3/Chart/ui/DetailScreen/DetailScreen.tsx
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -56,61 +56,8 @@ export const DetailScreen = ({ nodes }: TProps) => {
>
<Cross1Icon className="h4 w-4" />
</Button>
{selectedItems.map((item: Project) => (
<div key={item.id}>
<div className="flex items-center justify-between">
<div className="flex flex-col">
<h2 className="text-xl font-semibold text-gray-900">
{item.id} Details
</h2>
<h3 className="text-md font-normal text-gray-500">
{item.name}
</h3>
</div>
</div>
<div className="flex justify-between">
<Button
variant="ghost"
className="h-4 w-[50%] border-2 border-gray-700 px-3 py-5 font-semibold text-gray-700"
>
Content
</Button>
<Button
variant="ghost"
className="h-4 w-[50%] border-2 border-gray-200 px-3 py-5 font-semibold text-gray-500"
>
Details
</Button>
</div>
<div>
<span className="text-md text-gray-500">Labels</span>
<div>
{item.tags.map((label: any) => (
<Badge
variant="outline"
className="bg-orange-200 text-orange-600"
>
{label}
</Badge>
))}
</div>
</div>
<div className="mt-4">
<p className="text-sm text-gray-600">
<strong>Id:</strong> {item.id}
</p>
<p className="text-sm text-gray-600">
<strong>Type:</strong> {item.projectType}
</p>
<p className="text-sm text-gray-600">
<strong>Name:</strong> {item.name}
</p>
<p className="text-sm text-gray-600">
<strong>Community size:</strong> {item.communitySize}
</p>
{/* Add more node details here */}
</div>
</div>
{selectedItems.map((item: Project, key) => (
<ProjectCardDetails key={key} item={item} />
))}
</div>
</div>
Expand Down
5 changes: 4 additions & 1 deletion components/dashboard/create-project-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
}}
/>
</FormControl>
Expand Down
1 change: 1 addition & 0 deletions components/dashboard/dashboard-create-project-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export default function DashboardCreateProjectForm() {
placeholder="Token Supply"
{...field}
value={field.value || ""}
type="number"
/>
</FormControl>
<FormDescription>This is the url</FormDescription>
Expand Down
62 changes: 62 additions & 0 deletions components/project-card.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div key={key}>
<div className="flex items-center justify-between">
<div className="flex flex-col">
<h2 className="text-xl font-semibold text-gray-900">
{item.id} Details
</h2>
<h3 className="text-md font-normal text-gray-500">{item.name}</h3>
</div>
</div>
<div className="flex justify-between">
<Button
variant="ghost"
className="h-4 w-[50%] border-2 border-gray-700 px-3 py-5 font-semibold text-gray-700"
>
Content
</Button>
<Button
variant="ghost"
className="h-4 w-[50%] border-2 border-gray-200 px-3 py-5 font-semibold text-gray-500"
>
Details
</Button>
</div>
<div>
<span className="text-md text-gray-500">Labels</span>
<div>
{item.tags.map((label: any) => (
<Badge variant="outline" className="bg-orange-200 text-orange-600">
{label}
</Badge>
))}
</div>
</div>
<div className="mt-4">
<p className="text-sm text-gray-600">
<strong>Id:</strong> {item.id}
</p>
<p className="text-sm text-gray-600">
<strong>Type:</strong> {item.projectType}
</p>
<p className="text-sm text-gray-600">
<strong>Name:</strong> {item.name}
</p>
<p className="text-sm text-gray-600">
<strong>Community size:</strong> {item.communitySize}
</p>
{/* Add more node details here */}
</div>
</div>
)
}

0 comments on commit 5f9f304

Please sign in to comment.