Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
-12
@@ -25,18 +25,6 @@ vi.mock("~/utils/data/useAppOrAdminData", () => ({
|
||||
useAppOrAdminData: () => ({ currentTenant: null }),
|
||||
}));
|
||||
|
||||
vi.mock("~/utils/data/useRootData", () => ({
|
||||
useRootData: () => ({ userSession: { lightOrDarkMode: "light" } }),
|
||||
}));
|
||||
|
||||
vi.mock("~/stores/themePreviewStore", () => ({
|
||||
useThemePreviewStore: () => ({ isPreviewActive: false, previewConfig: null }),
|
||||
}));
|
||||
|
||||
vi.mock("~/utils/theme/ThemeConfig", () => ({
|
||||
parseThemeConfig: () => ({}),
|
||||
}));
|
||||
|
||||
vi.mock("./app-sidebar", () => ({
|
||||
ShadcnAppSidebar: ({ layout }: { layout: string }) => <aside data-ui-id={`ui.surface.${layout}.sidebar`} />,
|
||||
}));
|
||||
|
||||
+2
-49
@@ -8,10 +8,7 @@ import { lazy, Suspense, useRef, useState } from "react";
|
||||
import { NavActions } from "./nav-actions";
|
||||
import { useCommandPalette } from "~/components/ui/commandPalettes/CommandPalette";
|
||||
import { Separator } from "~/components/ui/separator";
|
||||
import { useThemePreviewStore } from "~/stores/themePreviewStore";
|
||||
import { parseThemeConfig } from "~/utils/theme/ThemeConfig";
|
||||
import { useAppOrAdminData } from "~/utils/data/useAppOrAdminData";
|
||||
import { useRootData } from "~/utils/data/useRootData";
|
||||
import { UI_ACTION_IDS, UI_SURFACE_IDS } from "~/application/ui/uiRegistry";
|
||||
|
||||
const OnboardingSession = lazy(() => import("~/modules/onboarding/components/OnboardingSession"));
|
||||
@@ -31,10 +28,7 @@ export default function ShadcnSidebarLayout({
|
||||
const [searchParams] = useSearchParams();
|
||||
const mainElement = useRef<HTMLElement>(null);
|
||||
|
||||
// Get the app data which includes tenant theme config
|
||||
const appOrAdminData = useAppOrAdminData();
|
||||
const { userSession } = useRootData();
|
||||
const { isPreviewActive, previewConfig } = useThemePreviewStore();
|
||||
|
||||
const commandPalette = useCommandPalette();
|
||||
|
||||
@@ -49,55 +43,14 @@ export default function ShadcnSidebarLayout({
|
||||
void location;
|
||||
void hasCalendar;
|
||||
|
||||
let themeConfig = isPreviewActive && previewConfig ? previewConfig : parseThemeConfig(appOrAdminData?.currentTenant?.themeConfig as string | null);
|
||||
|
||||
let sidebarStyle: Record<string, string> = {};
|
||||
|
||||
if (themeConfig?.colors) {
|
||||
let colors = themeConfig.colors;
|
||||
if (userSession?.lightOrDarkMode === "dark" && themeConfig?.darkColors) {
|
||||
colors = themeConfig.darkColors;
|
||||
}
|
||||
if (colors.sidebar) {
|
||||
// Sidebar specific colors
|
||||
sidebarStyle["--sidebar"] = colors.sidebar;
|
||||
}
|
||||
if (colors.sidebarForeground) {
|
||||
sidebarStyle["--sidebar-foreground"] = colors.sidebarForeground;
|
||||
}
|
||||
if (colors.sidebarPrimary) {
|
||||
sidebarStyle["--sidebar-primary"] = colors.sidebarPrimary;
|
||||
}
|
||||
if (colors.sidebarPrimaryForeground) {
|
||||
sidebarStyle["--sidebar-primary-foreground"] = colors.sidebarPrimaryForeground;
|
||||
}
|
||||
if (colors.sidebarAccent) {
|
||||
sidebarStyle["--sidebar-accent"] = colors.sidebarAccent;
|
||||
}
|
||||
if (colors.sidebarAccentForeground) {
|
||||
sidebarStyle["--sidebar-accent-foreground"] = colors.sidebarAccentForeground;
|
||||
}
|
||||
if (colors.sidebarBorder) {
|
||||
sidebarStyle["--sidebar-border"] = colors.sidebarBorder;
|
||||
}
|
||||
if (colors.sidebarRing) {
|
||||
sidebarStyle["--sidebar-ring"] = colors.sidebarRing;
|
||||
}
|
||||
}
|
||||
|
||||
if (!appOrAdminData.currentTenant) {
|
||||
sidebarStyle = {};
|
||||
themeConfig = {};
|
||||
}
|
||||
|
||||
return (
|
||||
<SidebarProvider style={sidebarStyle as React.CSSProperties} data-ui-id={UI_SURFACE_IDS.shell}>
|
||||
<SidebarProvider data-ui-id={UI_SURFACE_IDS.shell}>
|
||||
{appOrAdminData?.onboardingSession ? (
|
||||
<Suspense fallback={null}>
|
||||
<OnboardingSession open={onboardingModalOpen} setOpen={setOnboardingModalOpen} />
|
||||
</Suspense>
|
||||
) : null}
|
||||
<ShadcnAppSidebar layout={layout} items={menuItems} themeConfig={themeConfig} style={sidebarStyle as React.CSSProperties} />
|
||||
<ShadcnAppSidebar layout={layout} items={menuItems} />
|
||||
<SidebarInset className="overflow-hidden" data-ui-id={UI_SURFACE_IDS.shellInset}>
|
||||
<header
|
||||
className="border-border bg-background flex h-16 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12"
|
||||
|
||||
+51
-2
@@ -21,7 +21,7 @@ vi.mock("~/utils/data/useRootData", () => ({
|
||||
}));
|
||||
|
||||
let mockedPermissions = ["app.dashboard.view"];
|
||||
let mockedCurrentTenant: null | { slug: string; logo: string } = null;
|
||||
let mockedCurrentTenant: null | { slug: string; name: string; logo: string } = null;
|
||||
|
||||
vi.mock("~/utils/data/useAppOrAdminData", () => ({
|
||||
useAppOrAdminData: () => ({
|
||||
@@ -38,6 +38,10 @@ vi.mock("./nav-user", () => ({
|
||||
NavUser: ({ layout }: { layout: string }) => <div data-testid="nav-user">User {layout}</div>,
|
||||
}));
|
||||
|
||||
vi.mock("./team-switcher", () => ({
|
||||
TeamSwitcher: () => <div data-testid="team-switcher" />,
|
||||
}));
|
||||
|
||||
const baseItems = [
|
||||
{
|
||||
id: "ui.nav.test.main",
|
||||
@@ -153,8 +157,44 @@ describe("ShadcnAppSidebar UI IDs", () => {
|
||||
expect(screen.getByRole("link", { name: "Settings" })).toHaveAttribute("data-active", "true");
|
||||
});
|
||||
|
||||
it("keeps consolidated workspace entries active on alternate area routes", () => {
|
||||
const workspaceItems: SideBarItem[] = [
|
||||
{
|
||||
id: "ui.nav.test.main",
|
||||
title: "Main",
|
||||
path: "",
|
||||
items: [
|
||||
{
|
||||
id: "ui.nav.test.communication",
|
||||
title: "Communication",
|
||||
path: "/acme/emails",
|
||||
activePaths: ["/acme/emails", "/acme/email-marketing", "/acme/forms"],
|
||||
contextItems: [
|
||||
{ title: "Mailbox", path: "/acme/emails" },
|
||||
{ title: "Campaigns", path: "/acme/email-marketing" },
|
||||
{ title: "Forms", path: "/acme/forms" },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
render(
|
||||
<MemoryRouter initialEntries={["/acme/forms/form_1"]}>
|
||||
<SidebarProvider>
|
||||
<ShadcnAppSidebar layout="app" items={workspaceItems} />
|
||||
</SidebarProvider>
|
||||
</MemoryRouter>
|
||||
);
|
||||
|
||||
expect(screen.getByRole("link", { name: "Communication" })).toHaveAttribute("data-active", "true");
|
||||
expect(screen.queryByRole("link", { name: "Mailbox" })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("link", { name: "Campaigns" })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("link", { name: "Forms" })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("does not render tenant logo links inside the admin sidebar", () => {
|
||||
mockedCurrentTenant = { slug: "acme", logo: "/tenant-logo.svg" };
|
||||
mockedCurrentTenant = { slug: "acme", name: "Acme", logo: "/tenant-logo.svg" };
|
||||
|
||||
renderSidebar("admin", "/dashboard");
|
||||
|
||||
@@ -162,6 +202,15 @@ describe("ShadcnAppSidebar UI IDs", () => {
|
||||
expect(screen.queryByRole("link", { name: "Logo" })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("uses the tenant name for the tenant logo link", () => {
|
||||
mockedCurrentTenant = { slug: "acme", name: "Acme", logo: "/tenant-logo.svg" };
|
||||
|
||||
renderSidebar("app", "/acme/dashboard");
|
||||
|
||||
expect(screen.getByRole("link", { name: "Acme" })).toHaveAttribute("href", "/acme/dashboard");
|
||||
expect(screen.getByAltText("Acme")).toHaveAttribute("src", "/tenant-logo.svg");
|
||||
});
|
||||
|
||||
it("filters sidebar items by declared permission", () => {
|
||||
const permissionItems: SideBarItem[] = [
|
||||
{
|
||||
|
||||
+17
-5
@@ -207,7 +207,13 @@ export function ShadcnAppSidebar({
|
||||
}
|
||||
|
||||
function isCurrent(menuItem: SideBarItem): boolean {
|
||||
return pathMatchesCurrent(getPath(menuItem), menuItem.exact);
|
||||
if (menuItem.excludePaths?.some((path) => pathMatchesCurrent(UrlUtils.replaceVariables(params, path) ?? path))) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
pathMatchesCurrent(getPath(menuItem), menuItem.exact) ||
|
||||
(menuItem.activePaths?.some((path) => pathMatchesCurrent(UrlUtils.replaceVariables(params, path) ?? path)) ?? false)
|
||||
);
|
||||
}
|
||||
|
||||
function currentIsChild(menuItem: SideBarItem): boolean {
|
||||
@@ -240,7 +246,9 @@ export function ShadcnAppSidebar({
|
||||
return !item.tenantUserTypes || (currentRole !== null && item.tenantUserTypes.includes(currentRole));
|
||||
}
|
||||
function checkUserRolePermissions(item: SideBarItem) {
|
||||
return !item.permission || getUserHasPermission(appOrAdminData, item.permission);
|
||||
const hasRequired = !item.permission || getUserHasPermission(appOrAdminData, item.permission);
|
||||
const hasAny = !item.anyPermissions || item.anyPermissions.some((permission) => getUserHasPermission(appOrAdminData, permission));
|
||||
return hasRequired && hasAny;
|
||||
}
|
||||
function getVisibleItem(item: SideBarItem): SideBarItem | null {
|
||||
if (item.hidden === true || !allowCurrentUserType(item) || !allowCurrentTenantUserType(item)) {
|
||||
@@ -248,16 +256,20 @@ export function ShadcnAppSidebar({
|
||||
}
|
||||
|
||||
const items = item.items?.map((child) => getVisibleItem(child)).filter((child): child is SideBarItem => child !== null) ?? [];
|
||||
const contextItems = item.contextItems?.map((child) => getVisibleItem(child)).filter((child): child is SideBarItem => child !== null) ?? [];
|
||||
const hasPermission = checkUserRolePermissions(item);
|
||||
if (!hasPermission && items.length === 0) {
|
||||
if ((!hasPermission && items.length === 0 && contextItems.length === 0) || ((item.contextItems?.length ?? 0) > 0 && contextItems.length === 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const ownPathVisible = contextItems.some((child) => child.path === item.path);
|
||||
|
||||
return {
|
||||
...item,
|
||||
path: hasPermission ? item.path : "",
|
||||
path: hasPermission && (contextItems.length === 0 || ownPathVisible) ? item.path : (contextItems[0]?.path ?? ""),
|
||||
redirectTo: hasPermission ? item.redirectTo : undefined,
|
||||
items,
|
||||
contextItems,
|
||||
};
|
||||
}
|
||||
const getMenu = (): SidebarGroupDto[] => {
|
||||
@@ -316,7 +328,7 @@ export function ShadcnAppSidebar({
|
||||
{props.layout === "app" && appData.currentTenant?.logo ? (
|
||||
<a href={appPath({ tenantSlug: appData.currentTenant.slug, path: "dashboard", mode: "host-aware" })} className="flex justify-center">
|
||||
<div className="flex shrink-0 items-center justify-center border-b border-transparent">
|
||||
<img className="mx-auto h-10 w-auto p-1.5" src={appData.currentTenant.logo} alt="Logo" />
|
||||
<img className="mx-auto h-10 w-auto p-1.5" src={appData.currentTenant.logo} alt={appData.currentTenant.name} />
|
||||
</div>
|
||||
</a>
|
||||
) : null}
|
||||
|
||||
+5
-1
@@ -122,7 +122,7 @@ describe("NavActions host-aware links", () => {
|
||||
const subscription = screen.getByRole("link", { name: /app\.navbar\.subscription/i });
|
||||
|
||||
expect(profile).toHaveAttribute("href", "/acme/settings/profile");
|
||||
expect(subscription).toHaveAttribute("href", "/acme/settings/subscription");
|
||||
expect(subscription).toHaveAttribute("href", "/acme/settings/billing");
|
||||
expect(profile.getAttribute("href")).not.toContain("/app/");
|
||||
expect(subscription.getAttribute("href")).not.toContain("/app/");
|
||||
});
|
||||
@@ -147,6 +147,10 @@ describe("NavActions host-aware links", () => {
|
||||
expect(fetcherSubmit).toHaveBeenCalledWith(expect.any(HTMLFormElement), {
|
||||
method: "post",
|
||||
action: "/acme",
|
||||
// AK-P21 — the widget carries an optional image attachment, which only
|
||||
// reaches the action as multipart. Pinned here because a silent fall back
|
||||
// to urlencoded would drop the file without any visible error.
|
||||
encType: "multipart/form-data",
|
||||
});
|
||||
expect(fetcherSubmit.mock.calls[0][1].action).not.toContain("/app/");
|
||||
});
|
||||
|
||||
+7
-63
@@ -10,15 +10,12 @@ import NavBar from "../../NavBar";
|
||||
import { getUserHasPermission } from "~/utils/helpers/PermissionsHelper";
|
||||
import { useAppOrAdminData } from "~/utils/data/useAppOrAdminData";
|
||||
import { useRootData } from "~/utils/data/useRootData";
|
||||
import { Form, useFetcher, useLocation, useParams } from "react-router";
|
||||
import { Form, useParams } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { adminPath, appPath } from "~/utils/app/CanonicalUrlUtils";
|
||||
import Modal from "~/components/ui/modals/Modal";
|
||||
import StarsIconFilled from "~/components/ui/icons/StarsIconFilled";
|
||||
import OnboardingButton from "../../buttons/OnboardingButton";
|
||||
import { toast } from "sonner";
|
||||
import ButtonPrimary from "~/components/ui/buttons/ButtonPrimary";
|
||||
import { Textarea } from "~/components/ui/textarea";
|
||||
import { FeedbackFormDialog } from "../../buttons/AddFeedbackButton";
|
||||
import { UI_ACTION_IDS, UI_SURFACE_IDS } from "~/application/ui/uiRegistry";
|
||||
import NotificationsButton from "../../buttons/NotificationsButton";
|
||||
|
||||
@@ -155,7 +152,7 @@ export function NavActions({
|
||||
|
||||
{getUserHasPermission(appOrAdminData, "app.settings.subscription.view") && (
|
||||
<SidebarMenuItem>
|
||||
<a href={tenantPath("settings/subscription")}>
|
||||
<a href={tenantPath("settings/billing")}>
|
||||
<SidebarMenuButton data-ui-id={UI_ACTION_IDS.subscription}>
|
||||
<CreditCard className="mr-2 h-4 w-4" />
|
||||
{t("app.navbar.subscription")}
|
||||
@@ -225,63 +222,10 @@ function AddFeedbackButton() {
|
||||
<StarsIconFilled className="size-5 p-0.5" />
|
||||
</span>
|
||||
</Button>
|
||||
<Modal open={isOpen} setOpen={setIsOpen} size="sm" data-ui-id={UI_SURFACE_IDS.feedbackDialog}>
|
||||
<FeedbackForm isOpen={isOpen} onClose={() => setIsOpen(false)} />
|
||||
</Modal>
|
||||
{/* AK-P21: shared ~/ui Dialog (category select + rate-limit hint), see AddFeedbackButton.tsx. */}
|
||||
<span data-ui-id={UI_SURFACE_IDS.feedbackDialog}>
|
||||
<FeedbackFormDialog open={isOpen} onClose={() => setIsOpen(false)} />
|
||||
</span>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
function FeedbackForm({ isOpen, onClose }: { isOpen: boolean; onClose: () => void }) {
|
||||
const { t } = useTranslation();
|
||||
const params = useParams();
|
||||
const appOrAdminData = useAppOrAdminData();
|
||||
const fetcher = useFetcher<{ success?: string; error?: string }>();
|
||||
const location = useLocation();
|
||||
|
||||
const mainInput = React.useRef<HTMLTextAreaElement>(null);
|
||||
React.useEffect(() => {
|
||||
if (isOpen) {
|
||||
setTimeout(() => {
|
||||
mainInput.current?.focus();
|
||||
}, 100);
|
||||
}
|
||||
}, [isOpen]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (fetcher.data?.success) {
|
||||
toast.success(fetcher.data.success);
|
||||
onClose();
|
||||
} else if (fetcher.data?.error) {
|
||||
toast.error(fetcher.data.error);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [fetcher.data]);
|
||||
|
||||
const onSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
fetcher.submit(e.currentTarget, {
|
||||
method: "post",
|
||||
action: params.tenant ? appPath({ tenantSlug: params.tenant, mode: "host-aware" }) : "",
|
||||
});
|
||||
// onClose();
|
||||
};
|
||||
return (
|
||||
<fetcher.Form onSubmit={onSubmit} method="post">
|
||||
<input type="hidden" name="action" value="add-feedback" readOnly hidden />
|
||||
<input type="hidden" name="tenantId" value={appOrAdminData.currentTenant?.id} readOnly hidden />
|
||||
<input type="hidden" name="fromUrl" value={location.pathname} readOnly hidden />
|
||||
<div className="space-y-3">
|
||||
<h3 className="text-lg leading-6 font-medium">{t("feedback.title")}</h3>
|
||||
<p className="text-muted-foreground text-sm">{t("feedback.description")}</p>
|
||||
<Textarea ref={mainInput} name="message" defaultValue="" required rows={5} placeholder={t("feedback.placeholder")} />
|
||||
<div className="flex justify-between">
|
||||
<button type="button" onClick={onClose} className="text-muted-foreground text-sm hover:underline">
|
||||
{t("shared.cancel")}
|
||||
</button>
|
||||
<ButtonPrimary type="submit">{t("feedback.send")}</ButtonPrimary>
|
||||
</div>
|
||||
</div>
|
||||
</fetcher.Form>
|
||||
);
|
||||
}
|
||||
+15
-2
@@ -2,6 +2,7 @@
|
||||
|
||||
import { type ReactNode } from "react";
|
||||
import { Fragment } from "react/jsx-runtime";
|
||||
import { Link } from "react-router";
|
||||
import { SidebarGroupDto } from "~/application/sidebar/SidebarGroupDto";
|
||||
|
||||
import {
|
||||
@@ -27,9 +28,21 @@ function hasConfiguredChildren(item: SidebarNavItem) {
|
||||
return (item.items?.length ?? 0) > 0;
|
||||
}
|
||||
|
||||
function isInternalNavigationPath(to: string) {
|
||||
return to.startsWith("/") && !to.startsWith("//");
|
||||
}
|
||||
|
||||
function SidebarLink({ to, children, ...props }: { to: string; children: ReactNode } & Record<string, unknown>) {
|
||||
if (isInternalNavigationPath(to)) {
|
||||
return (
|
||||
<Link to={to} data-navigation-kind="client" {...props}>
|
||||
{children}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<a href={to} {...props}>
|
||||
<a href={to} data-navigation-kind="document" {...props}>
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
@@ -38,7 +51,7 @@ function SidebarLink({ to, children, ...props }: { to: string; children: ReactNo
|
||||
function SidebarItemContent({ item }: { item: SidebarNavItem }) {
|
||||
return (
|
||||
<>
|
||||
{item.icon !== undefined && <SidebarIcon className="size-4" item={item} />}
|
||||
{item.icon !== undefined && <SidebarIcon className="size-5" item={item} />}
|
||||
<span>{item.title}</span>
|
||||
</>
|
||||
);
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import {
|
||||
import { SidebarGroupDto } from "~/application/sidebar/SidebarGroupDto";
|
||||
import SidebarIcon from "../../icons/SidebarIcon";
|
||||
import { getUiIdAttributes } from "~/application/ui/uiRegistry";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
|
||||
type SidebarNavItem = SidebarGroupDto["items"][number];
|
||||
|
||||
|
||||
+2
-2
@@ -114,7 +114,7 @@ export function NavUser({
|
||||
</DropdownMenuItem>
|
||||
</a>
|
||||
{getUserHasPermission(appOrAdminData, "app.settings.subscription.view") && (
|
||||
<a href={UrlUtils.currentTenantUrl(params, `settings/subscription`)}>
|
||||
<a href={UrlUtils.currentTenantUrl(params, `settings/billing`)}>
|
||||
<DropdownMenuItem>
|
||||
<CreditCard className="mr-2 h-4 w-4" />
|
||||
{t("app.navbar.subscription")}
|
||||
@@ -122,7 +122,7 @@ export function NavUser({
|
||||
</a>
|
||||
)}
|
||||
{getUserHasPermission(appOrAdminData, "app.settings.account.view") && (
|
||||
<a href={UrlUtils.currentTenantUrl(params, `settings/account`)}>
|
||||
<a href={UrlUtils.currentTenantUrl(params, `settings/workspace`)}>
|
||||
<DropdownMenuItem>
|
||||
<BadgeCheck className="mr-2 h-4 w-4" />
|
||||
{t("app.navbar.tenant")}
|
||||
|
||||
-35
@@ -29,11 +29,6 @@ export function TeamSwitcher({ tenants, size = "md" }: { tenants: TenantSimple[]
|
||||
|
||||
const [activeTenant] = React.useState(appData?.currentTenant);
|
||||
|
||||
let activeTenantDescription = getTenantDescription({
|
||||
subscription: appData.mySubscription,
|
||||
types: appData.currentTenant.types,
|
||||
t,
|
||||
});
|
||||
const newAccountPath = absolutePublicAppPath(rootData.routing, "new-account");
|
||||
|
||||
return (
|
||||
@@ -63,7 +58,6 @@ export function TeamSwitcher({ tenants, size = "md" }: { tenants: TenantSimple[]
|
||||
</div>
|
||||
<div className="grid flex-1 text-left text-sm leading-tight">
|
||||
<span className="truncate font-semibold">{activeTenant.name}</span>
|
||||
{size === "md" && <span className="truncate text-xs">{activeTenantDescription}</span>}
|
||||
</div>
|
||||
<ChevronsUpDown className="ml-auto" />
|
||||
</SidebarMenuButton>
|
||||
@@ -95,9 +89,6 @@ export function TeamSwitcher({ tenants, size = "md" }: { tenants: TenantSimple[]
|
||||
</div>
|
||||
<div className="truncate">
|
||||
<div className="text-foreground truncate text-sm">{tenant.name} </div>
|
||||
{/* {tenant.types.length > 0 && (
|
||||
<span className=" truncate text-xs">{getTenantDescription({ subscription: null, types: tenant.types, t })}</span>
|
||||
)} */}
|
||||
</div>
|
||||
</div>
|
||||
{/* <div className="shrink-0">
|
||||
@@ -142,29 +133,3 @@ function CreateAccountMenuItem({ label }: { label: string }) {
|
||||
</DropdownMenuItem>
|
||||
);
|
||||
}
|
||||
|
||||
function getTenantDescription({
|
||||
subscription,
|
||||
types,
|
||||
t,
|
||||
}: {
|
||||
subscription: {
|
||||
products: { subscriptionProduct: { title: string } }[];
|
||||
} | null;
|
||||
types: { title: string }[];
|
||||
t: any;
|
||||
}) {
|
||||
void subscription;
|
||||
void types;
|
||||
void t;
|
||||
return "";
|
||||
// let activeTenantDescription = subscription?.products.length
|
||||
// ? t(subscription.products.find((f) => f)?.subscriptionProduct.title || "")
|
||||
// : t("settings.subscription.noSubscription");
|
||||
// if (!subscription || !subscription.products.length) {
|
||||
// // if (types.length > 0) {
|
||||
// // activeTenantDescription = t(types[0].title);
|
||||
// // }
|
||||
// }
|
||||
// return activeTenantDescription;
|
||||
}
|
||||
Reference in new issue
Block a user