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
+188
-117
@@ -1,4 +1,3 @@
|
||||
import { loadWebConfig } from "@hivegrid/config";
|
||||
import { Outlet, useLoaderData, useLocation, useNavigate, useParams } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { LoaderFunctionArgs, MetaFunction } from "react-router";
|
||||
@@ -7,6 +6,7 @@ import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import { useEffect } from "react";
|
||||
import { getUserHasPermission } from "~/utils/helpers/PermissionsHelper";
|
||||
import { useAppOrAdminData } from "~/utils/data/useAppOrAdminData";
|
||||
import { useAppData } from "~/utils/data/useAppData";
|
||||
import SidebarIconsLayout, { IconDto } from "~/components/ui/layouts/SidebarIconsLayout";
|
||||
import CustomerIcon from "~/components/ui/icons/settings/CustomerIcon";
|
||||
import CustomerIconFilled from "~/components/ui/icons/settings/CustomerIconFilled";
|
||||
@@ -16,25 +16,22 @@ import MembershipCardIcon from "~/components/ui/icons/settings/MembershipCardIco
|
||||
import MembershipCardIconFilled from "~/components/ui/icons/settings/MembershipCardIconFilled";
|
||||
import CompanyIcon from "~/components/ui/icons/crm/CompanyIcon";
|
||||
import CompanyIconFilled from "~/components/ui/icons/crm/CompanyIconFilled";
|
||||
import RestApiIcon from "~/components/ui/icons/entities/RestApiIcon";
|
||||
import RestApiIconFilled from "~/components/ui/icons/entities/RestApiIconFilled";
|
||||
import ActivityHistoryIcon from "~/components/ui/icons/entities/ActivityHistoryIcon";
|
||||
import ActivityHistoryIconFilled from "~/components/ui/icons/entities/ActivityHistoryIconFilled";
|
||||
import ModulesIcon from "~/components/ui/icons/entities/ModulesIcon";
|
||||
import ModulesIconFilled from "~/components/ui/icons/entities/ModulesIconFilled";
|
||||
import { useRootData } from "~/utils/data/useRootData";
|
||||
import { BellIcon, FileTextIcon, PaintbrushIcon, PlugIcon, ShieldCheckIcon } from "~/components/ui/icons/vendor";
|
||||
import { MailIcon, PlugIcon } from "~/components/ui/icons/vendor";
|
||||
import { isDemoDataUiEnabled } from "~/utils/services/.server/demoDataUi.server";
|
||||
import { UI_NAV_IDS } from "~/application/ui/uiRegistry";
|
||||
|
||||
type LoaderData = {
|
||||
title: string;
|
||||
isProduction?: boolean;
|
||||
demoDataUiEnabled: boolean;
|
||||
};
|
||||
|
||||
export const loader = async ({ request }: LoaderFunctionArgs) => {
|
||||
export const loader = async ({ request, params }: LoaderFunctionArgs) => {
|
||||
const { t } = await getTranslations(request);
|
||||
const data: LoaderData = {
|
||||
title: `${t("app.navbar.settings")} | ${process.env.APP_NAME}`,
|
||||
isProduction: loadWebConfig().config.nodeEnv === "production",
|
||||
demoDataUiEnabled: isDemoDataUiEnabled(undefined, { tenantSlug: params.tenant }),
|
||||
};
|
||||
return data;
|
||||
};
|
||||
@@ -43,138 +40,205 @@ export const meta: MetaFunction<typeof loader> = ({ data }) => [{ title: data?.t
|
||||
|
||||
export default function SettingsRoute() {
|
||||
const { t } = useTranslation();
|
||||
useLoaderData<LoaderData>();
|
||||
const { demoDataUiEnabled } = useLoaderData<LoaderData>();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const params = useParams();
|
||||
const appOrAdminData = useAppOrAdminData();
|
||||
const rootData = useRootData();
|
||||
const appData = useAppData();
|
||||
const hasFeatureAccess = (featureKey: string) => appOrAdminData.productAccess?.[featureKey]?.allowed === true;
|
||||
|
||||
const getTabs = () => {
|
||||
const tabs: IconDto[] = [];
|
||||
// AK-SET-01 Hub A: Profil, Sicherheit, Benachrichtigungen und "Meine Daten"
|
||||
// sind Tabs INNERHALB von "Mein Konto". Ungated — jeder verwaltet seine
|
||||
// eigenen Einstellungen, und der DSGVO-Self-Service muss für alle
|
||||
// erreichbar bleiben (DoD B6).
|
||||
tabs.push({
|
||||
name: t("settings.profile.profileTitle"),
|
||||
name: t("settings.hubs.account.title"),
|
||||
href: UrlUtils.currentTenantUrl(params, "settings/profile"),
|
||||
icon: <CustomerIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <CustomerIconFilled className="size-4" aria-hidden="true" />,
|
||||
icon: (
|
||||
<span data-ui-id={UI_NAV_IDS.appSettingsAccount}>
|
||||
<CustomerIcon className="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
iconSelected: (
|
||||
<span data-ui-id={UI_NAV_IDS.appSettingsAccount}>
|
||||
<CustomerIconFilled className="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
});
|
||||
// Sicherheit (aktive Sitzungen + vertrauenswürdige Geräte) — jeder verwaltet seine eigenen, daher ungated.
|
||||
tabs.push({
|
||||
name: t("settings.security.title"),
|
||||
href: UrlUtils.currentTenantUrl(params, "settings/security"),
|
||||
icon: <ShieldCheckIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <ShieldCheckIcon className="size-4" aria-hidden="true" />,
|
||||
});
|
||||
if (getUserHasPermission(appOrAdminData, "app.settings.members.view")) {
|
||||
// AK-SET-01 Hub B: Mitglieder, Rollen und Gruppen sind Tabs INNERHALB von
|
||||
// "Team & Zugriff". Welche Tabs erscheinen, entscheidet der Hub-Loader.
|
||||
if (
|
||||
getUserHasPermission(appOrAdminData, "app.settings.members.view") ||
|
||||
getUserHasPermission(appOrAdminData, "app.settings.roles.view") ||
|
||||
getUserHasPermission(appOrAdminData, "app.settings.groups.full")
|
||||
) {
|
||||
tabs.push({
|
||||
name: t("settings.members.title"),
|
||||
href: UrlUtils.currentTenantUrl(params, "settings/members"),
|
||||
icon: <PeopleIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <PeopleIconFilled className="size-4" aria-hidden="true" />,
|
||||
name: t("settings.hubs.team.title"),
|
||||
href: UrlUtils.currentTenantUrl(
|
||||
params,
|
||||
getUserHasPermission(appOrAdminData, "app.settings.members.view")
|
||||
? "settings/team"
|
||||
: getUserHasPermission(appOrAdminData, "app.settings.roles.view")
|
||||
? "settings/team/roles"
|
||||
: "settings/team/groups"
|
||||
),
|
||||
icon: (
|
||||
<span data-ui-id={UI_NAV_IDS.appSettingsTeam}>
|
||||
<PeopleIcon className="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
iconSelected: (
|
||||
<span data-ui-id={UI_NAV_IDS.appSettingsTeam}>
|
||||
<PeopleIconFilled className="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
});
|
||||
}
|
||||
// Gruppen-Screen (Davids GroupsListView) erreichbar machen — nur bei aktivem row-groups-Flag + Permission,
|
||||
// damit kein toter Tab erscheint (analog zum Feature-Gate des Screens selbst).
|
||||
if (rootData.featureFlags?.includes("row-groups") && getUserHasPermission(appOrAdminData, "app.settings.groups.full")) {
|
||||
// AK-SET-01 Hub D: Abo, Nutzung und Rechnungen sind jetzt Tabs INNERHALB von
|
||||
// "Abrechnung" — hier steht nur noch der eine Hub-Eintrag. Sichtbar, sobald
|
||||
// eine der beiden Permissions reicht; welche Tabs erscheinen, entscheidet
|
||||
// der Hub-Loader.
|
||||
if (
|
||||
getUserHasPermission(appOrAdminData, "app.settings.subscription.view") ||
|
||||
getUserHasPermission(appOrAdminData, "app.settings.subscription.invoices.view")
|
||||
) {
|
||||
tabs.push({
|
||||
name: t("models.group.plural"),
|
||||
href: UrlUtils.currentTenantUrl(params, "settings/groups"),
|
||||
icon: <ModulesIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <ModulesIconFilled className="size-4" aria-hidden="true" />,
|
||||
name: t("settings.hubs.billing.title"),
|
||||
href: UrlUtils.currentTenantUrl(
|
||||
params,
|
||||
getUserHasPermission(appOrAdminData, "app.settings.subscription.view") ? "settings/billing" : "settings/billing/invoices"
|
||||
),
|
||||
icon: (
|
||||
<span data-ui-id={UI_NAV_IDS.appSettingsBilling}>
|
||||
<MembershipCardIcon className="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
iconSelected: (
|
||||
<span data-ui-id={UI_NAV_IDS.appSettingsBilling}>
|
||||
<MembershipCardIconFilled className="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
});
|
||||
}
|
||||
if (getUserHasPermission(appOrAdminData, "app.settings.subscription.view")) {
|
||||
// AK-SET-01 Hub C: Stammdaten, Richtlinien und Demo-Daten sind Tabs INNERHALB
|
||||
// von "Workspace" — hier steht nur noch der eine Hub-Eintrag. Welche Tabs
|
||||
// erscheinen, entscheidet der Hub-Loader.
|
||||
if (
|
||||
getUserHasPermission(appOrAdminData, "app.settings.account.view") ||
|
||||
(demoDataUiEnabled && getUserHasPermission(appOrAdminData, "app.onboarding.demoData.manage"))
|
||||
) {
|
||||
tabs.push({
|
||||
name: t("settings.subscription.title"),
|
||||
href: UrlUtils.currentTenantUrl(params, `settings/subscription`),
|
||||
icon: <MembershipCardIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <MembershipCardIconFilled className="size-4" aria-hidden="true" />,
|
||||
});
|
||||
tabs.push({
|
||||
name: t("billing:usage.title"),
|
||||
href: UrlUtils.currentTenantUrl(params, "settings/usage"),
|
||||
icon: <ActivityHistoryIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <ActivityHistoryIconFilled className="size-4" aria-hidden="true" />,
|
||||
name: t("settings.hubs.workspace.title"),
|
||||
href: UrlUtils.currentTenantUrl(
|
||||
params,
|
||||
getUserHasPermission(appOrAdminData, "app.settings.account.view") ? "settings/workspace" : "settings/workspace/demo-data"
|
||||
),
|
||||
icon: (
|
||||
<span data-ui-id={UI_NAV_IDS.appSettingsWorkspace}>
|
||||
<CompanyIcon className="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
iconSelected: (
|
||||
<span data-ui-id={UI_NAV_IDS.appSettingsWorkspace}>
|
||||
<CompanyIconFilled className="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
});
|
||||
}
|
||||
if (getUserHasPermission(appOrAdminData, "app.settings.account.view")) {
|
||||
if (getUserHasPermission(appOrAdminData, "portal.read") || getUserHasPermission(appOrAdminData, "portal.admin")) {
|
||||
tabs.push({
|
||||
name: t("settings.tenant.title"),
|
||||
href: UrlUtils.currentTenantUrl(params, "settings/account"),
|
||||
exact: true,
|
||||
icon: <CompanyIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <CompanyIconFilled className="size-4" aria-hidden="true" />,
|
||||
});
|
||||
tabs.push({
|
||||
name: t("settings.theme.title"),
|
||||
href: UrlUtils.currentTenantUrl(params, "settings/theme"),
|
||||
icon: <PaintbrushIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <PaintbrushIcon className="size-4" aria-hidden="true" />,
|
||||
name: t("customerPortal.admin.title"),
|
||||
href: UrlUtils.currentTenantUrl(
|
||||
params,
|
||||
getUserHasPermission(appOrAdminData, "portal.read") ? "settings/customer-portal" : "settings/customer-portal/email-templates"
|
||||
),
|
||||
icon: (
|
||||
<span data-ui-id={UI_NAV_IDS.appSettingsCustomerPortal}>
|
||||
<MailIcon className="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
iconSelected: (
|
||||
<span data-ui-id={UI_NAV_IDS.appSettingsCustomerPortal}>
|
||||
<MailIcon className="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
});
|
||||
}
|
||||
// if (rootData.appConfiguration.app.features.tenantTypes && getUserHasPermission(appOrAdminData, "app.settings.accounts.view")) {
|
||||
// tabs.push({
|
||||
// name: t("models.tenant.plural"),
|
||||
// href: UrlUtils.currentTenantUrl(params, "settings/accounts"),
|
||||
// icon: <LinkIcon className="size-4" aria-hidden="true" />,
|
||||
// iconSelected: <LinkIconFilled className="size-4" aria-hidden="true" />,
|
||||
// });
|
||||
// }
|
||||
// R-P2b (D-P2 S01/S02): Rollen sind ein Tab INNERHALB von Mitarbeiter — der separate
|
||||
// Icon-Tab bleibt nur als Fallback, wenn jemand Rollen sehen darf, aber nicht Mitglieder
|
||||
// (sonst wäre der Rollen-Screen unerreichbar, DoD B6).
|
||||
if (getUserHasPermission(appOrAdminData, "app.settings.roles.view") && !getUserHasPermission(appOrAdminData, "app.settings.members.view")) {
|
||||
// AK-SET-01 Hub E: Katalog, Postfächer, Kalender, Telefonie, Plugins und
|
||||
// API-Schlüssel sind Tabs INNERHALB von "Erweiterungen" — hier steht nur noch
|
||||
// der eine Hub-Eintrag. Welche Tabs erscheinen, entscheidet der Hub-Loader.
|
||||
const canOpenIntegrationCatalog = hasFeatureAccess("integrations") && getUserHasPermission(appOrAdminData, "integrations.read");
|
||||
const canOpenEmail =
|
||||
hasFeatureAccess("email-inbox") && (getUserHasPermission(appOrAdminData, "email.read_own") || getUserHasPermission(appOrAdminData, "email.read_all"));
|
||||
const canOpenCalendar =
|
||||
hasFeatureAccess("integrations") &&
|
||||
(getUserHasPermission(appOrAdminData, "calendar.connect_own") || getUserHasPermission(appOrAdminData, "calendar.admin"));
|
||||
const canOpenTelephony = hasFeatureAccess("telephony") && getUserHasPermission(appOrAdminData, "telephony.manage");
|
||||
const canOpenPlugins = getUserHasPermission(appOrAdminData, "app.plugins.use");
|
||||
const canOpenApi = hasFeatureAccess("api") && getUserHasPermission(appOrAdminData, "app.settings.apiKeys.view");
|
||||
const firstIntegrationPath = canOpenIntegrationCatalog
|
||||
? "settings/integrations"
|
||||
: canOpenEmail
|
||||
? "settings/integrations/email"
|
||||
: canOpenCalendar
|
||||
? "settings/integrations/calendar"
|
||||
: canOpenTelephony
|
||||
? "settings/integrations/telephony"
|
||||
: canOpenPlugins
|
||||
? "settings/integrations/plugins"
|
||||
: "settings/integrations/api";
|
||||
if (canOpenIntegrationCatalog || canOpenEmail || canOpenCalendar || canOpenTelephony || canOpenPlugins || canOpenApi) {
|
||||
tabs.push({
|
||||
name: t("models.role.plural"),
|
||||
href: UrlUtils.currentTenantUrl(params, "settings/roles-and-permissions"),
|
||||
icon: <ShieldCheckIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <ShieldCheckIcon className="size-4" aria-hidden="true" />,
|
||||
name: t("settings.hubs.integrations.title"),
|
||||
href: UrlUtils.currentTenantUrl(params, firstIntegrationPath),
|
||||
icon: (
|
||||
<span data-ui-id={UI_NAV_IDS.appSettingsIntegrations}>
|
||||
<PlugIcon className="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
iconSelected: (
|
||||
<span data-ui-id={UI_NAV_IDS.appSettingsIntegrations}>
|
||||
<PlugIcon className="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
});
|
||||
}
|
||||
tabs.push({
|
||||
name: t("settings.notifications.title"),
|
||||
href: UrlUtils.currentTenantUrl(params, "settings/notifications"),
|
||||
icon: <BellIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <BellIcon className="size-4" aria-hidden="true" />,
|
||||
});
|
||||
if (getUserHasPermission(appOrAdminData, "app.settings.account.view")) {
|
||||
// AK-SET-01 Hub F: Audit-Log, Audit-Export, Chat-Audit und die
|
||||
// Datenschutz-Verwaltung sind Tabs INNERHALB von "Compliance & Protokolle".
|
||||
const canOpenAudit = getUserHasPermission(appOrAdminData, "app.settings.auditTrails.view");
|
||||
const canOpenChatAudit = hasFeatureAccess("chat") && getUserHasPermission(appOrAdminData, "chat.read_all_channels");
|
||||
const canOpenTenantExport = getUserHasPermission(appOrAdminData, "privacy.tenant_export");
|
||||
const canOpenAvv = getUserHasPermission(appOrAdminData, "privacy.avv.read");
|
||||
const canOpenSubprocessors = getUserHasPermission(appOrAdminData, "privacy.subprocessors.read");
|
||||
const canOpenTenantDeletion = getUserHasPermission(appOrAdminData, "privacy.tenant_deletion");
|
||||
const firstCompliancePath = canOpenAudit
|
||||
? "settings/compliance"
|
||||
: canOpenChatAudit
|
||||
? "settings/compliance/chat"
|
||||
: canOpenTenantExport
|
||||
? "settings/compliance/data-export"
|
||||
: canOpenAvv
|
||||
? "settings/compliance/avv"
|
||||
: canOpenSubprocessors
|
||||
? "settings/compliance/subprocessors"
|
||||
: "settings/compliance/tenant-deletion";
|
||||
if (canOpenAudit || canOpenChatAudit || canOpenTenantExport || canOpenAvv || canOpenSubprocessors || canOpenTenantDeletion) {
|
||||
tabs.push({
|
||||
name: t("settings.policies.title"),
|
||||
href: UrlUtils.currentTenantUrl(params, "settings/policies"),
|
||||
icon: <FileTextIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <FileTextIcon className="size-4" aria-hidden="true" />,
|
||||
});
|
||||
}
|
||||
if (rootData.appConfiguration.app.features.tenantApiKeys && getUserHasPermission(appOrAdminData, "app.settings.apiKeys.view")) {
|
||||
tabs.push({
|
||||
name: t("settings.api.title"),
|
||||
href: UrlUtils.currentTenantUrl(params, "settings/api"),
|
||||
icon: <RestApiIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <RestApiIconFilled className="size-4" aria-hidden="true" />,
|
||||
});
|
||||
}
|
||||
if (getUserHasPermission(appOrAdminData, "app.settings.auditTrails.view")) {
|
||||
tabs.push({
|
||||
name: t("models.log.plural"),
|
||||
href: UrlUtils.currentTenantUrl(params, "settings/logs"),
|
||||
icon: <ActivityHistoryIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <ActivityHistoryIconFilled className="size-4" aria-hidden="true" />,
|
||||
});
|
||||
}
|
||||
if (getUserHasPermission(appOrAdminData, "app.plugins.use")) {
|
||||
tabs.push({
|
||||
name: t("settings.plugins.title"),
|
||||
href: UrlUtils.currentTenantUrl(params, "settings/plugins"),
|
||||
icon: <PlugIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <PlugIcon className="size-4" aria-hidden="true" />,
|
||||
});
|
||||
}
|
||||
if (rootData.appConfiguration.app.features.tenantEntityCustomization && getUserHasPermission(appOrAdminData, "app.settings.account.update")) {
|
||||
tabs.push({
|
||||
name: t("models.entity.plural"),
|
||||
href: UrlUtils.currentTenantUrl(params, "settings/entities"),
|
||||
icon: <ModulesIcon className="size-4" aria-hidden="true" />,
|
||||
iconSelected: <ModulesIconFilled className="size-4" aria-hidden="true" />,
|
||||
name: t("settings.hubs.compliance.title"),
|
||||
href: UrlUtils.currentTenantUrl(params, firstCompliancePath),
|
||||
icon: (
|
||||
<span data-ui-id={UI_NAV_IDS.appSettingsCompliance}>
|
||||
<ActivityHistoryIcon className="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
iconSelected: (
|
||||
<span data-ui-id={UI_NAV_IDS.appSettingsCompliance}>
|
||||
<ActivityHistoryIconFilled className="size-4" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
});
|
||||
}
|
||||
// setTabs(tabs);
|
||||
@@ -191,8 +255,15 @@ export default function SettingsRoute() {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [location.pathname]);
|
||||
|
||||
// The activation route is intentionally outside the regular settings rail.
|
||||
// The app loader also derives this flag from a persisted signup selection,
|
||||
// even when subscription enforcement is globally optional on staging.
|
||||
if (appData.subscriptionActivationRequired === true) {
|
||||
return <Outlet />;
|
||||
}
|
||||
|
||||
return (
|
||||
<SidebarIconsLayout label={{ align: "right" }} items={getTabs()}>
|
||||
<SidebarIconsLayout label={{ align: "right" }} items={getTabs()} sticky>
|
||||
<Outlet />
|
||||
</SidebarIconsLayout>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user