Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

feat: add reusable system info and release updates

tianma-if3ae3972c4b1c
diff --git a/apps/web/src/app/App.tsx b/apps/web/src/app/App.tsx
index f1a24f22..d9fc7201 100644
--- a/apps/web/src/app/App.tsx
+++ b/apps/web/src/app/App.tsx
@@ -3,6 +3,7 @@ import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { Navigate, Route, Routes, useNavigate } from "react-router";
import { useTranslation } from "react-i18next";
import { PwaUpdateNotice } from "@/components/PwaUpdateNotice";
+import { ReleaseUpdateNotice } from "@/components/ReleaseUpdateNotice";
import { PwaInstallProvider } from "@/components/PwaInstallContext";
import { PwaIosPrompt } from "@/components/PwaIosPrompt";
import { api, ApiRequestError } from "@/lib/api";
@@ -124,13 +125,16 @@ const AuthenticatedWorkspace = () => {
return (
<Suspense fallback={<AuthLoadingScreen />}>
- <WorkspaceApp
- authRequired={session.authRequired}
- demoMode={session.demoMode}
- isLoggingOut={logoutMutation.isPending}
- user={session.user}
- onLogout={() => logoutMutation.mutate()}
- />
+ <>
+ <WorkspaceApp
+ authRequired={session.authRequired}
+ demoMode={session.demoMode}
+ isLoggingOut={logoutMutation.isPending}
+ user={session.user}
+ onLogout={() => logoutMutation.mutate()}
+ />
+ <ReleaseUpdateNotice />
+ </>
</Suspense>
);
};
diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsx
index 16623ea8..fb406f5d 100644
--- a/apps/web/src/components/EditorPane.tsx
+++ b/apps/web/src/components/EditorPane.tsx
@@ -30,6 +30,7 @@ import {
Check,
CircleAlert,
LoaderCircle,
+ Info,
} from "lucide-react";
import { Button } from "@/components/ui/button";
import { GitHubRepositoryLink } from "@/components/GitHubRepositoryLink";
@@ -91,6 +92,9 @@ import {
} from "@/lib/app-helpers";
import { copyEditorToWeChat, copyMarkdownToWeChat } from "@/lib/wechat-copy";
import { ThemeBlock } from "./ThemeBlock";
+import { SystemInfoDialog } from "./SystemInfoDialog";
+import { fetchLatestRelease, isVersionOutdated } from "@/lib/version-check";
+import { RELEASE_STATUS_EVENT } from "@/lib/release-notice";
const SUPPORTED_PASTE_IMAGE_TYPES = new Set(["image/png", "image/jpeg", "image/gif", "image/webp", "image/avif"]);
const MOBILE_EDITOR_QUERY = "(max-width: 639px)";
@@ -1135,6 +1139,8 @@ const RichEditorPane = ({
const [editorContentVersion, setEditorContentVersion] = useState(0);
const [imageUploadState, setImageUploadState] = useState<"idle" | "compressing" | "uploading" | "error">("idle");
const [historyOpen, setHistoryOpen] = useState(false);
+ const [systemInfoOpen, setSystemInfoOpen] = useState(false);
+ const [updateAvailable, setUpdateAvailable] = useState(false);
const [mobileNotebookSheetOpen, setMobileNotebookSheetOpen] = useState(false);
const [notebookUpdatePending, setNotebookUpdatePending] = useState(false);
const [noteSearchOpen, setNoteSearchOpen] = useState(false);
@@ -1158,6 +1164,19 @@ const RichEditorPane = ({
const readOnly = isTrashView || Boolean(memo?.isDeleted);
const mobileDefaultEditRequested = Boolean(memo?.id && memo.id === mobileDefaultEditMemoId && !readOnly);
const mobileEditingActive = isMobileEditing || mobileDefaultEditRequested;
+
+ useEffect(() => {
+ const controller = new AbortController();
+ void fetchLatestRelease(controller.signal)
+ .then((release) => setUpdateAvailable(isVersionOutdated(__EDGEEVER_APP_VERSION__, release.tagName)))
+ .catch(() => undefined);
+ const handleReleaseStatus = () => setUpdateAvailable(true);
+ window.addEventListener(RELEASE_STATUS_EVENT, handleReleaseStatus);
+ return () => {
+ controller.abort();
+ window.removeEventListener(RELEASE_STATUS_EVENT, handleReleaseStatus);
+ };
+ }, []);
const effectiveReadOnly = readOnly || (isMobileViewport && !mobileEditingActive);
const useMobilePlainTextEditor = isMobileViewport && mobileEditingActive && !readOnly;
const useMarkdownSourceEditor = !useMobilePlainTextEditor && isMarkdownMode;
@@ -2636,6 +2655,10 @@ const RichEditorPane = ({
<History className="h-5 w-5" strokeWidth={2.25} />
</Button>
<GitHubRepositoryLink className="hidden h-8 w-8 justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-950 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/70 lg:inline-flex" iconClassName="h-5 w-5" />
+ <Button className="relative hidden h-8 w-8 text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-950 focus-visible:ring-2 focus-visible:ring-emerald-500/70 sm:inline-flex" size="icon" variant="ghost" title={t("systemInfo.title")} aria-label={t("systemInfo.title")} onClick={() => setSystemInfoOpen(true)}>
+ <Info className="h-5 w-5" strokeWidth={2.25} />
+ {updateAvailable ? <span className="absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-emerald-500 ring-2 ring-white" aria-label={t("systemInfo.updateAvailableTitle")} /> : null}
+ </Button>
<ThemeToggle />
{!readOnly && (
<Button
@@ -3081,6 +3104,8 @@ const RichEditorPane = ({
/>
)}
+ <SystemInfoDialog open={systemInfoOpen} onOpenChange={setSystemInfoOpen} />
+
{mobileNotebookSheetOpen && (
<MobileNotebookSelectSheet
isUpdating={notebookUpdatePending || saveMutation.isPending}
diff --git a/apps/web/src/components/ReleaseUpdateNotice.tsx b/apps/web/src/components/ReleaseUpdateNotice.tsx
new file mode 100644
index 00000000..cc5de63d
--- /dev/null
+++ b/apps/web/src/components/ReleaseUpdateNotice.tsx
@@ -0,0 +1,63 @@
+import { useEffect, useState } from "react";
+import { ArrowUpCircle, ExternalLink, X } from "lucide-react";
+import { useTranslation } from "react-i18next";
+import { fetchLatestRelease, isVersionOutdated, type LatestRelease } from "@/lib/version-check";
+import { dismissRelease, getDismissedRelease } from "@/lib/release-notice";
+
+export const ReleaseUpdateNotice = () => {
+ const { t } = useTranslation();
+ const [release, setRelease] = useState<LatestRelease | null>(null);
+ const [dismissed, setDismissed] = useState(false);
+
+ useEffect(() => {
+ const controller = new AbortController();
+ void fetchLatestRelease(controller.signal)
+ .then((latest) => {
+ if (isVersionOutdated(__EDGEEVER_APP_VERSION__, latest.tagName)) setRelease(latest);
+ })
+ .catch(() => undefined);
+ return () => controller.abort();
+ }, []);
+
+ if (!release || dismissed || getDismissedRelease() === release.tagName) return null;
+
+ return (
+ <aside
+ className="fixed right-5 top-5 z-[70] w-[min(22rem,calc(100vw-2rem))] rounded-lg border border-emerald-200 bg-white/95 p-3 text-slate-900 shadow-[0_18px_48px_rgba(15,23,42,0.16)] backdrop-blur"
+ role="status"
+ aria-live="polite"
+ >
+ <div className="flex items-start gap-3">
+ <div className="mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-emerald-50 text-emerald-600" aria-hidden="true">
+ <ArrowUpCircle className="h-4 w-4" />
+ </div>
+ <div className="min-w-0 flex-1">
+ <div className="text-sm font-semibold leading-5">{t("systemInfo.updateAvailableTitle")}</div>
+ <div className="mt-0.5 text-xs leading-5 text-slate-500">
+ {t("systemInfo.updateAvailableDescription", { version: release.tagName })}
+ </div>
+ <a
+ className="mt-2 inline-flex items-center gap-1 text-xs font-semibold text-emerald-700 underline underline-offset-2 hover:text-emerald-900"
+ href={release.url}
+ target="_blank"
+ rel="noreferrer"
+ >
+ {t("systemInfo.viewRelease")}
+ <ExternalLink className="h-3 w-3" />
+ </a>
+ </div>
+ <button
+ className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-slate-400 transition hover:bg-slate-100 hover:text-slate-700"
+ type="button"
+ aria-label={t("systemInfo.closeUpdateNotice")}
+ onClick={() => {
+ dismissRelease(release.tagName);
+ setDismissed(true);
+ }}
+ >
+ <X className="h-4 w-4" />
+ </button>
+ </div>
+ </aside>
+ );
+};
diff --git a/apps/web/src/components/SettingsPane.tsx b/apps/web/src/components/SettingsPane.tsx
index a36687cf..f39fa864 100644
--- a/apps/web/src/components/SettingsPane.tsx
+++ b/apps/web/src/components/SettingsPane.tsx
@@ -23,7 +23,6 @@ import { McpConfigCard } from "./settings/McpConfigCard";
import { PreferenceCard } from "./settings/PreferenceCard";
import { PasswordCard } from "./settings/PasswordCard";
import { SessionCard } from "./settings/SessionCard";
-import { SystemInfoCard } from "./settings/SystemInfoCard";
import { UserManagementCard } from "./settings/UserManagementCard";
import { ThemeToggle } from "./ThemeToggle";
@@ -171,7 +170,6 @@ export const SettingsPane = ({
shortcutSettings={shortcutSettings}
onShortcutSettingsChange={onShortcutSettingsChange}
/>
- <SystemInfoCard />
<FeedbackLink className="hidden lg:flex" />
</SettingsGroup>
);
diff --git a/apps/web/src/components/SystemInfoDialog.tsx b/apps/web/src/components/SystemInfoDialog.tsx
new file mode 100644
index 00000000..11835f62
--- /dev/null
+++ b/apps/web/src/components/SystemInfoDialog.tsx
@@ -0,0 +1,31 @@
+import { useTranslation } from "react-i18next";
+import { Button } from "@/components/ui/button";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
+import { SystemInfoPanel } from "./settings/SystemInfoPanel";
+
+export const SystemInfoDialog = ({ open, onOpenChange }: { open: boolean; onOpenChange: (open: boolean) => void }) => {
+ const { t } = useTranslation();
+
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent className="max-h-[min(720px,calc(100dvh-2rem))] max-w-2xl overflow-y-auto p-4 sm:p-6">
+ <DialogHeader className="pr-8">
+ <DialogTitle>{t("systemInfo.title")}</DialogTitle>
+ <DialogDescription>{t("systemInfo.description")}</DialogDescription>
+ </DialogHeader>
+ <SystemInfoPanel />
+ <div className="flex justify-end">
+ <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
+ {t("common.close")}
+ </Button>
+ </div>
+ </DialogContent>
+ </Dialog>
+ );
+};
diff --git a/apps/web/src/components/settings/SystemInfoCard.tsx b/apps/web/src/components/settings/SystemInfoCard.tsx
index 0a9d5acc..90d9f8c1 100644
--- a/apps/web/src/components/settings/SystemInfoCard.tsx
+++ b/apps/web/src/components/settings/SystemInfoCard.tsx
@@ -1,141 +1,17 @@
-import { useEffect, useMemo, useState } from "react";
-import { ArrowUpCircle, CheckCircle2, ChevronDown, Copy, ExternalLink, Info } from "lucide-react";
+import { ChevronDown, Info } from "lucide-react";
+import { useState } from "react";
import { useTranslation } from "react-i18next";
-import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
import { cn } from "@/lib/utils";
-import { fetchLatestRelease, isVersionOutdated, type LatestRelease } from "@/lib/version-check";
-import { copyTextToClipboard } from "./settings-utils";
+import { SystemInfoPanel, type SystemInfoItem, getWebSystemInfoItems } from "./SystemInfoPanel";
-export type SystemInfoItem = {
- label: string;
- value: string;
-};
-
-type NavigatorWithStandalone = Navigator & {
- standalone?: boolean;
-};
-
-const detectBrowser = (userAgent: string) => {
- if (/Edg\//.test(userAgent) || /EdgA\//.test(userAgent) || /EdgiOS\//.test(userAgent)) {
- return "Microsoft Edge";
- }
- if ((/Chrome\//.test(userAgent) || /CriOS\//.test(userAgent)) && !/Chromium\//.test(userAgent)) {
- return "Chrome";
- }
- if (/Firefox\//.test(userAgent)) {
- return "Firefox";
- }
- if (/Safari\//.test(userAgent) && !/Chrome\//.test(userAgent)) {
- return "Safari";
- }
- return null;
-};
-
-const detectOperatingSystem = (userAgent: string, platform: string) => {
- const source = `${userAgent} ${platform}`;
-
- if (/Windows/i.test(source)) {
- return "Windows";
- }
- if (/Android/i.test(source)) {
- return "Android";
- }
- if (/(iPhone|iPad|iPod)/i.test(source)) {
- return "iOS";
- }
- if (/Mac/i.test(source)) {
- return "macOS";
- }
- if (/Linux/i.test(source)) {
- return "Linux";
- }
- return null;
-};
-
-const getDeploymentDescription = (t: (key: string) => string) => {
- const trigger = t(`systemInfo.deploymentTriggers.${__EDGEEVER_DEPLOYMENT_TRIGGER__}`);
- const method = t(`systemInfo.deploymentMethods.${__EDGEEVER_DEPLOYMENT_METHOD__}`);
- return `${trigger} · ${method}`;
-};
-
-export const getWebSystemInfoItems = (
- t: (key: string) => string,
- language: string
-): SystemInfoItem[] => {
- const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || t("systemInfo.unknown");
- const userAgent = navigator.userAgent;
- const standalone =
- window.matchMedia("(display-mode: standalone)").matches ||
- (navigator as NavigatorWithStandalone).standalone === true;
-
- return [
- { label: t("systemInfo.version"), value: `v${__EDGEEVER_APP_VERSION__}` },
- {
- label: t("systemInfo.releaseTime"),
- value: __EDGEEVER_RELEASED_AT__
- ? new Intl.DateTimeFormat(language, { dateStyle: "medium", timeStyle: "short" }).format(new Date(__EDGEEVER_RELEASED_AT__))
- : t("systemInfo.unknown"),
- },
- { label: t("systemInfo.build"), value: __EDGEEVER_BUILD_LABEL__ },
- { label: t("systemInfo.deployment"), value: getDeploymentDescription(t) },
- {
- label: t("systemInfo.browser"),
- value: detectBrowser(userAgent) ?? t("systemInfo.unknown"),
- },
- {
- label: t("systemInfo.os"),
- value: detectOperatingSystem(userAgent, navigator.platform) ?? t("systemInfo.unknown"),
- },
- { label: t("systemInfo.language"), value: navigator.language || language },
- { label: t("systemInfo.timeZone"), value: timeZone },
- {
- label: t("systemInfo.installMode"),
- value: standalone ? t("systemInfo.standalone") : t("systemInfo.browserMode"),
- },
- ];
-};
-
-export const SystemInfoCard = () => {
- const { t, i18n } = useTranslation();
- const [copied, setCopied] = useState(false);
- const [expanded, setExpanded] = useState(false);
- const [latestRelease, setLatestRelease] = useState<LatestRelease | null>(null);
- const [releaseCheck, setReleaseCheck] = useState<"idle" | "checking" | "latest" | "outdated" | "error">("idle");
-
- const infoItems = useMemo<SystemInfoItem[]>(
- () => getWebSystemInfoItems(t, i18n.language),
- [i18n.language, t]
- );
-
- useEffect(() => {
- if (!expanded || releaseCheck !== "idle") return;
-
- const controller = new AbortController();
- setReleaseCheck("checking");
- void fetchLatestRelease(controller.signal)
- .then((release) => {
- setLatestRelease(release);
- setReleaseCheck(isVersionOutdated(__EDGEEVER_APP_VERSION__, release.tagName) ? "outdated" : "latest");
- })
- .catch(() => {
- if (!controller.signal.aborted) setReleaseCheck("error");
- });
-
- return () => controller.abort();
- }, [expanded]);
-
- const handleCopy = async () => {
- const details = infoItems.map((item) => `${item.label}: ${item.value}`).join("\n");
-
- if (!(await copyTextToClipboard(details))) {
- return;
- }
+export { getWebSystemInfoItems };
+export type { SystemInfoItem };
- setCopied(true);
- window.setTimeout(() => setCopied(false), 1600);
- };
+export const SystemInfoCard = ({ defaultExpanded = false }: { defaultExpanded?: boolean }) => {
+ const { t } = useTranslation();
+ const [expanded, setExpanded] = useState(defaultExpanded);
return (
<Collapsible open={expanded} onOpenChange={setExpanded} asChild>
@@ -144,69 +20,15 @@ export const SystemInfoCard = () => {
<CollapsibleTrigger asChild>
<button className="flex w-full min-w-0 items-start justify-between gap-3 text-left" type="button">
<span className="min-w-0">
- <CardTitle className="flex items-center gap-2 text-sm">
- <Info className="h-4 w-4 text-emerald-700" />
- {t("systemInfo.title")}
- </CardTitle>
+ <CardTitle className="flex items-center gap-2 text-sm"><Info className="h-4 w-4 text-emerald-700" />{t("systemInfo.title")}</CardTitle>
<CardDescription className="mt-1 text-xs leading-4">{t("systemInfo.description")}</CardDescription>
</span>
- <ChevronDown
- className={cn(
- "mt-0.5 h-4 w-4 shrink-0 text-slate-400 transition-transform",
- expanded ? "rotate-180" : "rotate-0"
- )}
- />
+ <ChevronDown className={cn("mt-0.5 h-4 w-4 shrink-0 text-slate-400 transition-transform", expanded ? "rotate-180" : "rotate-0")} />
</button>
</CollapsibleTrigger>
</CardHeader>
<CollapsibleContent asChild>
- <CardContent className="grid gap-3 p-4 pt-0">
- <div className="flex justify-end">
- <Button
- size="sm"
- variant="outline"
- className="h-8 w-full bg-white px-3 text-xs sm:w-auto"
- type="button"
- onClick={() => void handleCopy()}
- >
- <Copy className="h-3.5 w-3.5" />
- {copied ? t("common.copied") : t("systemInfo.copy")}
- </Button>
- </div>
- {releaseCheck === "outdated" && latestRelease ? (
- <div className="flex items-start gap-2 rounded-md border border-emerald-200 border-l-2 border-l-emerald-500 bg-emerald-50/40 px-3 py-2 text-slate-800" role="status">
- <ArrowUpCircle className="mt-0.5 h-4 w-4 shrink-0 text-emerald-600" />
- <div className="min-w-0 flex-1 text-xs leading-5">
- <div className="font-semibold">{t("systemInfo.updateAvailableTitle")}</div>
- <div className="text-slate-500">{t("systemInfo.updateAvailableDescription", { version: latestRelease.tagName })}</div>
- </div>
- <a
- className="inline-flex shrink-0 items-center gap-1 text-xs font-semibold text-emerald-700 underline underline-offset-2 hover:text-emerald-900"
- href={latestRelease.url}
- target="_blank"
- rel="noreferrer"
- >
- {t("systemInfo.viewRelease")}
- <ExternalLink className="h-3 w-3" />
- </a>
- </div>
- ) : releaseCheck === "latest" ? (
- <div className="flex items-center gap-2 text-xs text-emerald-700" role="status">
- <CheckCircle2 className="h-4 w-4" />
- {t("systemInfo.latestVersion")}
- </div>
- ) : null}
- <dl className="grid border-y border-slate-200 sm:grid-cols-3">
- {infoItems.map((item) => (
- <div key={item.label} className="min-w-0 border-b border-slate-200 px-2 py-2.5 sm:px-3">
- <dt className="truncate text-[11px] font-semibold uppercase text-slate-400">{item.label}</dt>
- <dd className="mt-0.5 break-words font-mono text-xs font-semibold leading-5 text-slate-800" title={item.value}>
- {item.value}
- </dd>
- </div>
- ))}
- </dl>
- </CardContent>
+ <CardContent className="p-4 pt-0"><SystemInfoPanel active={expanded} /></CardContent>
</CollapsibleContent>
</Card>
</Collapsible>
diff --git a/apps/web/src/components/settings/SystemInfoPanel.tsx b/apps/web/src/components/settings/SystemInfoPanel.tsx
new file mode 100644
index 00000000..f0a282bf
--- /dev/null
+++ b/apps/web/src/components/settings/SystemInfoPanel.tsx
@@ -0,0 +1,127 @@
+import { useEffect, useMemo, useState } from "react";
+import { ArrowUpCircle, CheckCircle2, Copy, ExternalLink } from "lucide-react";
+import { useTranslation } from "react-i18next";
+import { Button } from "@/components/ui/button";
+import { cn } from "@/lib/utils";
+import { fetchLatestRelease, isVersionOutdated, type LatestRelease } from "@/lib/version-check";
+import { copyTextToClipboard } from "./settings-utils";
+
+export type SystemInfoItem = { label: string; value: string };
+
+type NavigatorWithStandalone = Navigator & { standalone?: boolean };
+
+const detectBrowser = (userAgent: string) => {
+ if (/Edg\//.test(userAgent) || /EdgA\//.test(userAgent) || /EdgiOS\//.test(userAgent)) return "Microsoft Edge";
+ if ((/Chrome\//.test(userAgent) || /CriOS\//.test(userAgent)) && !/Chromium\//.test(userAgent)) return "Chrome";
+ if (/Firefox\//.test(userAgent)) return "Firefox";
+ if (/Safari\//.test(userAgent) && !/Chrome\//.test(userAgent)) return "Safari";
+ return null;
+};
+
+const detectOperatingSystem = (userAgent: string, platform: string) => {
+ const source = `${userAgent} ${platform}`;
+ if (/Windows/i.test(source)) return "Windows";
+ if (/Android/i.test(source)) return "Android";
+ if (/(iPhone|iPad|iPod)/i.test(source)) return "iOS";
+ if (/Mac/i.test(source)) return "macOS";
+ if (/Linux/i.test(source)) return "Linux";
+ return null;
+};
+
+const getDeploymentDescription = (t: (key: string) => string) => {
+ const trigger = t(`systemInfo.deploymentTriggers.${__EDGEEVER_DEPLOYMENT_TRIGGER__}`);
+ const method = t(`systemInfo.deploymentMethods.${__EDGEEVER_DEPLOYMENT_METHOD__}`);
+ return `${trigger} · ${method}`;
+};
+
+export const getWebSystemInfoItems = (t: (key: string) => string, language: string): SystemInfoItem[] => {
+ const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || t("systemInfo.unknown");
+ const userAgent = navigator.userAgent;
+ const standalone =
+ window.matchMedia("(display-mode: standalone)").matches ||
+ (navigator as NavigatorWithStandalone).standalone === true;
+
+ return [
+ { label: t("systemInfo.version"), value: `v${__EDGEEVER_APP_VERSION__}` },
+ {
+ label: t("systemInfo.releaseTime"),
+ value: __EDGEEVER_RELEASED_AT__
+ ? new Intl.DateTimeFormat(language, { dateStyle: "medium", timeStyle: "short" }).format(new Date(__EDGEEVER_RELEASED_AT__))
+ : t("systemInfo.unknown"),
+ },
+ { label: t("systemInfo.build"), value: __EDGEEVER_BUILD_LABEL__ },
+ { label: t("systemInfo.deployment"), value: getDeploymentDescription(t) },
+ { label: t("systemInfo.browser"), value: detectBrowser(userAgent) ?? t("systemInfo.unknown") },
+ { label: t("systemInfo.os"), value: detectOperatingSystem(userAgent, navigator.platform) ?? t("systemInfo.unknown") },
+ { label: t("systemInfo.language"), value: navigator.language || language },
+ { label: t("systemInfo.timeZone"), value: timeZone },
+ { label: t("systemInfo.installMode"), value: standalone ? t("systemInfo.standalone") : t("systemInfo.browserMode") },
+ ];
+};
+
+export const SystemInfoPanel = ({ active = true }: { active?: boolean }) => {
+ const { t, i18n } = useTranslation();
+ const [copied, setCopied] = useState(false);
+ const [latestRelease, setLatestRelease] = useState<LatestRelease | null>(null);
+ const [releaseCheck, setReleaseCheck] = useState<"idle" | "checking" | "latest" | "outdated" | "error">("idle");
+ const infoItems = useMemo(() => getWebSystemInfoItems(t, i18n.language), [i18n.language, t]);
+
+ useEffect(() => {
+ if (!active) {
+ setReleaseCheck("idle");
+ return;
+ }
+ const controller = new AbortController();
+ setReleaseCheck("checking");
+ void fetchLatestRelease(controller.signal)
+ .then((release) => {
+ setLatestRelease(release);
+ setReleaseCheck(isVersionOutdated(__EDGEEVER_APP_VERSION__, release.tagName) ? "outdated" : "latest");
+ })
+ .catch(() => {
+ if (!controller.signal.aborted) setReleaseCheck("error");
+ });
+ return () => controller.abort();
+ }, [active]);
+
+ const handleCopy = async () => {
+ if (!(await copyTextToClipboard(infoItems.map((item) => `${item.label}: ${item.value}`).join("\n")))) return;
+ setCopied(true);
+ window.setTimeout(() => setCopied(false), 1600);
+ };
+
+ return (
+ <div className="grid gap-3">
+ <div className="flex justify-end">
+ <Button size="sm" variant="outline" className="h-8 w-full bg-white px-3 text-xs sm:w-auto" type="button" onClick={() => void handleCopy()}>
+ <Copy className="h-3.5 w-3.5" />
+ {copied ? t("common.copied") : t("systemInfo.copy")}
+ </Button>
+ </div>
+ {releaseCheck === "outdated" && latestRelease ? (
+ <div className="flex items-start gap-2 rounded-md border border-emerald-200 border-l-2 border-l-emerald-500 bg-emerald-50/40 px-3 py-2 text-slate-800" role="status">
+ <ArrowUpCircle className="mt-0.5 h-4 w-4 shrink-0 text-emerald-600" />
+ <div className="min-w-0 flex-1 text-xs leading-5">
+ <div className="font-semibold">{t("systemInfo.updateAvailableTitle")}</div>
+ <div className="text-slate-500">{t("systemInfo.updateAvailableDescription", { version: latestRelease.tagName })}</div>
+ </div>
+ <a className="inline-flex shrink-0 items-center gap-1 text-xs font-semibold text-emerald-700 underline underline-offset-2 hover:text-emerald-900" href={latestRelease.url} target="_blank" rel="noreferrer">
+ {t("systemInfo.viewRelease")} <ExternalLink className="h-3 w-3" />
+ </a>
+ </div>
+ ) : releaseCheck === "latest" ? (
+ <div className="flex items-center gap-2 text-xs text-emerald-700" role="status">
+ <CheckCircle2 className="h-4 w-4" /> {t("systemInfo.latestVersion")}
+ </div>
+ ) : null}
+ <dl className="grid border-y border-slate-200 sm:grid-cols-3">
+ {infoItems.map((item) => (
+ <div key={item.label} className="min-w-0 border-b border-slate-200 px-2 py-2.5 sm:px-3">
+ <dt className="truncate text-[11px] font-semibold uppercase text-slate-400">{item.label}</dt>
+ <dd className={cn("mt-0.5 break-words font-mono text-xs font-semibold leading-5 text-slate-800")} title={item.value}>{item.value}</dd>
+ </div>
+ ))}
+ </dl>
+ </div>
+ );
+};
diff --git a/apps/web/src/lib/release-notice.ts b/apps/web/src/lib/release-notice.ts
new file mode 100644
index 00000000..29343aa6
--- /dev/null
+++ b/apps/web/src/lib/release-notice.ts
@@ -0,0 +1,19 @@
+const DISMISSED_RELEASE_KEY = "edgeever:dismissed-release";
+export const RELEASE_STATUS_EVENT = "edgeever:release-status";
+
+export const getDismissedRelease = () => {
+ try {
+ return window.localStorage.getItem(DISMISSED_RELEASE_KEY);
+ } catch {
+ return null;
+ }
+};
+
+export const dismissRelease = (tagName: string) => {
+ try {
+ window.localStorage.setItem(DISMISSED_RELEASE_KEY, tagName);
+ } catch {
+ // Storage can be unavailable in restricted browsing modes.
+ }
+ window.dispatchEvent(new CustomEvent(RELEASE_STATUS_EVENT, { detail: { tagName, dismissed: true } }));
+};
diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts
index 793afcb7..a2a58c21 100644
--- a/packages/shared/src/i18n/en-US.ts
+++ b/packages/shared/src/i18n/en-US.ts
@@ -240,6 +240,7 @@ export const enUS = {
updateAvailableDescription: "This version is out of date. The latest version is {{version}}.",
viewRelease: "View update",
latestVersion: "You are running the latest version",
+ closeUpdateNotice: "Close update notice",
},
feedback: {
title: "Feedback",
diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts
index 5b33cb09..9775a517 100644
--- a/packages/shared/src/i18n/zh-CN.ts
+++ b/packages/shared/src/i18n/zh-CN.ts
@@ -240,6 +240,7 @@ export const zhCN = {
updateAvailableDescription: "当前版本较旧,最新版本为 {{version}}。",
viewRelease: "查看更新",
latestVersion: "当前已是最新版本",
+ closeUpdateNotice: "关闭新版本提示",
},
feedback: {
title: "意见反馈",