diff --git a/src/frontend/src/layout/Header.tsx b/src/frontend/src/layout/Header.tsx index 55fab9a9..f03e0021 100644 --- a/src/frontend/src/layout/Header.tsx +++ b/src/frontend/src/layout/Header.tsx @@ -5,10 +5,12 @@ import { useTranslation } from 'react-i18next' import { A, Button, Popover, PopoverList, Text } from '@/primitives' import { SettingsButton } from '@/features/settings' import { authUrl, logoutUrl, useUser } from '@/features/auth' +import { useMatchesRoute } from '@/utils/useMatchesRoute' export const Header = () => { const { t } = useTranslation() - const isHome = window.location.pathname === '/' + const isHome = useMatchesRoute('home') + const isRoom = useMatchesRoute('room') const { user, isLoggedIn } = useUser() return ( @@ -25,7 +27,19 @@ export const Header = () => {
- {t('app')} + { + if ( + isRoom && + !window.confirm(t('leaveRoomPrompt', { ns: 'rooms' })) + ) { + event.preventDefault() + } + }} + to="/" + > + {t('app')} +