diff options
author | Ellie Huxtable <ellie@elliehuxtable.com> | 2024-06-20 15:54:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 15:54:45 +0100 |
commit | 12738895ffaae09a38b54fc209e3dcaecd6607ec (patch) | |
tree | 5b8731523f658e419068682ecbe362bea37105c8 | |
parent | 9b82bba53f3e9eab26eb9af700027342d8a02ce5 (diff) |
feat(gui): toast with prompt for cli install, rather than auto (#2173)
-rw-r--r-- | ui/src/pages/Home.tsx | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/ui/src/pages/Home.tsx b/ui/src/pages/Home.tsx index 750db969c..04bd768e7 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...", - }); - - console.log("Installing CLI..."); - await invoke("install_cli"); - - console.log("Setting up plugin..."); - await invoke("setup_cli"); - - toast({ - title: "Atuin CLI", - description: "Installation complete", + description: "CLI not detected - install?", + action: ( + <ToastAction + altText="Install" + onClick={() => { + let install = async () => { + toast({ + title: "Atuin CLI", + description: "Install in progress...", + }); + + console.log("Installing CLI..."); + await invoke("install_cli"); + + console.log("Setting up plugin..."); + await invoke("setup_cli"); + + toast({ + title: "Atuin CLI", + description: "Installation complete", + }); + }; + install(); + }} + > + Install + </ToastAction> + ), }); } }; |