import { ArrowUpSquareIcon, BellFilledIcon, BellIcon, DepotFilledIcon, DepotIcon, HomeFilledIcon, HomeIcon, PlusIcon, SearchFilledIcon, SearchIcon, SettingsFilledIcon, 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"; 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 (
{({ isActive }) => (
{isActive ? ( ) : ( )}
)}
{({ isActive }) => (
{isActive ? ( ) : ( )}
)}
{({ isActive }) => (
{isActive ? ( ) : ( )}
)}
{update ? ( ) : null} {({ isActive }) => (
{isActive ? ( ) : ( )}
)}
); }