Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+136
-100
@@ -1,7 +1,5 @@
|
||||
import { SideBarItem } from "./SidebarItem";
|
||||
import { EntitySimple } from "~/utils/db/entities/entities.db.server";
|
||||
import { TFunction, type i18n as I18n } from "i18next";
|
||||
import { EntityGroupWithDetails } from "~/utils/db/entities/entityGroups.db.server";
|
||||
import { AppConfiguration } from "~/utils/db/appConfiguration.db.server";
|
||||
import IconSettings from "~/components/layouts/icons/IconSettings";
|
||||
import IconDashboard from "~/components/layouts/icons/IconDashboard";
|
||||
@@ -10,46 +8,88 @@ import IconNotifications from "~/components/layouts/icons/IconNotifications";
|
||||
import IconEmails from "~/components/layouts/icons/IconEmails";
|
||||
import IconKeys from "~/components/layouts/icons/IconKeys";
|
||||
import IconWorkflows from "~/components/layouts/icons/IconWorkflows";
|
||||
import CreditsIcon from "~/components/ui/icons/CreditsIcon";
|
||||
import AddressBookIcon from "~/components/ui/icons/crm/AddressBookIcon";
|
||||
import IconDocs from "~/components/layouts/icons/IconDocs";
|
||||
import ViewListIcon from "~/components/ui/icons/ViewListIcon";
|
||||
import { UI_ID_PATTERNS, UI_NAV_IDS, uiIdSegment } from "~/application/ui/uiRegistry";
|
||||
import CalendarIcon from "~/components/ui/icons/CalendarIcon";
|
||||
import { UI_NAV_IDS } from "~/application/ui/uiRegistry";
|
||||
import { appPath } from "~/utils/app/CanonicalUrlUtils";
|
||||
import { absoluteAdminPath, type PublicDomainRoutingConfig } from "~/utils/app/CrossHostUrls";
|
||||
import { getEntityPermission } from "~/utils/helpers/PermissionsHelper";
|
||||
import { translateLabel } from "~/utils/i18n/translateLabel";
|
||||
import { resolveConnectorNavState } from "~/utils/connector/connectorNavState";
|
||||
import { WALKING_SKELETON_MODULE_KEY } from "~/modules/walkingSkeleton/constants";
|
||||
import { SearchIcon } from "~/components/ui/icons/vendor";
|
||||
|
||||
type Props = {
|
||||
t: TFunction;
|
||||
i18n: I18n;
|
||||
tenantId: string;
|
||||
entities: EntitySimple[];
|
||||
entityGroups: EntityGroupWithDetails[];
|
||||
appConfiguration: AppConfiguration | null;
|
||||
routing?: PublicDomainRoutingConfig;
|
||||
productAccess?: Record<string, { allowed: boolean; reason?: string }>;
|
||||
};
|
||||
|
||||
export const AppSidebar = ({ t, i18n, tenantId, entities, entityGroups, routing, productAccess }: Props): SideBarItem[] => {
|
||||
export const AppSidebar = ({ t, tenantId, routing, productAccess }: Props): SideBarItem[] => {
|
||||
const tenantPath = (path?: string) => appPath({ tenantSlug: tenantId, path, mode: "host-aware" });
|
||||
const hasFeatureAccess = (featureKey: string) => productAccess?.[featureKey]?.allowed === true;
|
||||
const hasDashboardAccess = productAccess ? hasFeatureAccess("dashboard") : true;
|
||||
// R-P1c Konnektor-Demo: Walking-Skeleton-Eintrag zeigt die drei Gate-Zustaende (aktiv/gesperrt/ausgeblendet).
|
||||
const walkingSkeletonDecision = productAccess?.[WALKING_SKELETON_MODULE_KEY];
|
||||
const walkingSkeletonState = walkingSkeletonDecision ? resolveConnectorNavState(walkingSkeletonDecision) : "hidden";
|
||||
|
||||
const sectionItems: SideBarItem[] = [];
|
||||
const entitiesItems: SideBarItem[] = [];
|
||||
const productCoreItems: SideBarItem[] = [
|
||||
...(hasFeatureAccess("search")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appSearch,
|
||||
title: t("search.nav.title"),
|
||||
path: tenantPath("search"),
|
||||
icon: <SearchIcon />,
|
||||
permission: "search.use" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("automation")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appAutomation,
|
||||
title: t("automation.nav.title"),
|
||||
path: tenantPath("automations"),
|
||||
icon: <IconWorkflows />,
|
||||
permission: "automation.read" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("crm-basic")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appCrm,
|
||||
title: t("crm:title"),
|
||||
path: tenantPath("crm"),
|
||||
// R-P6: typed CRM contacts replace the entity-builder CRM (/crm → /contacts).
|
||||
path: tenantPath("contacts"),
|
||||
icon: <AddressBookIcon />,
|
||||
permission: "crm.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("leads")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appLeads,
|
||||
title: t("leads.nav.title"),
|
||||
path: tenantPath("leads"),
|
||||
icon: <ViewListIcon />,
|
||||
permission: "leads.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("projects")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appProjects,
|
||||
title: t("projects.nav.title"),
|
||||
path: tenantPath("projects"),
|
||||
icon: <ViewListIcon />,
|
||||
permission: "projects.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
@@ -75,6 +115,78 @@ export const AppSidebar = ({ t, i18n, tenantId, entities, entityGroups, routing,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("hr")
|
||||
? [
|
||||
{
|
||||
id: "ui.nav.app.hr",
|
||||
title: t("hr.nav.title"),
|
||||
path: tenantPath("hr"),
|
||||
icon: <AddressBookIcon />,
|
||||
permission: "hr.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("integrations")
|
||||
? [
|
||||
{
|
||||
id: "ui.nav.app.integrations",
|
||||
title: t("integrations.nav.title"),
|
||||
path: tenantPath("integrations"),
|
||||
icon: <IconWorkflows />,
|
||||
permission: "integrations.read" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("integrations")
|
||||
? [
|
||||
{
|
||||
// AK-P16a · calendar reuses the integrations feature gate (it is an
|
||||
// Apps-Engine integration); the entry is gated by calendar.connect_own.
|
||||
id: UI_NAV_IDS.appCalendar,
|
||||
title: t("calendar.nav.title"),
|
||||
path: tenantPath("calendar"),
|
||||
icon: <CalendarIcon />,
|
||||
permission: "calendar.connect_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("email-inbox")
|
||||
? [
|
||||
{
|
||||
// VA-P23 · mailbox sync inbox — own `email-inbox` feature gate; the
|
||||
// entry is gated by email.read_own (own-mailbox visibility, M09 I).
|
||||
id: UI_NAV_IDS.appEmails,
|
||||
title: t("emailInbox.nav.title"),
|
||||
path: tenantPath("emails"),
|
||||
icon: <IconEmails className="h-5 w-5" />,
|
||||
permission: "email.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("booking")
|
||||
? [
|
||||
{
|
||||
// AK-P16b · Booking module — own `booking` feature gate; the entry is
|
||||
// gated by bookings.read_own (every provider can see their own bookings).
|
||||
id: UI_NAV_IDS.appBookings,
|
||||
title: t("bookings.nav.title"),
|
||||
path: tenantPath("bookings"),
|
||||
icon: <CalendarIcon />,
|
||||
permission: "bookings.read_own" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("forms")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appForms,
|
||||
title: t("settings.forms.admin.title"),
|
||||
path: tenantPath("forms"),
|
||||
icon: <ViewListIcon />,
|
||||
permission: "forms.basic" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("email-marketing")
|
||||
? [
|
||||
{
|
||||
@@ -105,16 +217,6 @@ export const AppSidebar = ({ t, i18n, tenantId, entities, entityGroups, routing,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(hasFeatureAccess("ai-credits")
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appCredits,
|
||||
title: t("models.credit.plural"),
|
||||
path: tenantPath("settings/credits"),
|
||||
icon: <CreditsIcon />,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(walkingSkeletonState !== "hidden"
|
||||
? [
|
||||
{
|
||||
@@ -128,87 +230,23 @@ export const AppSidebar = ({ t, i18n, tenantId, entities, entityGroups, routing,
|
||||
: []),
|
||||
];
|
||||
|
||||
entityGroups.forEach((group) => {
|
||||
const item: SideBarItem = {
|
||||
id: `ui.nav.app.entityGroup.${uiIdSegment(group.slug)}`,
|
||||
uiIdPattern: UI_ID_PATTERNS.appEntityGroup,
|
||||
uiIdParams: { groupSlug: group.slug },
|
||||
title: translateLabel(t, i18n, group.title),
|
||||
// icon: group.icon,
|
||||
path: tenantPath(`g/${group.slug}`),
|
||||
icon: group.icon,
|
||||
// isActive: true,
|
||||
};
|
||||
if (group.collapsible) {
|
||||
item.isCollapsible = true;
|
||||
item.items = [
|
||||
{
|
||||
id: `ui.nav.app.entityGroup.${uiIdSegment(group.slug)}.overview`,
|
||||
title: t("shared.overview"),
|
||||
path: tenantPath(`g/${group.slug}`),
|
||||
},
|
||||
...group.entities.map(({ entity }) => {
|
||||
return {
|
||||
id: `ui.nav.app.entityGroup.${uiIdSegment(group.slug)}.entity.${uiIdSegment(entity.slug)}`,
|
||||
uiIdPattern: UI_ID_PATTERNS.appEntityGroupEntity,
|
||||
uiIdParams: { groupSlug: group.slug, entityName: entity.name ?? entity.slug },
|
||||
title: translateLabel(t, i18n, entity.titlePlural),
|
||||
// icon: entity.icon,
|
||||
path: tenantPath(`g/${group.slug}/${entity.slug}`),
|
||||
permission: getEntityPermission(entity, "view"),
|
||||
// entityIcon: entity.icon,
|
||||
};
|
||||
}),
|
||||
];
|
||||
}
|
||||
if (group.section) {
|
||||
const sectionTitle = translateLabel(t, i18n, group.section);
|
||||
const section = sectionItems.find((f) => f.title === sectionTitle);
|
||||
if (section) {
|
||||
section.items = [...(section.items ?? []), item];
|
||||
} else {
|
||||
sectionItems.push({
|
||||
id: `ui.nav.app.section.${uiIdSegment(group.section)}`,
|
||||
uiIdPattern: UI_ID_PATTERNS.appSection,
|
||||
uiIdParams: { sectionName: group.section },
|
||||
title: sectionTitle,
|
||||
path: ``,
|
||||
items: [item],
|
||||
});
|
||||
}
|
||||
} else {
|
||||
entitiesItems.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
entities
|
||||
.filter((f) => f.showInSidebar)
|
||||
.forEach((entity) => {
|
||||
entitiesItems.push({
|
||||
id: `ui.nav.app.entity.${uiIdSegment(entity.slug)}`,
|
||||
uiIdPattern: UI_ID_PATTERNS.appEntity,
|
||||
uiIdParams: { entityName: entity.name ?? entity.slug, entitySlug: entity.slug },
|
||||
title: translateLabel(t, i18n, entity.titlePlural),
|
||||
icon: entity.icon,
|
||||
// tenantUserTypes: [TenantUserType.OWNER, TenantUserType.ADMIN],
|
||||
path: tenantPath(entity.slug),
|
||||
permission: getEntityPermission(entity, "view"),
|
||||
// side: isDebugMode && SideText({ text: modelProperties.length > 0 ? "DB Model" : "Custom" }),
|
||||
});
|
||||
});
|
||||
|
||||
const appItem: SideBarItem = {
|
||||
id: "ui.nav.app.primary",
|
||||
title: "",
|
||||
path: "",
|
||||
items: [
|
||||
{
|
||||
id: UI_NAV_IDS.appDashboard,
|
||||
title: t("app.sidebar.dashboard"),
|
||||
path: tenantPath("dashboard"),
|
||||
icon: <IconDashboard />,
|
||||
// tenantUserTypes: [TenantUserType.OWNER, TenantUserType.ADMIN, TenantUserType.MEMBER],
|
||||
},
|
||||
...(hasDashboardAccess
|
||||
? [
|
||||
{
|
||||
id: UI_NAV_IDS.appDashboard,
|
||||
title: t("app.sidebar.dashboard"),
|
||||
path: tenantPath("dashboard"),
|
||||
icon: <IconDashboard />,
|
||||
permission: "dashboard.read" as const,
|
||||
// tenantUserTypes: [TenantUserType.OWNER, TenantUserType.ADMIN, TenantUserType.MEMBER],
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
id: UI_NAV_IDS.appNotifications,
|
||||
title: t("app.sidebar.notifications"),
|
||||
@@ -216,7 +254,6 @@ export const AppSidebar = ({ t, i18n, tenantId, entities, entityGroups, routing,
|
||||
icon: <IconNotifications />,
|
||||
},
|
||||
...productCoreItems,
|
||||
...entitiesItems,
|
||||
// {
|
||||
// title: t("models.email.plural"),
|
||||
// path: `${currentTenantUrl}/emails`,
|
||||
@@ -227,7 +264,6 @@ export const AppSidebar = ({ t, i18n, tenantId, entities, entityGroups, routing,
|
||||
|
||||
return [
|
||||
appItem,
|
||||
...sectionItems,
|
||||
{
|
||||
id: "ui.nav.app.secondary",
|
||||
title: "",
|
||||
|
||||
Reference in new issue
Block a user