mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-02-19 19:20:49 +08:00
feat(layout): add logout button to header
Add a logout icon and button to the main layout header, allowing users to log out directly from the navigation bar.
This commit is contained in:
@@ -97,8 +97,15 @@ const headerIcons = {
|
|||||||
<svg {...headerIconProps}>
|
<svg {...headerIconProps}>
|
||||||
<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9z" />
|
<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9z" />
|
||||||
</svg>
|
</svg>
|
||||||
|
),
|
||||||
|
logout: (
|
||||||
|
<svg {...headerIconProps}>
|
||||||
|
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
|
||||||
|
<path d="m16 17 5-5-5-5" />
|
||||||
|
<path d="M21 12H9" />
|
||||||
|
</svg>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
const parseVersionSegments = (version?: string | null) => {
|
const parseVersionSegments = (version?: string | null) => {
|
||||||
if (!version) return null;
|
if (!version) return null;
|
||||||
@@ -134,6 +141,7 @@ export function MainLayout() {
|
|||||||
const serverVersion = useAuthStore((state) => state.serverVersion);
|
const serverVersion = useAuthStore((state) => state.serverVersion);
|
||||||
const serverBuildDate = useAuthStore((state) => state.serverBuildDate);
|
const serverBuildDate = useAuthStore((state) => state.serverBuildDate);
|
||||||
const connectionStatus = useAuthStore((state) => state.connectionStatus);
|
const connectionStatus = useAuthStore((state) => state.connectionStatus);
|
||||||
|
const logout = useAuthStore((state) => state.logout);
|
||||||
|
|
||||||
const config = useConfigStore((state) => state.config);
|
const config = useConfigStore((state) => state.config);
|
||||||
const fetchConfig = useConfigStore((state) => state.fetchConfig);
|
const fetchConfig = useConfigStore((state) => state.fetchConfig);
|
||||||
@@ -324,6 +332,9 @@ export function MainLayout() {
|
|||||||
<Button variant="ghost" size="sm" onClick={toggleTheme} title={t('theme.switch')}>
|
<Button variant="ghost" size="sm" onClick={toggleTheme} title={t('theme.switch')}>
|
||||||
{theme === 'dark' ? headerIcons.sun : headerIcons.moon}
|
{theme === 'dark' ? headerIcons.sun : headerIcons.moon}
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button variant="ghost" size="sm" onClick={logout} title={t('header.logout')}>
|
||||||
|
{headerIcons.logout}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
Reference in New Issue
Block a user