import { useTranslation } from "react-i18next"; import { faMobile } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { Link, Outlet, useRouterState } from "@tanstack/react-router"; import { motion } from "framer-motion"; import { ProjectPermissionCan } from "@app/components/permissions"; import { BreadcrumbContainer, Menu, MenuGroup, MenuItem, TBreadcrumbFormat } from "@app/components/v2"; import { ProjectPermissionActions, ProjectPermissionSub, useSubscription, useWorkspace } from "@app/context"; import { useGetAccessRequestsCount, useGetSecretApprovalRequestCount, useGetSecretRotations } from "@app/hooks/api"; import { ProjectType } from "@app/hooks/api/workspace/types"; import { ProjectSelect } from "./components/ProjectSelect"; // This is a generic layout shared by all types of projects. // If the product layout differs significantly, create a new layout as needed. export const ProjectLayout = () => { const { currentWorkspace } = useWorkspace(); const matches = useRouterState({ select: (s) => s.matches.at(-1)?.context }); const breadcrumbs = matches && "breadcrumbs" in matches ? matches.breadcrumbs : undefined; const { t } = useTranslation(); const workspaceId = currentWorkspace?.id || ""; const projectSlug = currentWorkspace?.slug || ""; const { subscription } = useSubscription(); const isSecretManager = currentWorkspace?.type === ProjectType.SecretManager; const isCertManager = currentWorkspace?.type === ProjectType.CertificateManager; const isCmek = currentWorkspace?.type === ProjectType.KMS; const isSSH = currentWorkspace?.type === ProjectType.SSH; const { data: secretApprovalReqCount } = useGetSecretApprovalRequestCount({ workspaceId, options: { enabled: isSecretManager } }); const { data: accessApprovalRequestCount } = useGetAccessRequestsCount({ projectSlug, options: { enabled: isSecretManager } }); // we only show the secret rotations v1 tab if they have existing rotations const { data: secretRotations } = useGetSecretRotations({ workspaceId, options: { enabled: isSecretManager && Boolean(subscription.secretRotation), refetchOnMount: false } }); const pendingRequestsCount = (secretApprovalReqCount?.open || 0) + (accessApprovalRequestCount?.pendingCount || 0); return ( <>
{` ${t("common.no-mobile")} `}