2026-10-09 16:00:41 +00:00
|
|
|
import { ContextHelp } from "@repo/rdx-ui/components/context-help";
|
2026-10-21 10:37:59 +00:00
|
|
|
import { FormHelp } from "@repo/rdx-ui/components/form-help";
|
2026-10-03 16:23:38 +00:00
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
|
|
2026-10-08 17:25:02 +00:00
|
|
|
import type { HelpKind } from "../../shared/i18n";
|
2026-10-03 16:23:38 +00:00
|
|
|
|
2026-10-21 10:37:59 +00:00
|
|
|
export function EntityHelp({
|
|
|
|
|
kind,
|
|
|
|
|
scope,
|
|
|
|
|
placement = "body",
|
|
|
|
|
}: {
|
|
|
|
|
kind: HelpKind;
|
|
|
|
|
scope?: string;
|
|
|
|
|
placement?: "body" | "footer";
|
|
|
|
|
}) {
|
2026-10-03 16:23:38 +00:00
|
|
|
const { t } = useTranslation("access");
|
|
|
|
|
const catalogue = ["system", "resource_type", "permission", "template"].includes(kind);
|
2026-10-10 10:01:58 +00:00
|
|
|
|
2026-10-21 10:37:59 +00:00
|
|
|
const Help = placement === "footer" ? FormHelp : ContextHelp;
|
|
|
|
|
|
2026-10-03 16:23:38 +00:00
|
|
|
return (
|
2026-10-21 10:37:59 +00:00
|
|
|
<Help
|
2026-10-03 16:23:38 +00:00
|
|
|
description={t(`helpContent.${kind}.description`)}
|
|
|
|
|
examples={t(`helpContent.${kind}.examples`)}
|
|
|
|
|
examplesLabel={t("helpExamples")}
|
|
|
|
|
guidance={t(`helpContent.${kind}.guidance`)}
|
|
|
|
|
scopeNote={
|
|
|
|
|
catalogue && scope
|
|
|
|
|
? t(scope === "global" ? "helpGlobalScope" : "helpCompanyScope")
|
|
|
|
|
: undefined
|
|
|
|
|
}
|
|
|
|
|
title={t("helpTitle")}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|