feat: add add page selected state for add button in sidebar header

This commit is contained in:
moonrailgun 2024-05-06 00:23:26 +08:00
parent 755aeafa23
commit d31d20364e
4 changed files with 7 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import { useEvent } from '@/hooks/useEvent';
import { LayoutV2 } from '@/pages/LayoutV2';
import { useCurrentWorkspaceId } from '@/store/user';
import { routeAuthBeforeLoad } from '@/utils/route';
import { cn } from '@/utils/style';
import { useTranslation } from '@i18next-toolkit/react';
import {
createFileRoute,
@ -78,6 +79,7 @@ function MonitorComponent() {
title={t('Monitor')}
actions={
<Button
className={cn(pathname === '/monitor/add' && '!bg-muted')}
variant="outline"
Icon={LuPlus}
onClick={handleClickAdd}

View File

@ -8,6 +8,7 @@ import { useEvent } from '@/hooks/useEvent';
import { LayoutV2 } from '@/pages/LayoutV2';
import { useCurrentWorkspaceId } from '@/store/user';
import { routeAuthBeforeLoad } from '@/utils/route';
import { cn } from '@/utils/style';
import { useTranslation } from '@i18next-toolkit/react';
import {
createFileRoute,
@ -68,6 +69,7 @@ function PageComponent() {
title={t('Pages')}
actions={
<Button
className={cn(pathname === '/page/add' && '!bg-muted')}
variant="outline"
Icon={LuPlus}
onClick={handleClickAdd}

View File

@ -8,6 +8,7 @@ import { useEvent } from '@/hooks/useEvent';
import { LayoutV2 } from '@/pages/LayoutV2';
import { useCurrentWorkspaceId } from '@/store/user';
import { routeAuthBeforeLoad } from '@/utils/route';
import { cn } from '@/utils/style';
import { Trans, useTranslation } from '@i18next-toolkit/react';
import {
createFileRoute,
@ -101,6 +102,7 @@ function TelemetryComponent() {
}
actions={
<Button
className={cn(pathname === '/telemetry/add' && '!bg-muted')}
variant="outline"
Icon={LuPlus}
onClick={handleClickAdd}

View File

@ -81,6 +81,7 @@ function WebsiteComponent() {
{t('Overview')}
</Button>
<Button
className={cn(pathname === '/website/add' && '!bg-muted')}
variant="outline"
size="icon"
Icon={LuPlus}