Skip to content

Commit

Permalink
RHCLOUD-29601 Allow to minimize the assistant (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
josejulio authored Dec 11, 2023
1 parent 0ed46b1 commit 9580d2f
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,23 @@ import { commandMessageProcessor } from './CommandMessageProcessor';
const messageProcessors = [commandMessageProcessor];

export const AstroVirtualAssistant: FunctionComponent = () => {
const { messages, ask, start, stop, status } = useAstro(messageProcessors);
const { messages, ask, start, status } = useAstro(messageProcessors);
const [isOpen, setOpen] = useState<boolean>(false);
const chrome = useChrome();

useEffect(() => {
if (isOpen) {
void start();
} else {
void stop();
}
}, [isOpen]);

return (
<Stack className="astro-wrapper-stack">
<StackItem className="pf-v5-u-box-shadow-lg">
{status === Status.STARTED && (
{status === Status.STARTED && isOpen && (
<AstroChat key="astro-chat" messages={messages} ask={ask} preview={chrome.isBeta()} onClose={() => setOpen(false)} />
)}
{status === Status.LOADING && <AstroChatSkeleton />}
{status === Status.LOADING && isOpen && <AstroChatSkeleton />}
</StackItem>
<StackItem className="astro-wrapper-stack__badge">
<AstroBadge onClick={() => setOpen((prev) => !prev)} />
Expand Down

0 comments on commit 9580d2f

Please sign in to comment.