add logout button
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user