add logout button

This commit is contained in:
aurinex
2025-07-21 23:08:11 +05:00
parent 83a0e308bc
commit 5d660e7a95
3 changed files with 39 additions and 6 deletions

View File

@ -102,6 +102,11 @@ export default function TopBar({ onRegister, username }: TopBarProps) {
}
}, [username]);
const logout = () => {
localStorage.removeItem('launcher_config');
navigate('/login');
};
return (
<Box
sx={{
@ -274,8 +279,29 @@ export default function TopBar({ onRegister, username }: TopBarProps) {
marginRight: '1vw',
}}
>
{!isLoginPage && !isRegistrationPage && username && (
<Button
variant="outlined"
color="primary"
onClick={() => logout()}
sx={{
width: '10em',
height: '3em',
borderRadius: '1.5vw',
color: 'white',
backgroundImage: 'linear-gradient(to right, #7BB8FF, #FFB7ED)',
border: 'unset',
'&:hover': {
backgroundImage: 'linear-gradient(to right, #6AA8EE, #EEA7DD)',
},
boxShadow: '0.5em 0.5em 0.5em 0px #00000040 inset',
}}
>
Выйти
</Button>
)}
{/* Кнопка регистрации, если на странице логина */}
{username && (
{!isLoginPage && !isRegistrationPage && username && (
<CustomTooltip
title="Попы — внутриигровая валюта, начисляемая за время игры на серверах."
arrow