fix hive logo click, should redirect to current org (#107)

Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com>
This commit is contained in:
Dimitri POSTOLOV 2022-05-26 12:49:09 +02:00 committed by GitHub
parent 6c5f8bc12e
commit 18b77d090f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,10 +3,20 @@ import NextLink from 'next/link';
import clsx from 'clsx';
import { HiveLogo } from '@/components/v2/icon';
import { useRouteSelector } from '@/lib/hooks/use-route-selector';
export const HiveLink = ({ className }: { className?: string }): ReactElement => {
const router = useRouteSelector();
const orgId = router.organizationId;
return (
<NextLink href="/" passHref>
<NextLink
href={
// orgId can be undefined on /404 route
orgId ? `/${orgId}` : '/'
}
passHref
>
<a className={clsx('inline-flex items-center focus:ring', className)}>
<HiveLogo />
<div className="ml-2.5">