aboutsummaryrefslogtreecommitdiffstats
path: root/ui/src/pages/Home.tsx
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@elliehuxtable.com>2024-06-17 15:36:38 +0100
committerGitHub <noreply@github.com>2024-06-17 15:36:38 +0100
commit88633b8994437180afdd66068cc2c8f02aea1db1 (patch)
tree6df7ead44d8cb3c219dd43d0ee86256f4a6025ef /ui/src/pages/Home.tsx
parentchore(deps): bump lucide-react from 0.394.0 to 0.395.0 in /ui (#2148) (diff)
downloadatuin-88633b8994437180afdd66068cc2c8f02aea1db1.zip
feat(gui): automatically install and setup the cli/shell (#2139)
* feat(gui): automatically install and setup the cli/shell * add shell config and toasts
Diffstat (limited to 'ui/src/pages/Home.tsx')
-rw-r--r--ui/src/pages/Home.tsx28
1 files changed, 28 insertions, 0 deletions
diff --git a/ui/src/pages/Home.tsx b/ui/src/pages/Home.tsx
index 93f2bf93..00752326 100644
--- a/ui/src/pages/Home.tsx
+++ b/ui/src/pages/Home.tsx
@@ -2,6 +2,8 @@ import { useEffect } from "react";
import { formatRelative } from "date-fns";
import { useStore } from "@/state/store";
+import { useToast } from "@/components/ui/use-toast";
+import { invoke } from "@tauri-apps/api/core";
function Stats({ stats }: any) {
return (
@@ -47,10 +49,36 @@ export default function Home() {
const user = useStore((state) => state.user);
const refreshHomeInfo = useStore((state) => state.refreshHomeInfo);
const refreshUser = useStore((state) => state.refreshUser);
+ const { toast } = useToast();
useEffect(() => {
refreshHomeInfo();
refreshUser();
+
+ let setup = async () => {
+ let installed = await invoke("is_cli_installed");
+ console.log("CLI installation status:", installed);
+
+ 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",
+ });
+ }
+ };
+
+ setup();
}, []);
if (!homeInfo) {