From 0a76a1eeb1cca891a6a221ec728986e1eb36d5e4 Mon Sep 17 00:00:00 2001 From: Alban Dumouilla Date: Wed, 24 Jan 2024 17:04:57 +0100 Subject: [PATCH] Add ellipsis to assistant picker + link fixes (#3410) * Assistant picker wording and link fix * Add ellipsis visual to Item.Avatar * Add ellipsis onclick handling * Fix missing ellipsis props * Spacing changes * Make prettier happy * Flow link on create * Move ellipsis to action in storybook * Add ellipsis in assistantsPicker directly * Make AssistantPicker able to show assistant details + fix links * Get ellipsis iconbutton out of the main link in assistantsPicker * Linter check pass * Remove unused storybook story * Cleanup stories * Add mutateAgentConfigurations to assistantpicker * Move mutateAgentConfigurations to AssistantDetails * Fix conflicts * Fix conflicts with Ed's PR * Use @app based import * Put back from query param * Linter --------- Co-authored-by: Alban Dumouilla --- .../components/assistant/AssistantDetails.tsx | 11 +++- .../components/assistant/AssistantPicker.tsx | 59 +++++++++++++++---- front/pages/w/[wId]/assistant/assistants.tsx | 3 - front/pages/w/[wId]/assistant/gallery.tsx | 3 - front/pages/w/[wId]/assistant/new.tsx | 12 ++-- 5 files changed, 58 insertions(+), 30 deletions(-) diff --git a/front/components/assistant/AssistantDetails.tsx b/front/components/assistant/AssistantDetails.tsx index 523fce84964a..4a7be763419a 100644 --- a/front/components/assistant/AssistantDetails.tsx +++ b/front/components/assistant/AssistantDetails.tsx @@ -37,6 +37,7 @@ import { SendNotificationsContext } from "@app/components/sparkle/Notification"; import { assistantUsageMessage } from "@app/lib/assistant"; import { CONNECTOR_CONFIGURATIONS } from "@app/lib/connector_providers"; import { useAgentConfiguration, useAgentUsage, useApp } from "@app/lib/swr"; +import { useAgentConfigurations } from "@app/lib/swr"; import type { PostAgentListStatusRequestBody } from "@app/pages/api/w/[wId]/members/me/agent_list_status"; type AssistantDetailsFlow = "personal" | "workspace"; @@ -46,14 +47,12 @@ export function AssistantDetails({ assistant, show, onClose, - onUpdate, flow, }: { owner: WorkspaceType; assistant: LightAgentConfigurationType; show: boolean; onClose: () => void; - onUpdate: () => void; flow: AssistantDetailsFlow; }) { const agentUsage = useAgentUsage({ @@ -126,6 +125,12 @@ export function AssistantDetails({ ) : null ) : null; + const { mutateAgentConfigurations } = useAgentConfigurations({ + workspaceId: owner.sId, + agentsGetView: "list", + includes: ["authors"], + }); + return ( diff --git a/front/components/assistant/AssistantPicker.tsx b/front/components/assistant/AssistantPicker.tsx index 14a48360e787..ba26df640274 100644 --- a/front/components/assistant/AssistantPicker.tsx +++ b/front/components/assistant/AssistantPicker.tsx @@ -1,8 +1,10 @@ import { Button, DropdownMenu, + IconButton, Item, ListIcon, + MoreIcon, PlusIcon, RobotIcon, Searchbar, @@ -14,6 +16,7 @@ import type { import Link from "next/link"; import { useEffect, useState } from "react"; +import { AssistantDetails } from "@app/components/assistant/AssistantDetails"; import { filterAndSortAgents } from "@app/lib/utils"; export function AssistantPicker({ @@ -32,6 +35,8 @@ export function AssistantPicker({ }) { const [searchText, setSearchText] = useState(""); const [searchedAssistants, setSearchedAssistants] = useState(assistants); + const [showDetails, setShowDetails] = + useState(null); useEffect(() => { setSearchedAssistants(filterAndSortAgents(assistants, searchText)); @@ -39,6 +44,18 @@ export function AssistantPicker({ return ( + {showDetails && ( + { + setShowDetails(null); + }} + flow="personal" + /> + )} +
setSearchText("")} className="flex"> {pickerButton ? ( {pickerButton} @@ -53,7 +70,7 @@ export function AssistantPicker({
{assistants.length > 7 && ( @@ -77,18 +94,21 @@ export function AssistantPicker({ } bottomBar={
- +