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
+5
-97
@@ -1,100 +1,8 @@
|
||||
import { LoaderFunctionArgs, MetaFunction, useLoaderData, useParams } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import { verifyUserHasPermission } from "~/utils/helpers/.server/PermissionsService";
|
||||
import { getTenantIdFromUrl } from "~/utils/services/.server/urlService";
|
||||
// AK-SET-01 — legacy `settings/policies` is now a tab of the Workspace hub.
|
||||
import { legacySettingsRedirectLoader } from "./legacy-redirects.server";
|
||||
|
||||
type PolicyLink = {
|
||||
labelKey: string;
|
||||
path: string;
|
||||
};
|
||||
export const loader = legacySettingsRedirectLoader("settings/workspace/policies");
|
||||
|
||||
type PolicySection = {
|
||||
id: string;
|
||||
links: PolicyLink[];
|
||||
};
|
||||
|
||||
type LoaderData = {
|
||||
title: string;
|
||||
workspaceSlug: string;
|
||||
};
|
||||
|
||||
const POLICY_SECTIONS: PolicySection[] = [
|
||||
{
|
||||
id: "membership",
|
||||
links: [{ labelKey: "settings.policies.sections.membership.links.members", path: "settings/members" }],
|
||||
},
|
||||
{
|
||||
id: "roles",
|
||||
links: [{ labelKey: "settings.policies.sections.roles.links.roles", path: "settings/roles-and-permissions" }],
|
||||
},
|
||||
{
|
||||
id: "billing",
|
||||
links: [{ labelKey: "settings.policies.sections.billing.links.billing", path: "settings/subscription" }],
|
||||
},
|
||||
{
|
||||
id: "notifications",
|
||||
links: [{ labelKey: "settings.policies.sections.notifications.links.notifications", path: "settings/notifications" }],
|
||||
},
|
||||
{
|
||||
id: "audit",
|
||||
links: [{ labelKey: "settings.policies.sections.audit.links.audit", path: "settings/logs" }],
|
||||
},
|
||||
{
|
||||
id: "api",
|
||||
links: [{ labelKey: "settings.policies.sections.api.links.api", path: "settings/api" }],
|
||||
},
|
||||
];
|
||||
|
||||
export const loader = async ({ request, params }: LoaderFunctionArgs) => {
|
||||
const tenantId = await getTenantIdFromUrl(params);
|
||||
await verifyUserHasPermission(request, "app.settings.account.view", tenantId);
|
||||
const { t } = await getTranslations(request);
|
||||
|
||||
const data: LoaderData = {
|
||||
title: `${t("settings.policies.title")} | ${process.env.APP_NAME}`,
|
||||
workspaceSlug: params.tenant ?? "",
|
||||
};
|
||||
return data;
|
||||
};
|
||||
|
||||
export const meta: MetaFunction<typeof loader> = ({ data }) => [{ title: data?.title }];
|
||||
|
||||
export default function WorkspacePoliciesRoute() {
|
||||
const data = useLoaderData<LoaderData>();
|
||||
const params = useParams();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<main data-ui-id="ui.settings.policies.page" className="mx-auto grid max-w-4xl gap-6 px-4 py-5 sm:px-8">
|
||||
<div className="space-y-2">
|
||||
<p className="text-sm font-medium text-primary">{t("settings.policies.eyebrow")}</p>
|
||||
<h1 className="text-2xl font-semibold text-foreground">{t("settings.policies.heading")}</h1>
|
||||
<p className="max-w-3xl text-sm text-muted-foreground">{t("settings.policies.description")}</p>
|
||||
</div>
|
||||
|
||||
<div className="rounded-lg border bg-card p-4 text-sm text-muted-foreground">
|
||||
<span className="font-medium text-foreground">{t("settings.policies.resolvedWorkspace")}</span> {data.workspaceSlug}
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{POLICY_SECTIONS.map((section) => (
|
||||
<section key={section.id} data-ui-id={`ui.settings.policies.section.${section.id}`} className="rounded-lg border bg-card p-5 shadow-sm">
|
||||
<div className="space-y-2">
|
||||
<h2 className="text-base font-semibold text-foreground">{t(`settings.policies.sections.${section.id}.heading`)}</h2>
|
||||
<p className="text-sm leading-6 text-muted-foreground">{t(`settings.policies.sections.${section.id}.body`)}</p>
|
||||
</div>
|
||||
<div className="mt-4 flex flex-wrap gap-2">
|
||||
{section.links.map((link) => (
|
||||
<a key={link.path} href={UrlUtils.currentTenantUrl(params, link.path)} className="text-sm font-medium text-primary underline-offset-2 hover:underline">
|
||||
{t(link.labelKey)}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
))}
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
export default function LegacyPoliciesRedirect() {
|
||||
return null;
|
||||
}
|
||||
Reference in new issue
Block a user