diff --git a/app/(customer)/dashboard/agents/[agentId]/page.tsx b/app/(customer)/dashboard/agents/[agentId]/page.tsx index 69211bc6..4015712a 100644 --- a/app/(customer)/dashboard/agents/[agentId]/page.tsx +++ b/app/(customer)/dashboard/agents/[agentId]/page.tsx @@ -13,18 +13,11 @@ import Link from "next/link"; export default async function RoutePage(props: PageParams<{ agentId: string }>) { - // const agent = await prisma.agent.findUnique({ - // where: { - // id: props.params.agentId, - // }, - // }) - - const agent = { - "id": props.params.agentId, - "name": "Agent 1", - "description": "My beautiful project!", - "lastContact": null, - } + const agent = await prisma.agent.findUnique({ + where: { + id: props.params.agentId, + }, + }) const backups = [ {'id': 'backup-1', 'createdAt': '2023-11-27T11:26:54.870914Z', 'status': 'pending'}, @@ -127,7 +120,7 @@ export default async function RoutePage(props: PageParams<{ agentId: string }>) Backup - Backup + Restoration diff --git a/app/(customer)/dashboard/agents/new/page.tsx b/app/(customer)/dashboard/agents/new/page.tsx index d3d330cd..d021180c 100644 --- a/app/(customer)/dashboard/agents/new/page.tsx +++ b/app/(customer)/dashboard/agents/new/page.tsx @@ -1,5 +1,5 @@ import {PageParams} from "@/types/next"; -import {Page, PageContent, PageDescription, PageHeader, PageTitle} from "@/features/layout/page"; +import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page"; import {AgentForm} from "@/components/wrappers/Agent/AgentForm/AgentForm"; diff --git a/app/(customer)/dashboard/agents/page.tsx b/app/(customer)/dashboard/agents/page.tsx index 38c883d5..a0da69ba 100644 --- a/app/(customer)/dashboard/agents/page.tsx +++ b/app/(customer)/dashboard/agents/page.tsx @@ -8,20 +8,7 @@ import {Page, PageActions, PageContent, PageHeader, PageTitle} from "@/features/ export default async function RoutePage(props: PageParams<{}>) { - // const agents = await prisma.agent.findMany({}) - - const agents = [ - {"id": "467911b6-1234-4321-8765-111111111111", "name": "My Agent 1", "lastContact": "null"}, - {"id": "15f03a2a-f81e-4339-bb3d-222222222222", "name": "My Agent 2", "lastContact": "null"}, - {"id": "2e9b6e1a-5678-9012-3456-333333333333", "name": "My Agent 3", "lastContact": "null"}, - {"id": "8c637541-1111-2222-3333-444444444444", "name": "My Agent 4", "lastContact": "null"}, - {"id": "9e02f789-5555-6666-7777-555555555555", "name": "My Agent 5", "lastContact": "null"}, - {"id": "1a2b3c4d-8888-9999-0000-666666666666", "name": "My Agent 6", "lastContact": "null"}, - {"id": "7d8e9f0g-3333-4444-5555-777777777777", "name": "My Agent 7", "lastContact": "null"}, - {"id": "3f4g5h6j-9999-0000-1111-888888888888", "name": "My Agent 8", "lastContact": "null"}, - {"id": "5c6d7e8f-2222-3333-4444-999999999999", "name": "My Agent 9", "lastContact": "null"}, - {"id": "9a0b1c2d-6666-7777-8888-000000000000", "name": "My Agent 10", "lastContact": "null"} - ] + const agents = await prisma.agent.findMany({}) return ( diff --git a/app/(customer)/dashboard/settings/page.tsx b/app/(customer)/dashboard/settings/page.tsx index 5da0066f..6cd018f0 100644 --- a/app/(customer)/dashboard/settings/page.tsx +++ b/app/(customer)/dashboard/settings/page.tsx @@ -1,15 +1,19 @@ import {PageParams} from "@/types/next"; +import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page"; + export default async function RoutePage(props: PageParams<{}>) { return ( -
-
-
-
-
-
-
-
+ + + + Settings + + + + content + + ) } \ No newline at end of file diff --git a/src/components/wrappers/Agent/AgentCard/AgentCard.tsx b/src/components/wrappers/Agent/AgentCard/AgentCard.tsx index 58e46654..12697872 100644 --- a/src/components/wrappers/Agent/AgentCard/AgentCard.tsx +++ b/src/components/wrappers/Agent/AgentCard/AgentCard.tsx @@ -2,23 +2,32 @@ import {Card, CardContent, CardHeader} from "@/components/ui/card"; import Link from "next/link"; +import {ValueIcon} from "@radix-ui/react-icons"; +import {Circle} from "lucide-react"; +import {ConnectionCircle} from "@/components/wrappers/connection-circle"; export type agentCardProps = { - id: string; - name: string; - lastContact: string; + data: any } export const AgentCard = (props: agentCardProps) => { - const {id, name, lastContact} = props; + const {data: agent} = props; return ( - - - {name} - Agent's Description + + +
+ {agent.name} + + Last contact : {agent.lastContact?.toDateString() ?? "Never connected"} + +
+
+ +
+ ) } \ No newline at end of file diff --git a/src/components/wrappers/Agent/AgentForm/AgentForm.tsx b/src/components/wrappers/Agent/AgentForm/AgentForm.tsx index 7ccce815..a6f25fb5 100644 --- a/src/components/wrappers/Agent/AgentForm/AgentForm.tsx +++ b/src/components/wrappers/Agent/AgentForm/AgentForm.tsx @@ -1,6 +1,6 @@ "use client"; -import {Card, CardContent, CardHeader, CardTitle} from "@/components/ui/card"; +import {Card, CardContent} from "@/components/ui/card"; import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useZodForm } from "@/components/ui/form"; @@ -62,22 +62,22 @@ export const AgentForm = (props: agentFormProps) => { await mutation.mutateAsync(values); }} > - ( - - Name - - - - {"Your agent project name"} - - - )} - /> + ( + + Name + + + + {"Your agent project name"} + + + )} + /> { { - const value = e.target.value.replaceAll(" ", "-").toLowerCase() - field.onChange(value) - }} + onChange={(e) => { + const value = e.target.value.replaceAll(" ", "-").toLowerCase() + field.onChange(value) + }} /> {'The slug is used in the url of the agent'} diff --git a/src/components/wrappers/cards-with-pagination.tsx b/src/components/wrappers/cards-with-pagination.tsx index 4c78ed2a..489f5de7 100644 --- a/src/components/wrappers/cards-with-pagination.tsx +++ b/src/components/wrappers/cards-with-pagination.tsx @@ -45,7 +45,7 @@ export const CardsWithPagination = (props: cardsWithPaginationProps) => {
{currentCards.map((card, key) => ( - + ))}
{ + + let style = ""; + + const interval = new Date().getTime() - new Date(date).getTime() + + if (interval < 10000) { + style = "bg-green-400 border-green-600" + } else if (1000 <= interval && interval <= 20000) { + style = "bg-orange-400 border-orange-600" + } else { + style = "bg-red-400 border-red-600" + } + + return ( +
+ ) +} \ No newline at end of file diff --git a/src/components/wrappers/dialog.tsx b/src/components/wrappers/dialog.tsx new file mode 100644 index 00000000..3bb4f240 --- /dev/null +++ b/src/components/wrappers/dialog.tsx @@ -0,0 +1,44 @@ +"use client" + +import {Button} from "@/components/ui/button" +import { + Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle +} from "@/components/ui/dialog" +import {Input} from "@/components/ui/input" +import {Label} from "@/components/ui/label" + + +export type agentRegistrationDialogProps = { + open: boolean, + setOpen: (open: boolean) => void, +} + + +export const AgentRegistrationDialog = (props: agentRegistrationDialogProps) => { + + const {open, setOpen} = props; + + return ( + + + + + + New agent registered! + + +
+
+ + +
+
+ + + +
+
+ ) +} \ No newline at end of file diff --git a/src/features/backup/columns.tsx b/src/features/backup/columns.tsx index 30bb2d26..fa5e8596 100644 --- a/src/features/backup/columns.tsx +++ b/src/features/backup/columns.tsx @@ -10,7 +10,8 @@ import { DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import {Button} from "@/components/ui/button"; -import {MoreHorizontal} from "lucide-react"; +import {Download, MoreHorizontal, Trash2} from "lucide-react"; +import {ReloadIcon} from "@radix-ui/react-icons"; export type Backup = { id: string @@ -52,14 +53,24 @@ export const backupColumns: ColumnDef[] = [ Actions - navigator.clipboard.writeText(payment.id)} - > - Copy payment ID + + { + }}> + Restore + + { + }}> + Download + + - View customer - View payment details + + { + }}> + Delete + + ) diff --git a/src/features/restore/columns.tsx b/src/features/restore/columns.tsx index afd84d69..0305fd28 100644 --- a/src/features/restore/columns.tsx +++ b/src/features/restore/columns.tsx @@ -10,7 +10,8 @@ import { DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import {Button} from "@/components/ui/button"; -import {MoreHorizontal} from "lucide-react"; +import {Download, MoreHorizontal, Trash2} from "lucide-react"; +import {ReloadIcon} from "@radix-ui/react-icons"; export type Restore = { id: string @@ -52,14 +53,13 @@ export const restoreColumns: ColumnDef[] = [ Actions - navigator.clipboard.writeText(payment.id)} - > - Copy payment ID + + { + }}> + Rerun - - View customer - View payment details + + )