feat: Fix Overview always active, add Refresh button, add Logout in standalone
This commit is contained in:
@@ -259,11 +259,34 @@ function AddonRoute({ config }: { config: any }) {
|
||||
|
||||
function Header({ onFullscreen, fullscreen, showToggle = true }: { onFullscreen: () => void; fullscreen: boolean; showToggle?: boolean }) {
|
||||
const siteTitle = (window as any).wnw?.siteTitle || 'WooNooW';
|
||||
const isStandalone = window.WNW_CONFIG?.standaloneMode ?? false;
|
||||
|
||||
const handleLogout = async () => {
|
||||
try {
|
||||
await fetch(window.WNW_CONFIG.restUrl + '/auth/logout', {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
});
|
||||
window.location.reload();
|
||||
} catch (err) {
|
||||
console.error('Logout failed:', err);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<header className={`h-16 border-b border-border flex items-center px-4 justify-between sticky ${fullscreen ? `top-0` : `top-[32px]`} z-40 bg-background md:bg-background/95 md:backdrop-blur md:supports-[backdrop-filter]:bg-background/60`}>
|
||||
<div className="font-semibold">{siteTitle}</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="text-sm opacity-70 hidden sm:block">{window.WNW_API?.isDev ? 'Dev Server' : 'Production'}</div>
|
||||
{isStandalone && (
|
||||
<button
|
||||
onClick={handleLogout}
|
||||
className="inline-flex items-center gap-2 border rounded-md px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground"
|
||||
title="Logout"
|
||||
>
|
||||
<span>{__('Logout')}</span>
|
||||
</button>
|
||||
)}
|
||||
{showToggle && (
|
||||
<button
|
||||
onClick={onFullscreen}
|
||||
|
||||
Reference in New Issue
Block a user