Skip to content

Commit

Permalink
feat(gui): toast with prompt for cli install, rather than auto (#2173)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellie authored Jun 20, 2024
1 parent 9b82bba commit 1273889
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions ui/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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>
),
});
}
};
Expand Down

0 comments on commit 1273889

Please sign in to comment.