import { Tag, Tooltip, Typography } from 'antd'; import { useTranslation } from 'react-i18next'; import { REMARK_VARIABLES, REMARK_VAR_GROUPS, wrapToken } from '@/lib/remark/remarkVariables'; interface RemarkVarPickerProps { /** Called with the bare token (e.g. "EMAIL") when a chip is clicked. */ onPick: (token: string) => void; } /** * RemarkVarPicker is the grouped, tooltipped chip list of {{VAR}} tokens used by * the global remark-template field. */ export default function RemarkVarPicker({ onPick }: RemarkVarPickerProps) { const { t } = useTranslation(); return (
{t('pages.hosts.remarkVars.intro')} {REMARK_VAR_GROUPS.map((group) => (
{t(`pages.hosts.remarkVars.groups.${group}`)}
{REMARK_VARIABLES.filter((v) => v.group === group).map((v) => ( onPick(v.token)} style={{ cursor: 'pointer', margin: 0, fontFamily: 'monospace' }} > {wrapToken(v.token)} ))}
))}
); }