From 12738895ffaae09a38b54fc209e3dcaecd6607ec Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Thu, 20 Jun 2024 15:54:45 +0100 Subject: [PATCH] feat(gui): toast with prompt for cli install, rather than auto (#2173) --- ui/src/pages/Home.tsx | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/ui/src/pages/Home.tsx b/ui/src/pages/Home.tsx index 750db969..04bd768e 100644 --- a/ui/src/pages/Home.tsx +++ b/ui/src/pages/Home.tsx @@ -4,6 +4,7 @@ import { Tooltip as ReactTooltip } from "react-tooltip"; import { useStore } from "@/state/store"; import { useToast } from "@/components/ui/use-toast"; +import { ToastAction } from "@/components/ui/toast"; import { invoke } from "@tauri-apps/api/core"; import ActivityCalendar from "react-activity-calendar"; @@ -76,18 +77,34 @@ export default function Home() { if (!installed) { toast({ title: "Atuin CLI", - description: "Started CLI setup and installation...", - }); + description: "CLI not detected - install?", + action: ( + { + let install = async () => { + toast({ + title: "Atuin CLI", + description: "Install in progress...", + }); - console.log("Installing CLI..."); - await invoke("install_cli"); + console.log("Installing CLI..."); + await invoke("install_cli"); - console.log("Setting up plugin..."); - await invoke("setup_cli"); + console.log("Setting up plugin..."); + await invoke("setup_cli"); - toast({ - title: "Atuin CLI", - description: "Installation complete", + toast({ + title: "Atuin CLI", + description: "Installation complete", + }); + }; + install(); + }} + > + Install + + ), }); } };