refactor(breadcrumbs): use handler & match pattern

This commit is contained in:
Nicolas Meienberger
2025-11-13 22:28:53 +01:00
parent 6d3d3c38f9
commit 6e6becec3b
14 changed files with 89 additions and 98 deletions

View File

@@ -20,6 +20,13 @@ import { SnapshotFileBrowser } from "../components/snapshot-file-browser";
import { SnapshotTimeline } from "../components/snapshot-timeline";
import { getBackupSchedule } from "~/client/api-client";
export const handle = {
breadcrumb: (match: Route.MetaArgs) => [
{ label: "Backups", href: "/backups" },
{ label: `Schedule #${match.params.id}` },
],
};
export function meta(_: Route.MetaArgs) {
return [
{ title: "Backup Job Details" },

View File

@@ -9,6 +9,10 @@ import type { Route } from "./+types/backups";
import { listBackupSchedules } from "~/client/api-client";
import { listBackupSchedulesOptions } from "~/client/api-client/@tanstack/react-query.gen";
export const handle = {
breadcrumb: () => [{ label: "Backups" }],
};
export function meta(_: Route.MetaArgs) {
return [
{ title: "Backup Jobs" },

View File

@@ -18,6 +18,10 @@ import { CreateScheduleForm, type BackupScheduleFormValues } from "../components
import type { Route } from "./+types/create-backup";
import { listRepositories, listVolumes } from "~/client/api-client";
export const handle = {
breadcrumb: () => [{ label: "Backups", href: "/backups" }, { label: "Create" }],
};
export function meta(_: Route.MetaArgs) {
return [
{ title: "Create Backup Job" },

View File

@@ -15,6 +15,10 @@ import type { Route } from "./+types/repositories";
import { cn } from "~/client/lib/utils";
import { EmptyState } from "~/client/components/empty-state";
export const handle = {
breadcrumb: () => [{ label: "Repositories" }],
};
export function meta(_: Route.MetaArgs) {
return [
{ title: "Repositories" },

View File

@@ -27,6 +27,13 @@ import { RepositoryInfoTabContent } from "../tabs/info";
import { RepositorySnapshotsTabContent } from "../tabs/snapshots";
import { Loader2 } from "lucide-react";
export const handle = {
breadcrumb: (match: Route.MetaArgs) => [
{ label: "Repositories", href: "/repositories" },
{ label: match.params.name },
],
};
export function meta({ params }: Route.MetaArgs) {
return [
{ title: params.name },

View File

@@ -7,6 +7,14 @@ import { SnapshotFileBrowser } from "~/client/modules/backups/components/snapsho
import { getSnapshotDetails } from "~/client/api-client";
import type { Route } from "./+types/snapshot-details";
export const handle = {
breadcrumb: (match: Route.MetaArgs) => [
{ label: "Repositories", href: "/repositories" },
{ label: match.params.name, href: `/repositories/${match.params.name}` },
{ label: match.params.snapshotId },
],
};
export function meta({ params }: Route.MetaArgs) {
return [
{ title: `Snapshot ${params.snapshotId}` },

View File

@@ -24,6 +24,10 @@ import {
logoutMutation,
} from "~/client/api-client/@tanstack/react-query.gen";
export const handle = {
breadcrumb: () => [{ label: "Settings" }],
};
export function meta(_: Route.MetaArgs) {
return [
{ title: "Settings" },

View File

@@ -31,6 +31,10 @@ import {
unmountVolumeMutation,
} from "~/client/api-client/@tanstack/react-query.gen";
export const handle = {
breadcrumb: (match: Route.MetaArgs) => [{ label: "Volumes", href: "/volumes" }, { label: match.params.name }],
};
export function meta({ params }: Route.MetaArgs) {
return [
{ title: params.name },

View File

@@ -15,6 +15,10 @@ import type { Route } from "./+types/volumes";
import { listVolumes } from "~/client/api-client";
import { listVolumesOptions } from "~/client/api-client/@tanstack/react-query.gen";
export const handle = {
breadcrumb: () => [{ label: "Volumes" }],
};
export function meta(_: Route.MetaArgs) {
return [
{ title: "Volumes" },