client: distinguish current page in header
This commit is contained in:
parent
bf878473af
commit
65b0c8f7f3
2 changed files with 3 additions and 3 deletions
|
@ -18,7 +18,7 @@ type Tab = {
|
|||
|
||||
const Header = ({ changeTheme, theme }: DriftProps) => {
|
||||
const router = useRouter();
|
||||
const [selectedTab, setSelectedTab] = useState<string>();
|
||||
const [selectedTab, setSelectedTab] = useState<string>(router.pathname === '/' ? 'home' : router.pathname.split('/')[1]);
|
||||
const [expanded, setExpanded] = useState<boolean>(false)
|
||||
const [, setBodyHidden] = useBodyScroll(null, { scrollLayer: true })
|
||||
const isMobile = useMediaQuery('xs', { match: 'down' })
|
||||
|
@ -91,7 +91,7 @@ const Header = ({ changeTheme, theme }: DriftProps) => {
|
|||
onClick: function () {
|
||||
if (typeof window !== 'undefined') {
|
||||
changeTheme();
|
||||
setSelectedTab(undefined);
|
||||
setSelectedTab('');
|
||||
}
|
||||
},
|
||||
icon: theme === 'light' ? <Moon /> : <Sun />,
|
||||
|
|
|
@ -38,7 +38,7 @@ export function middleware(req: NextRequest, ev: NextFetchEvent) {
|
|||
}
|
||||
} else if (pathname === '/new') {
|
||||
if (!signedIn) {
|
||||
return NextResponse.redirect(getURL(''))
|
||||
return NextResponse.redirect(getURL('/signin'))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue