@prenta/admin 2.14.4 → 2.14.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/__tests__/views/form-entries.render.test.js +74 -1
- package/dist/__tests__/views/form-entries.render.test.js.map +1 -1
- package/dist/prenta-admin.css +1 -1
- package/dist/views/entries/EntriesInbox.js +46 -20
- package/dist/views/entries/EntriesInbox.js.map +1 -1
- package/package.json +6 -6
- package/src/__tests__/views/form-entries.render.test.tsx +84 -1
- package/src/styles/theme.css +48 -4
- package/src/views/entries/EntriesInbox.tsx +97 -68
|
@@ -1154,9 +1154,9 @@ function EntryRow({ entry, selected, checked, compact, showForm, team, onOpen, o
|
|
|
1154
1154
|
: 'border-l-transparent hover:bg-[var(--bg)]'}`, children: [_jsxs("div", { className: "flex flex-col items-center gap-1.5 pt-px", children: [_jsx("button", { type: "button", "aria-pressed": checked, "aria-label": `Select ${name}`, onClick: (event) => {
|
|
1155
1155
|
event.stopPropagation();
|
|
1156
1156
|
onCheck();
|
|
1157
|
-
}, className: `
|
|
1157
|
+
}, className: `inbox-row-checkbox ${checked
|
|
1158
1158
|
? 'border-acc bg-acc text-[var(--on-acc)]'
|
|
1159
|
-
: 'border-bdr bg-card text-transparent'}`, children: _jsx(Check, { size:
|
|
1159
|
+
: 'border-bdr bg-card text-transparent'}`, children: _jsx(Check, { size: 10, "aria-hidden": true }) }), compact ? null : (_jsxs("span", { className: "relative flex size-8 items-center justify-center rounded-full text-[12px] font-bold", style: { background: avatarColor(name), color: 'var(--on-avatar)' }, children: [initials(name), entry.unread ? (_jsx("span", { className: "bg-acc absolute -top-px -right-px size-[9px] rounded-full border-2 border-[var(--sb)]" })) : null] }))] }), _jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-baseline gap-2", children: [_jsx("div", { className: `text-txt min-w-0 flex-1 truncate text-[13px] ${entry.unread ? 'font-bold' : 'font-medium'}`, children: name }), _jsx("div", { className: "text-sub shrink-0 text-[11px] tabular-nums", children: relativeEntryTime(entry.submittedAt) })] }), _jsx("p", { className: `mt-0.5 text-[12.5px] leading-[1.45] ${entry.unread ? 'text-txt' : 'text-sub'} ${compact ? 'line-clamp-1' : 'line-clamp-2'}`, children: preview }), _jsxs("div", { className: "mt-[3px] flex items-center gap-1.5", children: [showForm && entry.formName ? (_jsx("span", { className: "rounded-[5px] px-[7px] py-0.5 text-[10px] font-semibold whitespace-nowrap", style: {
|
|
1160
1160
|
background: formBadgeStyle(entry.formSlug).bg,
|
|
1161
1161
|
color: formBadgeStyle(entry.formSlug).fg,
|
|
1162
1162
|
}, children: entry.formName })) : null, entry.spamStatus === 'spam' ? (_jsx("span", { className: "bg-err-l text-err rounded-[5px] px-[7px] py-0.5 text-[10px] font-semibold", children: entry.spamMeta?.by ? (SPAM_BY_LABELS[entry.spamMeta.by] ?? 'Spam') : 'Spam' })) : entry.spamStatus === 'suspected' ? (_jsx("span", { className: "bg-err-l text-err rounded-[5px] px-[7px] py-0.5 text-[10px] font-semibold", children: "Likely spam" })) : null, entry.deleted
|
|
@@ -1185,7 +1185,7 @@ function EntryDetail({ entry, list, narrow, team, currentUserId, currentUserName
|
|
|
1185
1185
|
const [fields, setFields] = useState([]);
|
|
1186
1186
|
const [otherCount, setOtherCount] = useState(entry.otherEntryCount ?? 0);
|
|
1187
1187
|
const [metaOpen, setMetaOpen] = useState(true);
|
|
1188
|
-
const [
|
|
1188
|
+
const [showAllFields, setShowAllFields] = useState(false);
|
|
1189
1189
|
const [noteText, setNoteText] = useState('');
|
|
1190
1190
|
const notes = entry.notes ?? [];
|
|
1191
1191
|
const index = list.findIndex((item) => item.id === entry.id);
|
|
@@ -1202,7 +1202,7 @@ function EntryDetail({ entry, list, narrow, team, currentUserId, currentUserName
|
|
|
1202
1202
|
const isFreeDomain = Boolean(emailDomain && FREE_EMAIL_DOMAINS.has(emailDomain));
|
|
1203
1203
|
const isDomainBlocked = Boolean(emailDomain && blocked.domains.some((d) => d.term === emailDomain));
|
|
1204
1204
|
useEffect(() => {
|
|
1205
|
-
|
|
1205
|
+
setShowAllFields(false);
|
|
1206
1206
|
setNoteText('');
|
|
1207
1207
|
setOtherCount(entry.otherEntryCount ?? 0);
|
|
1208
1208
|
let cancelled = false;
|
|
@@ -1250,8 +1250,38 @@ function EntryDetail({ entry, list, narrow, team, currentUserId, currentUserName
|
|
|
1250
1250
|
return present.find(({ key }) => displayValue(entry.data[key]).length > 70) ?? null;
|
|
1251
1251
|
}, [present, entry.data]);
|
|
1252
1252
|
const submissionRows = useMemo(() => present.filter(({ key }) => key !== msgEntry?.key), [present, msgEntry]);
|
|
1253
|
-
|
|
1254
|
-
|
|
1253
|
+
// Collapse only values actually represented by the contact header. Some
|
|
1254
|
+
// legacy submissions store a first name as senderName without the surname.
|
|
1255
|
+
const headerFieldKeys = new Set(['name', 'first_name', 'last_name', 'full_name'].filter((key) => {
|
|
1256
|
+
const value = displayValue(entry.data[key]).trim().toLocaleLowerCase();
|
|
1257
|
+
return value && ` ${name.toLocaleLowerCase()} `.includes(` ${value} `);
|
|
1258
|
+
}));
|
|
1259
|
+
if (email && displayValue(entry.data.email) === email)
|
|
1260
|
+
headerFieldKeys.add('email');
|
|
1261
|
+
if (phone && displayValue(entry.data.phone) === phone)
|
|
1262
|
+
headerFieldKeys.add('phone');
|
|
1263
|
+
if (website)
|
|
1264
|
+
headerFieldKeys.add('website');
|
|
1265
|
+
const hiddenHeaderRows = submissionRows.filter(({ key }) => headerFieldKeys.has(key));
|
|
1266
|
+
const emptyRows = submissionRows.filter(({ key }) => !displayValue(entry.data[key]));
|
|
1267
|
+
const visibleRows = showAllFields
|
|
1268
|
+
? submissionRows
|
|
1269
|
+
: submissionRows.filter(({ key }) => !headerFieldKeys.has(key) && Boolean(displayValue(entry.data[key])));
|
|
1270
|
+
const hiddenHeaderCount = hiddenHeaderRows.filter(({ key }) => displayValue(entry.data[key])).length;
|
|
1271
|
+
const hiddenFieldSummary = [
|
|
1272
|
+
hiddenHeaderCount ? `${hiddenHeaderCount} shown above` : '',
|
|
1273
|
+
emptyRows.length ? `${emptyRows.length} empty` : '',
|
|
1274
|
+
]
|
|
1275
|
+
.filter(Boolean)
|
|
1276
|
+
.join(', ');
|
|
1277
|
+
const messageTitle = msgEntry
|
|
1278
|
+
? {
|
|
1279
|
+
description: 'Project description',
|
|
1280
|
+
message: 'Message',
|
|
1281
|
+
goal: 'Primary goal',
|
|
1282
|
+
services: 'Services',
|
|
1283
|
+
}[msgEntry.key] || msgEntry.label
|
|
1284
|
+
: '';
|
|
1255
1285
|
const answeredCount = useMemo(() => present.filter(({ key }) => Boolean(displayValue(entry.data[key]))).length, [present, entry.data]);
|
|
1256
1286
|
const firstName = (typeof entry.data.first_name === 'string' && entry.data.first_name.trim()) ||
|
|
1257
1287
|
name.split(/\s+/)[0] ||
|
|
@@ -1301,7 +1331,7 @@ function EntryDetail({ entry, list, narrow, team, currentUserId, currentUserName
|
|
|
1301
1331
|
: 'Future entries from this domain go straight to Spam', className: `${toolbarBtn} disabled:cursor-not-allowed disabled:opacity-45`, onClick: () => onBlockDomain(emailDomain), children: [_jsx(ShieldX, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: isDomainBlocked ? 'Domain blocked' : `Block ${emailDomain}` })] })) : null, _jsx("button", { type: "button", className: toolbarBtn, title: "Block a word", onClick: () => onManageBlocklist('words'), children: _jsx("span", { className: "max-[640px]:sr-only", children: "Block a word\u2026" }) }), _jsxs("button", { type: "button", className: toolbarBtn, title: "Copy all", onClick: copyAll, children: [_jsx(Copy, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: "Copy all" })] }), _jsx("span", { className: "flex-1" }), _jsxs("button", { type: "button", title: "Delete forever", className: "text-sub hover:bg-err-l hover:text-err inline-flex items-center gap-[5px] rounded-[7px] px-[9px] py-1.5 text-[12.5px] font-medium whitespace-nowrap", onClick: () => onDelete(entry.id), children: [_jsx(Trash2, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: "Delete forever" })] })] })) : (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", className: toolbarBtn, title: entry.unread ? 'Mark read (U)' : 'Mark unread (U)', onClick: () => onPatch(entry.id, { unread: !entry.unread }, entry.unread ? 'Marked read' : 'Marked unread'), children: [entry.unread ? _jsx(Check, { size: 14, "aria-hidden": true }) : _jsx(Mail, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: entry.unread ? 'Mark read' : 'Mark unread' })] }), _jsxs("button", { type: "button", "aria-pressed": entry.starred, title: entry.starred ? 'Unstar (S)' : 'Star (S)', className: `${toolbarBtn} ${entry.starred ? 'text-warn' : ''}`, onClick: () => onPatch(entry.id, { starred: !entry.starred }), children: [_jsx(Star, { size: 14, "aria-hidden": true, className: entry.starred ? 'fill-current' : '' }), _jsx("span", { className: "max-[640px]:sr-only", children: entry.starred ? 'Starred' : 'Star' })] }), _jsxs("button", { type: "button", className: toolbarBtn, title: entry.archived ? 'Unarchive (E)' : 'Archive (E)', onClick: () => onPatch(entry.id, { archived: !entry.archived }, entry.archived ? 'Moved to inbox' : 'Archived', { archived: entry.archived }), children: [_jsx(Archive, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: entry.archived ? 'Unarchive' : 'Archive' })] }), _jsxs("button", { type: "button", className: toolbarBtn, title: "Copy all fields", onClick: copyAll, children: [_jsx(Copy, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: "Copy all" })] }), _jsx("span", { className: "flex-1" }), _jsxs("button", { type: "button", className: toolbarBtn, title: "Mark as spam", onClick: () => onPatch(entry.id, {
|
|
1302
1332
|
spamStatus: 'spam',
|
|
1303
1333
|
spamMeta: { by: 'manual', reason: 'Marked as spam by you.' },
|
|
1304
|
-
}, 'Moved to Spam', { spamStatus: entry.spamStatus, spamMeta: null }, true), children: [_jsx(ShieldX, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: "Spam" })] }), _jsxs("button", { type: "button", title: "Delete", className: "text-sub hover:bg-err-l hover:text-err inline-flex items-center gap-[5px] rounded-[7px] px-[9px] py-1.5 text-[12.5px] font-medium whitespace-nowrap", onClick: () => onDelete(entry.id), children: [_jsx(Trash2, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: "Delete" })] })] })), _jsx("span", { className: "bg-bdr mx-2 h-5 w-px shrink-0" }), _jsx("button", { type: "button", className: iconBtn, title: "Previous (K)", "aria-label": "Previous entry", disabled: index <= 0, onClick: () => index > 0 && list[index - 1] && onOpen(list[index - 1].id), children: _jsx(ChevronLeft, { size: 15, "aria-hidden": true }) }), index >= 0 ? (_jsxs("span", { "aria-live": "polite", className: "text-faint mx-1 text-[12px] whitespace-nowrap tabular-nums max-[640px]:sr-only", children: ["Entry ", index + 1, " of ", list.length] })) : null, _jsx("button", { type: "button", className: iconBtn, title: "Next (J)", "aria-label": "Next entry", disabled: index < 0 || index >= list.length - 1, onClick: () => list[index + 1] && onOpen(list[index + 1].id), children: _jsx(ChevronRight, { size: 15, "aria-hidden": true }) }), narrow ? null : (_jsx("button", { type: "button", className: iconBtn, title: "Close (Esc)", "aria-label": "Close entry", onClick: onClose, children: _jsx(X, { size: 15, "aria-hidden": true }) }))] }), _jsx("div", { className: "border-bdr bg-card border-b", children: _jsxs("div", { className: "mx-auto max-w-[860px] px-8 pt-7 pb-
|
|
1334
|
+
}, 'Moved to Spam', { spamStatus: entry.spamStatus, spamMeta: null }, true), children: [_jsx(ShieldX, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: "Spam" })] }), _jsxs("button", { type: "button", title: "Delete", className: "text-sub hover:bg-err-l hover:text-err inline-flex items-center gap-[5px] rounded-[7px] px-[9px] py-1.5 text-[12.5px] font-medium whitespace-nowrap", onClick: () => onDelete(entry.id), children: [_jsx(Trash2, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: "Delete" })] })] })), _jsx("span", { className: "bg-bdr mx-2 h-5 w-px shrink-0" }), _jsx("button", { type: "button", className: iconBtn, title: "Previous (K)", "aria-label": "Previous entry", disabled: index <= 0, onClick: () => index > 0 && list[index - 1] && onOpen(list[index - 1].id), children: _jsx(ChevronLeft, { size: 15, "aria-hidden": true }) }), index >= 0 ? (_jsxs("span", { "aria-live": "polite", className: "text-faint mx-1 text-[12px] whitespace-nowrap tabular-nums max-[640px]:sr-only", children: ["Entry ", index + 1, " of ", list.length] })) : null, _jsx("button", { type: "button", className: iconBtn, title: "Next (J)", "aria-label": "Next entry", disabled: index < 0 || index >= list.length - 1, onClick: () => list[index + 1] && onOpen(list[index + 1].id), children: _jsx(ChevronRight, { size: 15, "aria-hidden": true }) }), narrow ? null : (_jsx("button", { type: "button", className: iconBtn, title: "Close (Esc)", "aria-label": "Close entry", onClick: onClose, children: _jsx(X, { size: 15, "aria-hidden": true }) }))] }), _jsx("div", { className: "border-bdr bg-card border-b", children: _jsxs("div", { className: "mx-auto max-w-[860px] px-8 pt-7 pb-6 max-[900px]:px-4 max-[900px]:pt-5 max-[900px]:pb-6 @[1240px]:max-w-[1180px]", children: [_jsxs("div", { className: "flex items-start gap-4 max-[640px]:flex-wrap", children: [_jsx("span", { className: "flex size-[52px] shrink-0 items-center justify-center rounded-full text-[18px] font-bold", style: { background: avatarColor(name), color: 'var(--on-avatar)' }, children: initials(name) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("h2", { className: "text-txt m-0 text-[22px] leading-[1.2] font-bold tracking-[-0.4px] break-words", children: name }), _jsxs("div", { className: "text-faint mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1.5 text-[12.5px]", children: [_jsx("span", { className: "rounded-[5px] px-[7px] py-0.5 text-[10px] font-semibold whitespace-nowrap", style: { background: formColor.bg, color: formColor.fg }, children: formLabel }), entry.unread ? (_jsx("span", { className: "bg-acc-l text-acc rounded-[5px] px-2 py-[3px] text-[11px] font-semibold", children: "Unread" })) : null, entry.starred ? (_jsxs("span", { className: "bg-warn-l text-warn inline-flex items-center gap-1 rounded-[5px] px-2 py-[3px] text-[11px] font-semibold", children: [_jsx(Star, { size: 11, "aria-hidden": true, className: "fill-current" }), " Starred"] })) : null, entry.archived ? (_jsx("span", { className: "border-bdr bg-bg text-faint rounded-[5px] border px-2 py-[3px] text-[11px] font-semibold", children: "Archived" })) : null, _jsx("span", { children: fullEntryTime(entry.submittedAt) }), otherCount > 0 && email ? (_jsxs("button", { type: "button", onClick: () => onFindEmail(email), className: "text-acc decoration-acc-m hover:decoration-acc cursor-pointer border-0 bg-transparent p-0 text-[12.5px] font-semibold whitespace-nowrap underline underline-offset-2", children: [otherCount, " other ", otherCount === 1 ? 'entry' : 'entries', " from this person"] })) : null] }), _jsxs("div", { className: "text-sub mt-2 flex min-w-0 items-center gap-2 text-[12.5px]", children: [_jsx("span", { className: "inline-flex shrink-0 items-center rounded-[5px] px-2 py-[3px] text-[11px] font-semibold whitespace-nowrap", style: { color: attr.channelFg, background: attr.channelBg }, children: attr.channelLabel }), attr.channelKey !== 'direct' ? (_jsxs("span", { className: "min-w-0 truncate", children: [_jsx("b", { className: "text-txt font-semibold", children: attr.source }), " / ", attr.medium, attr.campaign ? ` · ${attr.campaign}` : ''] })) : null] }), email || phone || website ? (_jsxs("div", { className: "mt-3 flex flex-wrap gap-1.5", children: [email ? (_jsxs("a", { href: mailHref, title: "Email with their message quoted", className: "border-bdr bg-card text-txt hover:border-acc-m hover:bg-acc-l hover:text-acc inline-flex max-w-full items-center gap-1.5 truncate rounded-full border px-[11px] py-[5px] text-[12.5px] no-underline", children: [_jsx(Mail, { size: 13, "aria-hidden": true, className: "text-faint shrink-0" }), email] })) : null, phone ? (_jsxs("a", { href: `tel:${phone.replace(/[^\d+]/g, '')}`, className: "border-bdr bg-card text-txt hover:border-acc-m hover:bg-acc-l hover:text-acc inline-flex max-w-full items-center gap-1.5 truncate rounded-full border px-[11px] py-[5px] text-[12.5px] no-underline", children: [_jsx(Phone, { size: 13, "aria-hidden": true, className: "text-faint shrink-0" }), phone] })) : null, website ? (_jsxs("a", { href: website, target: "_blank", rel: "noopener noreferrer", className: "border-bdr bg-card text-txt hover:border-acc-m hover:bg-acc-l hover:text-acc inline-flex max-w-full items-center gap-1.5 truncate rounded-full border px-[11px] py-[5px] text-[12.5px] no-underline", children: [_jsx(Globe, { size: 13, "aria-hidden": true, className: "text-faint shrink-0" }), website.replace(/^https?:\/\//, '').replace(/\/$/, '')] })) : null] })) : null] }), entry.spamStatus !== 'spam' && !entry.partial && !entry.deleted ? (_jsxs("div", { className: "flex shrink-0 flex-col items-end gap-2 max-[640px]:w-full max-[640px]:flex-row max-[640px]:justify-start max-[640px]:pl-[68px]", children: [_jsxs("label", { className: "focus-within:outline-acc inline-flex cursor-pointer items-center gap-[7px] rounded-full border px-2.5 py-1 text-[12.5px] font-semibold focus-within:outline focus-within:outline-offset-2", style: {
|
|
1305
1335
|
color: pipe.fg,
|
|
1306
1336
|
background: pipe.bg,
|
|
1307
1337
|
borderColor: `color-mix(in srgb, ${pipe.fg} 30%, transparent)`,
|
|
@@ -1332,15 +1362,11 @@ function EntryDetail({ entry, list, narrow, team, currentUserId, currentUserName
|
|
|
1332
1362
|
: 'color-mix(in srgb, var(--warn) 20%, var(--card))',
|
|
1333
1363
|
} }, idx))) })] })] })) : null, entry.spamStatus === 'spam' ? (_jsxs("div", { role: "note", className: "bg-err-l text-err mb-3 flex items-start gap-2.5 rounded-[10px] border px-3.5 py-[11px] text-[12.5px] leading-[1.5]", style: { borderColor: 'color-mix(in srgb, var(--err) 25%, transparent)' }, children: [_jsx(ShieldX, { size: 16, "aria-hidden": true, className: "mt-px shrink-0" }), _jsxs("div", { children: [_jsxs("b", { className: "flex flex-wrap items-center gap-2 text-[13px]", children: ["Marked as spam \u00B7", ' ', entry.spamMeta?.by && entry.spamMeta.by !== 'manual'
|
|
1334
1364
|
? (SPAM_BY_LABELS[entry.spamMeta.by] ?? 'You')
|
|
1335
|
-
: 'You', entry.spamMeta?.score ? (_jsxs("span", { className: "bg-card text-err rounded-full border px-[7px] text-[11px] font-semibold whitespace-nowrap", style: { borderColor: 'color-mix(in srgb, var(--err) 25%, transparent)' }, children: [entry.spamMeta.score, "% confidence"] })) : null] }), _jsx("span", { className: "text-txt block", children: `${entry.spamMeta?.reason ?? 'Marked as spam by you.'} No notification email was sent.` })] })] })) : null, msgEntry ? (_jsxs("
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
? emptyRows.map(({ key, label }) => (_jsxs("div", { className: "grid grid-cols-[minmax(110px,32%)_minmax(0,1fr)] items-baseline gap-x-4 gap-y-1 px-5 py-[11px] max-[520px]:grid-cols-1", children: [_jsx("dt", { className: "text-sub text-[12.5px] leading-[1.5] font-medium", children: label }), _jsx("dd", { className: "text-faint m-0 text-[14px] leading-[1.55]", children: "Not answered" })] }, key)))
|
|
1341
|
-
: null] }), emptyRows.length > 0 ? (_jsx("button", { type: "button", "aria-expanded": showEmpty, onClick: () => setShowEmpty((v) => !v), className: "border-bdr text-acc hover:bg-acc-l block w-full cursor-pointer border-0 border-t bg-transparent px-5 py-2.5 text-left text-[12.5px] font-medium", children: showEmpty
|
|
1342
|
-
? 'Hide empty fields'
|
|
1343
|
-
: `Show ${emptyRows.length} empty ${emptyRows.length === 1 ? 'field' : 'fields'}` })) : null] }), entry.spamStatus !== 'spam' && !entry.partial ? (_jsxs("article", { className: "border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:col-start-1", children: [_jsxs("h3", { className: "border-bdr text-faint m-0 flex items-center gap-2 border-b px-5 py-3 text-[11px] font-bold tracking-[0.6px] uppercase", children: ["Team notes", _jsxs("span", { className: "ml-auto text-[11.5px] font-semibold tracking-normal normal-case", children: [notes.length, " ", notes.length === 1 ? 'note' : 'notes'] })] }), _jsxs("div", { className: "flex flex-col gap-3.5 px-5 pt-3.5 pb-4", children: [notes.map((n, idx) => {
|
|
1365
|
+
: 'You', entry.spamMeta?.score ? (_jsxs("span", { className: "bg-card text-err rounded-full border px-[7px] text-[11px] font-semibold whitespace-nowrap", style: { borderColor: 'color-mix(in srgb, var(--err) 25%, transparent)' }, children: [entry.spamMeta.score, "% confidence"] })) : null] }), _jsx("span", { className: "text-txt block", children: `${entry.spamMeta?.reason ?? 'Marked as spam by you.'} No notification email was sent.` })] })] })) : null] }) }), _jsxs("div", { className: "mx-auto max-w-[860px] px-8 pt-[22px] pb-12 max-[900px]:px-4 max-[900px]:pt-4 max-[900px]:pb-10 @[1240px]:grid @[1240px]:max-w-[1180px] @[1240px]:grid-cols-[minmax(0,1fr)_400px] @[1240px]:items-start @[1240px]:gap-x-5", children: [msgEntry ? (_jsxs("article", { className: "group border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:col-start-1", "aria-labelledby": "d-msg-l", children: [_jsxs("h3", { id: "d-msg-l", className: "border-bdr text-txt m-0 flex items-center gap-2 border-b px-5 py-3 text-[13px] font-semibold", children: [messageTitle, _jsx("button", { type: "button", title: `Copy ${messageTitle}`, "aria-label": `Copy ${messageTitle}`, onClick: () => copyValue(msgText), className: "text-faint hover:bg-acc-l hover:text-acc ml-auto inline-flex size-6 items-center justify-center rounded-[6px] opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100", children: _jsx(Copy, { size: 13, "aria-hidden": true }) })] }), _jsx("div", { dir: "auto", className: "text-txt px-5 pt-4 pb-5 text-[15px] leading-[1.7] [text-wrap:pretty] break-words whitespace-pre-wrap", children: formatFieldDisplay(msgEntry.key, msgText, fieldMap.get(msgEntry.key)) })] })) : null, _jsxs("article", { className: "border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:col-start-1", children: [_jsxs("h3", { className: "border-bdr text-faint m-0 flex items-center gap-2 border-b px-5 py-3 text-[11px] font-bold tracking-[0.6px] uppercase", children: ["Submission", _jsxs("span", { className: "ml-auto text-[11.5px] font-semibold tracking-normal normal-case", children: [answeredCount, " of ", present.length, " answered"] })] }), _jsx("dl", { className: "divide-bdr m-0 divide-y", children: visibleRows.map(({ key, label }) => {
|
|
1366
|
+
const raw = displayValue(entry.data[key]);
|
|
1367
|
+
const formatted = formatFieldDisplay(key, raw, fieldMap.get(key));
|
|
1368
|
+
return (_jsx(DetailRow, { label: label, copyText: formatted || undefined, onCopy: copyValue, children: formatted || _jsx("span", { className: "text-faint", children: "Not answered" }) }, key));
|
|
1369
|
+
}) }), hiddenFieldSummary ? (_jsx("button", { type: "button", "aria-expanded": showAllFields, onClick: () => setShowAllFields((v) => !v), className: "border-bdr text-acc hover:bg-acc-l block w-full cursor-pointer border-0 border-t bg-transparent px-5 py-2.5 text-left text-[12.5px] font-medium", children: showAllFields ? 'Show fewer fields' : `Show all fields (${hiddenFieldSummary})` })) : null] }), entry.spamStatus !== 'spam' && !entry.partial ? (_jsxs("article", { className: "border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:col-start-1", children: [_jsxs("h3", { className: "border-bdr text-faint m-0 flex items-center gap-2 border-b px-5 py-3 text-[11px] font-bold tracking-[0.6px] uppercase", children: ["Team notes", _jsxs("span", { className: "ml-auto text-[11.5px] font-semibold tracking-normal normal-case", children: [notes.length, " ", notes.length === 1 ? 'note' : 'notes'] })] }), _jsxs("div", { className: "flex flex-col gap-3.5 px-5 pt-3.5 pb-4", children: [notes.map((n, idx) => {
|
|
1344
1370
|
const author = team.find((t) => t.id === n.authorId)?.name ||
|
|
1345
1371
|
n.authorName ||
|
|
1346
1372
|
n.authorId ||
|
|
@@ -1351,16 +1377,16 @@ function EntryDetail({ entry, list, narrow, team, currentUserId, currentUserName
|
|
|
1351
1377
|
e.preventDefault();
|
|
1352
1378
|
addNote();
|
|
1353
1379
|
}
|
|
1354
|
-
}, className: "border-bdr bg-card text-txt focus-visible:outline-acc min-h-[58px] w-full resize-y rounded-[9px] border px-2.5 py-2 text-[13px] leading-[1.45] focus-visible:outline focus-visible:outline-offset-2" }), _jsxs("div", { className: "text-faint mt-1.5 flex items-center gap-2.5 text-[11.5px]", children: [_jsx("span", { className: "flex-1", children: "\u2318 Enter to save \u00B7 only visible to your team" }), _jsx("button", { type: "button", disabled: !noteText.trim(), onClick: addNote, className: "bg-acc inline-flex items-center gap-1.5 rounded-[8px] px-[15px] py-2 text-[13px] font-medium text-[var(--on-acc)] disabled:cursor-not-allowed disabled:opacity-45", children: "Add note" })] })] })] })] })] })) : null, _jsxs("article", { className: "border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:sticky @[1240px]:top-[68px] @[1240px]:col-start-2 @[1240px]:row-span-
|
|
1380
|
+
}, className: "border-bdr bg-card text-txt focus-visible:outline-acc min-h-[58px] w-full resize-y rounded-[9px] border px-2.5 py-2 text-[13px] leading-[1.45] focus-visible:outline focus-visible:outline-offset-2" }), _jsxs("div", { className: "text-faint mt-1.5 flex items-center gap-2.5 text-[11.5px]", children: [_jsx("span", { className: "flex-1", children: "\u2318 Enter to save \u00B7 only visible to your team" }), _jsx("button", { type: "button", disabled: !noteText.trim(), onClick: addNote, className: "bg-acc inline-flex items-center gap-1.5 rounded-[8px] px-[15px] py-2 text-[13px] font-medium text-[var(--on-acc)] disabled:cursor-not-allowed disabled:opacity-45", children: "Add note" })] })] })] })] })] })) : null, _jsxs("article", { className: "border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:sticky @[1240px]:top-[68px] @[1240px]:col-start-2 @[1240px]:row-span-3 @[1240px]:row-start-1", children: [_jsx("h3", { className: "m-0", children: _jsxs("button", { type: "button", "aria-expanded": metaOpen, "aria-controls": "d-attr", onClick: () => setMetaOpen((open) => !open), className: `border-bdr text-faint hover:text-acc flex w-full cursor-pointer items-center gap-2 bg-transparent px-5 py-3 text-left text-[11px] font-bold tracking-[0.6px] uppercase ${metaOpen ? 'border-b' : ''}`, children: ["Attribution & technical", _jsxs("span", { className: "ml-auto inline-flex items-center gap-1.5 text-[11.5px] font-semibold tracking-normal normal-case", children: [attr.spamScore >= 80 ? (_jsxs("span", { className: "bg-err-l text-err rounded-[5px] px-[7px] py-0.5 text-[10px] font-semibold", children: ["Spam ", attr.spamScore] })) : (_jsxs("span", { className: "text-faint", children: ["Spam score ", attr.spamScore] })), _jsx(ChevronDown, { size: 14, "aria-hidden": true, className: `transition-transform ${metaOpen ? 'rotate-180' : ''}` })] })] }) }), metaOpen ? (_jsxs("dl", { id: "d-attr", className: "divide-bdr m-0 divide-y", children: [_jsx(DetailRow, { label: "Channel", compact: true, children: _jsx("span", { className: "inline-flex items-center rounded-[5px] border px-2 py-[3px] text-[11px] font-semibold", style: {
|
|
1355
1381
|
color: attr.channelFg,
|
|
1356
1382
|
background: attr.channelBg,
|
|
1357
1383
|
borderColor: `color-mix(in srgb, ${attr.channelFg} 22%, transparent)`,
|
|
1358
|
-
}, children: attr.channelLabel }) }), _jsx(DetailRow, { label: "Source / Medium", compact: true, copyText: `${attr.source} / ${attr.medium}`, onCopy: copyValue, children: _jsxs("b", { className: "text-txt font-semibold", children: [attr.source, " ", _jsx("span", { className: "text-faint font-normal", children: "/" }), " ", attr.medium] }) }), attr.campaign ? (_jsx(DetailRow, { label: "Campaign", compact: true, copyText: attr.campaign, onCopy: copyValue, children: attr.campaign })) : null, attr.term ? (_jsx(DetailRow, { label: "Keyword", compact: true, copyText: attr.term, onCopy: copyValue, children: attr.term })) : null, _jsx(ClickIdRow, { ids: attr.clickIds, onCopy: copyValue }), _jsx(DetailRow, { label: "Landing page", compact: true, copyText: attr.landingPage !== '—' ? attr.landingPage : undefined, onCopy: copyValue, children: attr.landingPage !== '—' ? (_jsx("a", { href: attr.landingPage, target: "_blank", rel: "noopener noreferrer", className: "text-acc hover:underline", children: attr.landingPage })) : ('—') }), _jsx(DetailRow, { label: "Referrer", compact: true, copyText: attr.referrer, onCopy: copyValue, children: attr.referrer }), _jsx(DetailRow, { label: "Device", compact: true, copyText: attr.device, onCopy: copyValue, clamp: true, children: attr.device }), _jsx(DetailRow, { label: "IP address", compact: true, mono: true, copyText: attr.ip !== '—' ? attr.ip : undefined, onCopy: copyValue, children: attr.ip }), _jsx(DetailRow, { label: "Submitted", compact: true, copyText: fullEntryTime(entry.submittedAt), onCopy: copyValue, children: fullEntryTime(entry.submittedAt) }), _jsx(DetailRow, { label: "Form", compact: true, copyText: formLabel, onCopy: copyValue, children: formLabel }), _jsx(DetailRow, { label: "Entry ID", compact: true, mono: true, copyText: entryIdLabel(entry), onCopy: copyValue, children: entryIdLabel(entry) })] })) : null] })] })] }));
|
|
1384
|
+
}, children: attr.channelLabel }) }), _jsx(DetailRow, { label: "Source / Medium", compact: true, copyText: `${attr.source} / ${attr.medium}`, onCopy: copyValue, children: _jsxs("b", { className: "text-txt font-semibold", children: [attr.source, " ", _jsx("span", { className: "text-faint font-normal", children: "/" }), " ", attr.medium] }) }), attr.campaign ? (_jsx(DetailRow, { label: "Campaign", compact: true, copyText: attr.campaign, onCopy: copyValue, children: attr.campaign })) : null, attr.term ? (_jsx(DetailRow, { label: "Keyword", compact: true, copyText: attr.term, onCopy: copyValue, children: attr.term })) : null, _jsx(ClickIdRow, { ids: attr.clickIds, onCopy: copyValue }), _jsx(DetailRow, { label: "Landing page", compact: true, copyText: attr.landingPage !== '—' ? attr.landingPage : undefined, onCopy: copyValue, children: attr.landingPage !== '—' ? (_jsx("a", { href: attr.landingPage, target: "_blank", rel: "noopener noreferrer", title: attr.landingPage, className: "text-acc block truncate hover:underline", children: attr.landingPage.replace(/^https?:\/\/(?:www\.)?/, '') })) : ('—') }), _jsx(DetailRow, { label: "Referrer", compact: true, copyText: attr.referrer, onCopy: copyValue, children: attr.referrer }), _jsx(DetailRow, { label: "Device", compact: true, copyText: attr.device, onCopy: copyValue, clamp: true, children: attr.device }), _jsx(DetailRow, { label: "IP address", compact: true, mono: true, copyText: attr.ip !== '—' ? attr.ip : undefined, onCopy: copyValue, children: attr.ip }), _jsx(DetailRow, { label: "Submitted", compact: true, copyText: fullEntryTime(entry.submittedAt), onCopy: copyValue, children: fullEntryTime(entry.submittedAt) }), _jsx(DetailRow, { label: "Form", compact: true, copyText: formLabel, onCopy: copyValue, children: formLabel }), _jsx(DetailRow, { label: "Entry ID", compact: true, mono: true, copyText: entryIdLabel(entry), onCopy: copyValue, children: entryIdLabel(entry) })] })) : null] })] })] }));
|
|
1359
1385
|
}
|
|
1360
1386
|
function DetailRow({ label, children, copyText, onCopy, compact, mono, clamp, }) {
|
|
1361
|
-
return (_jsxs("div", { className: `group grid items-baseline gap-x-4 gap-y-1 px-5 hover:bg-[color-mix(in_srgb,var(--bg)_60%,transparent)] max-[520px]:grid-cols-1 ${compact
|
|
1387
|
+
return (_jsxs("div", { className: `group grid items-baseline gap-x-4 gap-y-1 px-5 hover:bg-[color-mix(in_srgb,var(--bg)_60%,transparent)] @max-[520px]:grid-cols-1 ${compact
|
|
1362
1388
|
? 'grid-cols-[minmax(110px,32%)_minmax(0,1fr)] py-[9px] @[1240px]:grid-cols-[118px_minmax(0,1fr)]'
|
|
1363
|
-
: 'grid-cols-[minmax(110px,
|
|
1389
|
+
: 'grid-cols-[minmax(110px,170px)_minmax(0,1fr)] py-2'}`, children: [_jsx("dt", { className: "text-sub text-[12.5px] leading-[1.5] font-medium", children: label }), _jsxs("dd", { className: `m-0 flex min-w-0 items-start gap-2 leading-[1.55] ${compact ? 'text-sub text-[13px]' : 'text-txt text-[14px]'}`, children: [_jsx("span", { dir: "auto", className: `min-w-0 flex-1 break-words ${clamp ? 'line-clamp-2 whitespace-normal' : 'whitespace-pre-wrap'} ${mono ? 'font-mono text-[12px]' : ''}`, children: children }), copyText && onCopy ? (_jsx("button", { type: "button", title: `Copy ${label}`, "aria-label": `Copy ${label}`, onClick: () => onCopy(copyText), className: "text-faint hover:bg-acc-l hover:text-acc -my-0.5 inline-flex size-6 shrink-0 items-center justify-center rounded-[6px] opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100", children: _jsx(Copy, { size: 13, "aria-hidden": true }) })) : null] })] }));
|
|
1364
1390
|
}
|
|
1365
1391
|
function ClickIdRow({ ids, onCopy, }) {
|
|
1366
1392
|
const label = ids.length > 1 ? 'Click IDs' : 'Click ID';
|