chore: update version and enhance dashboard components

- Add a warning message for Windows users in AntigravityToolCard to run the terminal as Administrator for MITM functionality.
- Refactor model testing logic in ProviderDetailPage to improve state management and user experience.
- Introduce new version notification in Sidebar for available updates.
This commit is contained in:
decolua
2026-02-28 16:33:18 +07:00
parent 2f4b813c5b
commit a84477e815
5 changed files with 104 additions and 30 deletions
+20 -1
View File
@@ -32,6 +32,7 @@ export default function Sidebar({ onClose }) {
const [isShuttingDown, setIsShuttingDown] = useState(false);
const [isDisconnected, setIsDisconnected] = useState(false);
const [showDebug, setShowDebug] = useState(false);
const [updateInfo, setUpdateInfo] = useState(null);
// Check if debug mode is enabled
useEffect(() => {
@@ -41,6 +42,14 @@ export default function Sidebar({ onClose }) {
.catch(() => {});
}, []);
// Lazy check for new npm version on mount
useEffect(() => {
fetch("/api/version")
.then(res => res.json())
.then(data => { if (data.hasUpdate) setUpdateInfo(data); })
.catch(() => {});
}, []);
const isActive = (href) => {
if (href === "/dashboard/endpoint") {
return pathname === "/dashboard" || pathname.startsWith("/dashboard/endpoint");
@@ -71,7 +80,7 @@ export default function Sidebar({ onClose }) {
</div>
{/* Logo */}
<div className="px-6 py-4">
<div className="px-6 py-4 flex flex-col gap-2">
<Link href="/dashboard" className="flex items-center gap-3">
<div className="flex items-center justify-center size-9 rounded bg-linear-to-br from-[#f97815] to-[#c2590a]">
<span className="material-symbols-outlined text-white text-[20px]">hub</span>
@@ -83,6 +92,16 @@ export default function Sidebar({ onClose }) {
<span className="text-xs text-text-muted">v{APP_CONFIG.version}</span>
</div>
</Link>
{updateInfo && (
<div className="flex flex-col gap-0.5">
<span className="text-xs font-semibold text-green-600 dark:text-amber-500">
New version available: v{updateInfo.latestVersion}
</span>
<code className="text-[10px] text-green-600/80 dark:text-amber-400/70 font-mono select-all">
npm install -g 9router@latest
</code>
</div>
)}
</div>
{/* Navigation */}