import { useQuery } from "@tanstack/react-query"; import { ArrowLeft } from "lucide-react"; import { Link, Outlet, useLocation, useParams } from "react-router-dom"; import { Badge } from "../../../components/ui/badge"; import { fetchMe, fetchTenant } from "../../../lib/adminApi"; import { t } from "../../../lib/i18n"; function TenantDetailPage() { const params = useParams<{ tenantId: string }>(); const tenantId = params.tenantId ?? ""; const location = useLocation(); const tenantQuery = useQuery({ queryKey: ["tenant", tenantId], queryFn: () => fetchTenant(tenantId), enabled: tenantId.length > 0, }); const { data: profile } = useQuery({ queryKey: ["me"], queryFn: fetchMe, }); const canAccessSchema = profile?.role === "super_admin" || profile?.role === "tenant_admin"; const isPermissionsTab = location.pathname.includes("/permissions"); const isOrganizationTab = location.pathname.includes("/organization"); return (

{tenantQuery.data?.name ?? t("ui.admin.tenants.detail.loading", "불러오는 중...")}

{t( "ui.admin.tenants.detail.header_subtitle", "테넌트 정보를 수정하거나 연동 설정을 관리합니다.", )}

{/* Tabs */}
{t("ui.admin.tenants.detail.tab_profile", "프로필")} {t("ui.admin.tenants.detail.tab_permissions", "권한")} {t("ui.admin.tenants.detail.tab_organization", "조직 관리")} {canAccessSchema && ( {t("ui.admin.tenants.detail.tab_schema", "사용자 스키마")} )}
{/* Outlet for nested routes */}
); } export default TenantDetailPage;