feat: added project layout and project select in breadcrumb

This commit is contained in:
=
2025-07-02 01:16:48 +05:30
parent e028b4e26d
commit 09cdd5ec91
165 changed files with 6253 additions and 5600 deletions
@@ -1,44 +1,51 @@
import { createFileRoute, linkOptions, stripSearchParams } from "@tanstack/react-router";
import { zodValidator } from "@tanstack/zod-adapter";
import { z } from "zod";
import {
createFileRoute,
linkOptions,
stripSearchParams,
} from '@tanstack/react-router'
import { zodValidator } from '@tanstack/zod-adapter'
import { z } from 'zod'
import { SecretDashboardPathBreadcrumb } from "@app/components/navigation/SecretDashboardPathBreadcrumb";
import { BreadcrumbTypes } from "@app/components/v2";
import { SecretDashboardPathBreadcrumb } from '@app/components/navigation/SecretDashboardPathBreadcrumb'
import { BreadcrumbTypes } from '@app/components/v2'
import { SecretDashboardPage } from "./SecretDashboardPage";
import { SecretDashboardPage } from './SecretDashboardPage'
const SecretDashboardPageQueryParamsSchema = z.object({
secretPath: z.string().catch("/"),
search: z.string().catch(""),
tags: z.string().catch("")
});
secretPath: z.string().catch('/'),
search: z.string().catch(''),
tags: z.string().catch(''),
})
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/secrets/$envSlug"
'/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/secret-manager/_secret-manager-layout/secrets/$envSlug',
)({
component: SecretDashboardPage,
validateSearch: zodValidator(SecretDashboardPageQueryParamsSchema),
search: {
middlewares: [stripSearchParams({ secretPath: "/", search: "", tags: "" })]
middlewares: [stripSearchParams({ secretPath: '/', search: '', tags: '' })],
},
beforeLoad: ({ context, params, search }) => {
const secretPathSegments = search.secretPath.split("/").filter(Boolean);
const secretPathSegments = search.secretPath.split('/').filter(Boolean)
return {
breadcrumbs: [
...context.breadcrumbs,
{
type: BreadcrumbTypes.Dropdown,
label: context.project.environments.find((el) => el.slug === params.envSlug)?.name || "",
dropdownTitle: "Environments",
label:
context.project.environments.find(
(el) => el.slug === params.envSlug,
)?.name || '',
dropdownTitle: 'Environments',
links: context.project.environments.map((el) => ({
label: el.name,
link: linkOptions({
to: "/secret-manager/$projectId/secrets/$envSlug",
to: '/secret-manager/$projectId/secrets/$envSlug',
params: {
projectId: params.projectId,
envSlug: el.slug
}
})
}))
envSlug: el.slug,
},
}),
})),
},
...secretPathSegments.map((_, index) => ({
type: BreadcrumbTypes.Component,
@@ -49,9 +56,9 @@ export const Route = createFileRoute(
environmentSlug={params.envSlug}
projectId={params.projectId}
/>
)
}))
]
};
}
});
),
})),
],
}
},
})