Skip to content

Commit

Permalink
Make AssistantPicker able to show assistant details + fix links
Browse files Browse the repository at this point in the history
  • Loading branch information
Alban Dumouilla committed Jan 24, 2024
1 parent 951fe24 commit 8e56307
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion front/components/assistant/AssistantPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { useEffect, useState } from "react";

import { filterAndSortAgents } from "@app/lib/utils";

import { AssistantDetails } from "./AssistantDetails";

export function AssistantPicker({
owner,
assistants,
Expand All @@ -35,13 +37,30 @@ export function AssistantPicker({
}) {
const [searchText, setSearchText] = useState("");
const [searchedAssistants, setSearchedAssistants] = useState(assistants);
const [showDetails, setShowDetails] = useState<LightAgentConfigurationType | null>(null);

useEffect(() => {
setSearchedAssistants(filterAndSortAgents(assistants, searchText));
}, [searchText, assistants]);

return (
<DropdownMenu>

{showDetails && (
<AssistantDetails
owner={owner}
assistant={showDetails}
show={showDetails !== null}
onClose={() => {
setShowDetails(null);
}}
onUpdate={() => {
void mutateAgentConfigurations();
}}
flow="personal"
/>
)}

<div onClick={() => setSearchText("")} className="flex">
{pickerButton ? (
<DropdownMenu.Button size={size}>{pickerButton}</DropdownMenu.Button>
Expand Down Expand Up @@ -91,7 +110,7 @@ export function AssistantPicker({
/>
<IconButton
icon={MoreIcon}
onClick={() => {console.log('ellipsis clicked')}}
onClick={() => {setShowDetails(c);}}
variant="tertiary"
size="sm"
/>
Expand Down

0 comments on commit 8e56307

Please sign in to comment.