Skip to content

Commit

Permalink
perf: add nav breadcrumb ins name display.
Browse files Browse the repository at this point in the history
  • Loading branch information
riccox committed Oct 10, 2024
1 parent 444c434 commit e071664
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/Breadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useMatchRoute } from '@tanstack/react-router';
import { useTranslation } from 'react-i18next';
import { Breadcrumbs, BreadcrumbItem } from '@nextui-org/react';
import { useAppStore } from '@/store';

export const DashBreadcrumb = () => {
const matchRoute = useMatchRoute();
Expand All @@ -17,11 +18,15 @@ export const DashBreadcrumb = () => {
indexUID: string;
};

const currentInstance = useAppStore((state) => state.instances.find((i) => i.id === parseInt(insRoute.insID)));

return (
<Breadcrumbs color="primary" variant="light">
<BreadcrumbItem href={import.meta.env.BASE_URL ?? '/'}>🏠</BreadcrumbItem>
{insRoute && (
<BreadcrumbItem href={`/ins/${insRoute.insID}`}>{`${t('common:instance')} #${insRoute.insID}`}</BreadcrumbItem>
<BreadcrumbItem
href={`/ins/${insRoute.insID}`}
>{`#${insRoute.insID} ${t('common:instance')} ${currentInstance?.name}`}</BreadcrumbItem>
)}
{insKeysRoute && <BreadcrumbItem href={`/ins/${insRoute.insID}/keys`}>{`${t('common:keys')}`}</BreadcrumbItem>}
{insTasksRoute && <BreadcrumbItem href={`/ins/${insRoute.insID}/tasks`}>{`${t('common:tasks')}`}</BreadcrumbItem>}
Expand Down

0 comments on commit e071664

Please sign in to comment.