fix: server/client error on some dialogs.

This commit is contained in:
charlesgauthereau
2026-01-29 23:11:33 +01:00
parent 95a60e9a96
commit 30b9fc7765
4 changed files with 43 additions and 39 deletions
@@ -1,8 +1,5 @@
import Link from "next/link";
import {GearIcon} from "@radix-ui/react-icons";
import {PageParams} from "@/types/next";
import {Page, PageActions, PageContent, PageDescription, PageTitle} from "@/features/layout/page";
import {buttonVariants} from "@/components/ui/button";
import {Page, PageContent, PageDescription, PageTitle} from "@/features/layout/page";
import {db} from "@/db";
import * as drizzleDb from "@/db";
import {eq} from "drizzle-orm";
@@ -39,18 +36,14 @@ export default async function RoutePage(props: PageParams<{ agentId: string }>)
<div className="min-w-full md:min-w-fit ">
{capitalizeFirstLetter(agent.name)}
</div>
<div className="flex items-center gap-2 md:justify-between w-full ">
<div className="flex items-center gap-2">
<AgentDialog agent={agent as AgentType & { id: string }}>
<div className={buttonVariants({variant: "outline", className: "cursor-pointer"})}>
<GearIcon className="w-7 h-7"/>
</div>
</AgentDialog>
</div>
<div className="flex items-center gap-2">
<ButtonDeleteAgent agentId={agentId} text={"Delete Agent"}/>
</div>
<div className="flex items-center gap-2 md:justify-between w-full ">
<div className="flex items-center gap-2">
<AgentDialog agent={agent as AgentType & { id: string }} typeTrigger={"edit"}/>
</div>
<div className="flex items-center gap-2">
<ButtonDeleteAgent agentId={agentId} text={"Delete Agent"}/>
</div>
</div>
</PageTitle>
</div>
@@ -1,13 +1,11 @@
import {PageParams} from "@/types/next";
import {AgentCard} from "@/components/wrappers/dashboard/agent/agent-card/agent-card";
import {CardsWithPagination} from "@/components/wrappers/common/cards-with-pagination";
import {Button} from "@/components/ui/button";
import {Page, PageActions, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
import {notFound} from "next/navigation";
import {db} from "@/db";
import * as drizzleDb from "@/db";
import {desc, eq, not} from "drizzle-orm";
import {EmptyStatePlaceholder} from "@/components/wrappers/common/empty-state-placeholder";
import {Metadata} from "next";
import {AgentDialog} from "@/features/agents/components/agent.dialog";
@@ -25,7 +23,6 @@ export default async function RoutePage(props: PageParams<{}>) {
orderBy: (fields) => desc(fields.lastContact),
});
if (!agents) {
notFound();
}
@@ -36,9 +33,7 @@ export default async function RoutePage(props: PageParams<{}>) {
<PageTitle>Agents</PageTitle>
{agents.length > 0 && (
<PageActions>
<AgentDialog>
<Button>+ Create Agent</Button>
</AgentDialog>
<AgentDialog typeTrigger={"create"} />
</PageActions>
)}
</PageHeader>
@@ -46,11 +41,7 @@ export default async function RoutePage(props: PageParams<{}>) {
{agents.length > 0 ? (
<CardsWithPagination data={agents} cardItem={AgentCard} cardsPerPage={4} numberOfColumns={1}/>
) : (
<AgentDialog>
<EmptyStatePlaceholder
text={"Create new Agent"}
/>
</AgentDialog>
<AgentDialog typeTrigger="empty"/>
)}
</PageContent>
</Page>