diff --git a/packages/icons/index.ts b/packages/icons/index.ts index 96c9d564..1fb805ef 100644 --- a/packages/icons/index.ts +++ b/packages/icons/index.ts @@ -112,3 +112,4 @@ export * from "./src/editInterest"; export * from "./src/newColumn"; export * from "./src/searchFilled"; export * from "./src/arrowUp"; +export * from "./src/arrowUpSquare"; diff --git a/packages/icons/src/arrowUpSquare.tsx b/packages/icons/src/arrowUpSquare.tsx new file mode 100644 index 00000000..d035e087 --- /dev/null +++ b/packages/icons/src/arrowUpSquare.tsx @@ -0,0 +1,24 @@ +import { SVGProps } from "react"; + +export function ArrowUpSquareIcon( + props: JSX.IntrinsicAttributes & SVGProps, +) { + return ( + + + + ); +} diff --git a/packages/ui/src/navigation.tsx b/packages/ui/src/navigation.tsx index b89d0eea..5367ec80 100644 --- a/packages/ui/src/navigation.tsx +++ b/packages/ui/src/navigation.tsx @@ -1,7 +1,7 @@ import { + ArrowUpSquareIcon, BellFilledIcon, BellIcon, - ComposeFilledIcon, DepotFilledIcon, DepotIcon, HomeFilledIcon, @@ -13,7 +13,11 @@ import { SettingsIcon, } from "@lume/icons"; import { cn, editorAtom, searchAtom } from "@lume/utils"; +import { confirm } from "@tauri-apps/plugin-dialog"; +import { relaunch } from "@tauri-apps/plugin-process"; +import { Update, check } from "@tauri-apps/plugin-updater"; import { useAtom } from "jotai"; +import { useEffect, useState } from "react"; import { useHotkeys } from "react-hotkeys-hook"; import { NavLink } from "react-router-dom"; import { ActiveAccount } from "./account/active"; @@ -22,10 +26,33 @@ import { UnreadActivity } from "./unread"; export function Navigation() { const [isEditorOpen, setIsEditorOpen] = useAtom(editorAtom); const [search, setSearch] = useAtom(searchAtom); + const [update, setUpdate] = useState(null); // shortcut for editor useHotkeys("meta+n", () => setIsEditorOpen((state) => !state), []); + const installNewUpdate = async () => { + if (!update) return; + + const yes = await confirm(update.body, { + title: `v${update.version} is available`, + type: "info", + }); + + if (yes) { + await update.downloadAndInstall(); + await relaunch(); + } + }; + + useEffect(() => { + async function checkNewUpdate() { + const newVersion = await check(); + setUpdate(newVersion); + } + checkNewUpdate(); + }, []); + return (
+ {update ? ( + + ) : null}