feat(docs, agents, risk): enhance documentation, API queries, and UI components
Updated the public documentation site with improved layout and accessibility, including new sections for client integration and admin guides. Enhanced API queries by adding 'active_only' and 'group_by' parameters for better data filtering in risk management. Refined UI components for agent management, ensuring consistent styling and improved user experience across the application. Added localization support for new documentation content in English and Nepali.
This commit is contained in:
@@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next";
|
||||
|
||||
type DocPageKey =
|
||||
| "overview"
|
||||
| "delivery"
|
||||
| "quickstart"
|
||||
| "fundamentals"
|
||||
| "setup"
|
||||
@@ -12,16 +13,32 @@ type DocPageKey =
|
||||
| "wallet"
|
||||
| "transfer"
|
||||
| "errors"
|
||||
| "troubleshooting"
|
||||
| "golive";
|
||||
|
||||
const INTEGRATION_DOCS_NS = "integrationDocs";
|
||||
|
||||
function asStringArray(value: unknown): string[] {
|
||||
return Array.isArray(value) ? value.filter((item): item is string => typeof item === "string") : [];
|
||||
}
|
||||
|
||||
function asStringMatrix(value: unknown): string[][] {
|
||||
return Array.isArray(value)
|
||||
? value.filter((row): row is string[] => Array.isArray(row) && row.every((cell) => typeof cell === "string"))
|
||||
: [];
|
||||
}
|
||||
|
||||
export function useIntegrationDoc(page: DocPageKey) {
|
||||
const { t } = useTranslation("integrationDocs");
|
||||
const { t } = useTranslation(INTEGRATION_DOCS_NS);
|
||||
|
||||
return {
|
||||
t,
|
||||
p: (key: string) => t(`pages.${page}.${key}`),
|
||||
rows: (key: string) => t(`pages.${page}.${key}`, { returnObjects: true }) as string[][],
|
||||
list: (key: string) => t(`pages.${page}.${key}`, { returnObjects: true }) as string[],
|
||||
header: (key: string) => t(`headers.${key}`, { returnObjects: true }) as string[],
|
||||
p: (key: string) => t(`pages.${page}.${key}`, { ns: INTEGRATION_DOCS_NS }),
|
||||
rows: (key: string) =>
|
||||
asStringMatrix(t(`pages.${page}.${key}`, { returnObjects: true, ns: INTEGRATION_DOCS_NS })),
|
||||
list: (key: string) =>
|
||||
asStringArray(t(`pages.${page}.${key}`, { returnObjects: true, ns: INTEGRATION_DOCS_NS })),
|
||||
header: (key: string) =>
|
||||
asStringArray(t(`headers.${key}`, { returnObjects: true, ns: INTEGRATION_DOCS_NS })),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user