- Added contextual help to various forms including companies, people, departments, sites, assignments, and access accounts. - Introduced EntityHelp component to provide descriptions, examples, and guidance for each entity type. - Updated forms to include help sections before submit buttons, enhancing user understanding of each field's purpose. - Implemented help translations in Spanish and English for consistency across the application. - Created a new ContextHelp component for displaying help information in a structured format. - Added automated tests to ensure help content is correctly rendered in both languages. - Documented the new contextual help feature in ayuda-contextual.md for user reference.
24 lines
800 B
TypeScript
24 lines
800 B
TypeScript
import { ContextHelp } from "@repo/shadcn-ui/components/context-help";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import type { HelpKind } from "./help-i18n";
|
|
|
|
export function EntityHelp({ kind, scope }: { kind: HelpKind; scope?: string }) {
|
|
const { t } = useTranslation("access");
|
|
const catalogue = ["system", "resource_type", "permission", "template"].includes(kind);
|
|
return (
|
|
<ContextHelp
|
|
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")}
|
|
/>
|
|
);
|
|
}
|