diff --git a/client/src/components/Admin/mailIngest/MailIngestAdminCard.tsx b/client/src/components/Admin/mailIngest/MailIngestAdminCard.tsx
index f28c50dab..7fdfe74de 100644
--- a/client/src/components/Admin/mailIngest/MailIngestAdminCard.tsx
+++ b/client/src/components/Admin/mailIngest/MailIngestAdminCard.tsx
@@ -1,4 +1,4 @@
-import { CheckCircle, Copy, Loader2, Mail, PlugZap, Save, XCircle } from 'lucide-react';
+import { CheckCircle, Copy, Inbox, Loader2, Mail, PlugZap, Save, Upload, Webhook, XCircle } from 'lucide-react';
import type { ReactNode } from 'react';
import { useTranslation } from '../../../i18n';
import type { TranslationFn } from '../../../types';
@@ -21,6 +21,7 @@ import {
TRANSPORTS,
problemText,
statusFacts,
+ transportInfo,
transportLabel,
type MailAdminForm,
type MailAdminProblem,
@@ -204,6 +205,24 @@ function TestResult({ admin, t }: { admin: MailIngestAdmin; t: T }) {
);
}
+const TRANSPORT_ICON = { off: Upload, imap: Inbox, webhook: Webhook } as const;
+
+/** What the chosen way of taking mail in means, as a calm blue note under the choice. */
+function TransportInfo({ transport, t }: { transport: MailAdminForm['transport']; t: T }) {
+ const Icon = TRANSPORT_ICON[transport];
+ return (
+
+
+
+
+
+
{transportLabel(transport, t)}
+
{transportInfo(transport, t)}
+
+
+ );
+}
+
/** Everything under the switch: how mail arrives, its fields, then save, test and the status. */
function Setup({ admin, form, t, locale }: { admin: MailIngestAdmin; form: MailAdminForm; t: T; locale: string }) {
const error = (problem: MailAdminProblem) => (admin.problems.includes(problem) ? problemText(problem, t) : undefined);
@@ -232,6 +251,7 @@ function Setup({ admin, form, t, locale }: { admin: MailIngestAdmin; form: MailA
/>
+
{
expect(problemText('templateToken', t)).toContain('"token":"{token}"');
expect(problemText('secretShort', t)).toBe('mailAdmin.problem.secretShort');
});
+
+ it('FE-ADMIN-MAILINGEST-007: every way of taking mail in explains itself', () => {
+ expect(TRANSPORTS.map((x) => transportInfo(x, t))).toEqual([
+ 'mailAdmin.transport.offInfo',
+ 'mailAdmin.transport.imapInfo',
+ 'mailAdmin.transport.webhookInfo',
+ ]);
+ });
});
diff --git a/client/src/components/Admin/mailIngest/mailIngestAdminModel.ts b/client/src/components/Admin/mailIngest/mailIngestAdminModel.ts
index e661953d2..8618464a7 100644
--- a/client/src/components/Admin/mailIngest/mailIngestAdminModel.ts
+++ b/client/src/components/Admin/mailIngest/mailIngestAdminModel.ts
@@ -155,3 +155,15 @@ export function transportLabel(transport: MailAdminTransport, t: TranslationFn):
return t('mailAdmin.transport.webhook');
}
}
+
+/** What each way of taking mail in means, in a sentence or two, shown under the choice. */
+export function transportInfo(transport: MailAdminTransport, t: TranslationFn): string {
+ switch (transport) {
+ case 'off':
+ return t('mailAdmin.transport.offInfo');
+ case 'imap':
+ return t('mailAdmin.transport.imapInfo');
+ case 'webhook':
+ return t('mailAdmin.transport.webhookInfo');
+ }
+}
diff --git a/client/src/mobile/screens/admin/MMailIngestAdminCard.tsx b/client/src/mobile/screens/admin/MMailIngestAdminCard.tsx
index 6a7ff7c25..5a2446b30 100644
--- a/client/src/mobile/screens/admin/MMailIngestAdminCard.tsx
+++ b/client/src/mobile/screens/admin/MMailIngestAdminCard.tsx
@@ -1,7 +1,9 @@
+import { Inbox, Upload, Webhook } from 'lucide-react';
import {
TRANSPORTS,
problemText,
statusFacts,
+ transportInfo,
transportLabel,
type MailAdminForm,
type MailAdminProblem,
@@ -28,6 +30,12 @@ interface PartProps {
t: TranslationFn;
}
+/** The symbol of each way of taking mail in, as on the desktop card. */
+function TransportIcon({ transport }: { transport: MailAdminForm['transport'] }) {
+ const Icon = transport === 'imap' ? Inbox : transport === 'webhook' ? Webhook : Upload;
+ return ;
+}
+
/** The problem under a field, in the danger colour, or nothing. */
function Problem({ admin, problem, t }: { admin: MailIngestAdmin; problem: MailAdminProblem; t: TranslationFn }) {
if (!admin.problems.includes(problem)) return null;
@@ -141,6 +149,15 @@ function Setup({ admin, form, t, locale }: PartProps & { locale: string }) {
onChange={(value) => admin.set('transport', value)}
options={TRANSPORTS.map((x) => ({ value: x, label: transportLabel(x, t) }))}
/>
+
+
+
+
+
+
{transportLabel(form.transport, t)}
+
{transportInfo(form.transport, t)}
+
+