From 0c37e959ce36e95302edb8d050334128572f1a53 Mon Sep 17 00:00:00 2001 From: Jules Belveze <32683010+JulesBelveze@users.noreply.github.com> Date: Thu, 2 Jan 2025 10:31:55 +0100 Subject: [PATCH] [front] - fix: assistant details modal (#9685) * [front/components/assistant] - refactor: replace ElementModal with Sheet component in AssistantDetails - Introduced useState hook for tracking the Sheet's open state and useEffect hook to set this state based on the assistantId - Updated AssistantDetails to use the Sheet component for modal functionality, enhancing the UX with a new sliding panel design - Removed the now-obsolete ElementModal import and related attributes in favor of Sheet related components and attributes * [front/assistant] - refactor: streamline AssistantDetails component state management - Removed unused isOpen state variable and useEffect for setting modal open state - Modified conditionals to use optional chaining for cleaner access to agentConfiguration properties - Ensure Sheet component open state is dependent on the existence of an assistantId - Conditional rendering of the AssistantUsageSection now checks for the existence of agentConfiguration directly --- .../components/assistant/AssistantDetails.tsx | 73 ++++++++++--------- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/front/components/assistant/AssistantDetails.tsx b/front/components/assistant/AssistantDetails.tsx index 39cb30e59b95..e9e0deb58b55 100644 --- a/front/components/assistant/AssistantDetails.tsx +++ b/front/components/assistant/AssistantDetails.tsx @@ -1,9 +1,13 @@ import { Avatar, ContentMessage, - ElementModal, InformationCircleIcon, Page, + Sheet, + SheetContainer, + SheetContent, + SheetHeader, + SheetTitle, } from "@dust-tt/sparkle"; import type { AgentConfigurationScope, WorkspaceType } from "@dust-tt/types"; import { useCallback, useState } from "react"; @@ -52,26 +56,24 @@ export function AssistantDetails({ [doUpdateScope] ); - if (!agentConfiguration) { - return <>; - } - const DescriptionSection = () => (
20 ? "text-md" : "text-lg" + agentConfiguration?.name && agentConfiguration.name.length > 20 + ? "text-md" + : "text-lg" )} - >{`@${agentConfiguration.name}`}
- {agentConfiguration.status === "active" && ( + >{`@${agentConfiguration?.name ?? ""}`}
+ {agentConfiguration?.status === "active" && (
- {agentConfiguration.status === "active" && ( + {agentConfiguration?.status === "active" && ( )} - {agentConfiguration.status === "archived" && ( + {agentConfiguration?.status === "archived" && ( - {agentConfiguration.description} + {agentConfiguration?.description}
- + {agentConfiguration && ( + + )} ); const InstructionsSection = () => - agentConfiguration.instructions ? ( + agentConfiguration?.instructions ? (
Instructions
@@ -124,21 +128,24 @@ export function AssistantDetails({ ); return ( - onClose()} - hasChanged={false} - variant="side-sm" - > -
- - - -
-
+ + + + + + + {agentConfiguration && ( +
+ + + +
+ )} +
+
+
); }