@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
package/src/styles/theme.css
CHANGED
|
@@ -488,21 +488,21 @@
|
|
|
488
488
|
color: var(--acc);
|
|
489
489
|
}
|
|
490
490
|
|
|
491
|
-
/*
|
|
491
|
+
/* Entries handoff: compact desktop controls, larger touch targets. */
|
|
492
492
|
.prenta-admin.prenta-admin :is(button, select).inbox-header-control {
|
|
493
493
|
box-sizing: border-box;
|
|
494
494
|
display: inline-flex;
|
|
495
495
|
align-items: center;
|
|
496
496
|
gap: 6px;
|
|
497
|
-
height:
|
|
498
|
-
min-height:
|
|
497
|
+
height: 28px;
|
|
498
|
+
min-height: 28px;
|
|
499
499
|
margin: 0;
|
|
500
500
|
padding: 0 10px;
|
|
501
501
|
border: 1px solid var(--bdr);
|
|
502
502
|
border-radius: 8px;
|
|
503
503
|
background: var(--card);
|
|
504
504
|
color: var(--txt);
|
|
505
|
-
font-size:
|
|
505
|
+
font-size: 12.5px;
|
|
506
506
|
font-weight: 500;
|
|
507
507
|
line-height: 1;
|
|
508
508
|
}
|
|
@@ -515,6 +515,50 @@
|
|
|
515
515
|
opacity: 0.6;
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
+
.prenta-admin.prenta-admin select.inbox-header-control {
|
|
519
|
+
padding-inline: 6px;
|
|
520
|
+
}
|
|
521
|
+
.prenta-admin .inbox-row-checkbox {
|
|
522
|
+
position: relative;
|
|
523
|
+
box-sizing: border-box;
|
|
524
|
+
display: flex;
|
|
525
|
+
align-items: center;
|
|
526
|
+
justify-content: center;
|
|
527
|
+
flex-shrink: 0;
|
|
528
|
+
width: 15px;
|
|
529
|
+
height: 15px;
|
|
530
|
+
min-width: 0;
|
|
531
|
+
min-height: 0;
|
|
532
|
+
margin: 0;
|
|
533
|
+
padding: 0;
|
|
534
|
+
border-width: 1.5px;
|
|
535
|
+
border-style: solid;
|
|
536
|
+
border-radius: 4px;
|
|
537
|
+
cursor: pointer;
|
|
538
|
+
}
|
|
539
|
+
.prenta-admin .inbox-row-checkbox::before {
|
|
540
|
+
content: '';
|
|
541
|
+
position: absolute;
|
|
542
|
+
width: 25px;
|
|
543
|
+
height: 25px;
|
|
544
|
+
left: 50%;
|
|
545
|
+
top: 50%;
|
|
546
|
+
transform: translate(-50%, -50%);
|
|
547
|
+
}
|
|
548
|
+
.prenta-admin .inbox-row-checkbox:hover {
|
|
549
|
+
border-color: var(--acc-m);
|
|
550
|
+
}
|
|
551
|
+
.prenta-admin .inbox-row-checkbox:focus-visible {
|
|
552
|
+
outline: 2px solid var(--acc);
|
|
553
|
+
outline-offset: 2px;
|
|
554
|
+
}
|
|
555
|
+
@media (max-width: 1024px) {
|
|
556
|
+
.prenta-admin.prenta-admin :is(button, select).inbox-header-control {
|
|
557
|
+
height: 40px;
|
|
558
|
+
min-height: 40px;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
518
562
|
.prenta-admin .prenta-section-label {
|
|
519
563
|
font-size: var(--fs-label);
|
|
520
564
|
font-weight: 600;
|
|
@@ -1905,13 +1905,13 @@ function EntryRow({
|
|
|
1905
1905
|
event.stopPropagation()
|
|
1906
1906
|
onCheck()
|
|
1907
1907
|
}}
|
|
1908
|
-
className={`
|
|
1908
|
+
className={`inbox-row-checkbox ${
|
|
1909
1909
|
checked
|
|
1910
1910
|
? 'border-acc bg-acc text-[var(--on-acc)]'
|
|
1911
1911
|
: 'border-bdr bg-card text-transparent'
|
|
1912
1912
|
}`}
|
|
1913
1913
|
>
|
|
1914
|
-
<Check size={
|
|
1914
|
+
<Check size={10} aria-hidden />
|
|
1915
1915
|
</button>
|
|
1916
1916
|
{compact ? null : (
|
|
1917
1917
|
<span
|
|
@@ -2087,7 +2087,7 @@ function EntryDetail({
|
|
|
2087
2087
|
const [fields, setFields] = useState<FormField[]>([])
|
|
2088
2088
|
const [otherCount, setOtherCount] = useState<number>(entry.otherEntryCount ?? 0)
|
|
2089
2089
|
const [metaOpen, setMetaOpen] = useState(true)
|
|
2090
|
-
const [
|
|
2090
|
+
const [showAllFields, setShowAllFields] = useState(false)
|
|
2091
2091
|
const [noteText, setNoteText] = useState('')
|
|
2092
2092
|
const notes = entry.notes ?? []
|
|
2093
2093
|
const index = list.findIndex((item) => item.id === entry.id)
|
|
@@ -2107,7 +2107,7 @@ function EntryDetail({
|
|
|
2107
2107
|
)
|
|
2108
2108
|
|
|
2109
2109
|
useEffect(() => {
|
|
2110
|
-
|
|
2110
|
+
setShowAllFields(false)
|
|
2111
2111
|
setNoteText('')
|
|
2112
2112
|
setOtherCount(entry.otherEntryCount ?? 0)
|
|
2113
2113
|
let cancelled = false
|
|
@@ -2163,14 +2163,44 @@ function EntryDetail({
|
|
|
2163
2163
|
() => present.filter(({ key }) => key !== msgEntry?.key),
|
|
2164
2164
|
[present, msgEntry],
|
|
2165
2165
|
)
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2166
|
+
// Collapse only values actually represented by the contact header. Some
|
|
2167
|
+
// legacy submissions store a first name as senderName without the surname.
|
|
2168
|
+
const headerFieldKeys = new Set(
|
|
2169
|
+
['name', 'first_name', 'last_name', 'full_name'].filter((key) => {
|
|
2170
|
+
const value = displayValue(entry.data[key]).trim().toLocaleLowerCase()
|
|
2171
|
+
return value && ` ${name.toLocaleLowerCase()} `.includes(` ${value} `)
|
|
2172
|
+
}),
|
|
2173
2173
|
)
|
|
2174
|
+
if (email && displayValue(entry.data.email) === email) headerFieldKeys.add('email')
|
|
2175
|
+
if (phone && displayValue(entry.data.phone) === phone) headerFieldKeys.add('phone')
|
|
2176
|
+
if (website) headerFieldKeys.add('website')
|
|
2177
|
+
const hiddenHeaderRows = submissionRows.filter(({ key }) => headerFieldKeys.has(key))
|
|
2178
|
+
const emptyRows = submissionRows.filter(({ key }) => !displayValue(entry.data[key]))
|
|
2179
|
+
const visibleRows = showAllFields
|
|
2180
|
+
? submissionRows
|
|
2181
|
+
: submissionRows.filter(
|
|
2182
|
+
({ key }) => !headerFieldKeys.has(key) && Boolean(displayValue(entry.data[key])),
|
|
2183
|
+
)
|
|
2184
|
+
const hiddenHeaderCount = hiddenHeaderRows.filter(({ key }) =>
|
|
2185
|
+
displayValue(entry.data[key]),
|
|
2186
|
+
).length
|
|
2187
|
+
const hiddenFieldSummary = [
|
|
2188
|
+
hiddenHeaderCount ? `${hiddenHeaderCount} shown above` : '',
|
|
2189
|
+
emptyRows.length ? `${emptyRows.length} empty` : '',
|
|
2190
|
+
]
|
|
2191
|
+
.filter(Boolean)
|
|
2192
|
+
.join(', ')
|
|
2193
|
+
const messageTitle = msgEntry
|
|
2194
|
+
? (
|
|
2195
|
+
{
|
|
2196
|
+
description: 'Project description',
|
|
2197
|
+
message: 'Message',
|
|
2198
|
+
goal: 'Primary goal',
|
|
2199
|
+
services: 'Services',
|
|
2200
|
+
} as Record<string, string>
|
|
2201
|
+
)[msgEntry.key] || msgEntry.label
|
|
2202
|
+
: ''
|
|
2203
|
+
|
|
2174
2204
|
const answeredCount = useMemo(
|
|
2175
2205
|
() => present.filter(({ key }) => Boolean(displayValue(entry.data[key]))).length,
|
|
2176
2206
|
[present, entry.data],
|
|
@@ -2492,10 +2522,10 @@ function EntryDetail({
|
|
|
2492
2522
|
)}
|
|
2493
2523
|
</div>
|
|
2494
2524
|
|
|
2495
|
-
{/* Hybrid white top band:
|
|
2525
|
+
{/* Hybrid white top band: contact header */}
|
|
2496
2526
|
<div className="border-bdr bg-card border-b">
|
|
2497
|
-
<div className="mx-auto max-w-[860px] px-8 pt-7 pb-
|
|
2498
|
-
<div className=
|
|
2527
|
+
<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]">
|
|
2528
|
+
<div className="flex items-start gap-4 max-[640px]:flex-wrap">
|
|
2499
2529
|
<span
|
|
2500
2530
|
className="flex size-[52px] shrink-0 items-center justify-center rounded-full text-[18px] font-bold"
|
|
2501
2531
|
style={{ background: avatarColor(name), color: 'var(--on-avatar)' }}
|
|
@@ -2543,15 +2573,17 @@ function EntryDetail({
|
|
|
2543
2573
|
{/* Source line */}
|
|
2544
2574
|
<div className="text-sub mt-2 flex min-w-0 items-center gap-2 text-[12.5px]">
|
|
2545
2575
|
<span
|
|
2546
|
-
className="inline-flex shrink-0 items-center rounded-[5px] px-2 py-[3px] text-[11px] font-semibold"
|
|
2576
|
+
className="inline-flex shrink-0 items-center rounded-[5px] px-2 py-[3px] text-[11px] font-semibold whitespace-nowrap"
|
|
2547
2577
|
style={{ color: attr.channelFg, background: attr.channelBg }}
|
|
2548
2578
|
>
|
|
2549
2579
|
{attr.channelLabel}
|
|
2550
2580
|
</span>
|
|
2551
|
-
|
|
2552
|
-
<
|
|
2553
|
-
|
|
2554
|
-
|
|
2581
|
+
{attr.channelKey !== 'direct' ? (
|
|
2582
|
+
<span className="min-w-0 truncate">
|
|
2583
|
+
<b className="text-txt font-semibold">{attr.source}</b> / {attr.medium}
|
|
2584
|
+
{attr.campaign ? ` · ${attr.campaign}` : ''}
|
|
2585
|
+
</span>
|
|
2586
|
+
) : null}
|
|
2555
2587
|
</div>
|
|
2556
2588
|
|
|
2557
2589
|
{/* Contact pills */}
|
|
@@ -2754,35 +2786,39 @@ function EntryDetail({
|
|
|
2754
2786
|
</div>
|
|
2755
2787
|
</div>
|
|
2756
2788
|
) : null}
|
|
2757
|
-
|
|
2758
|
-
{/* Message block on hybrid white band */}
|
|
2759
|
-
{msgEntry ? (
|
|
2760
|
-
<section className="group" aria-labelledby="d-msg-l">
|
|
2761
|
-
<div className="text-faint mb-2 flex items-center gap-2 text-[12px] font-semibold">
|
|
2762
|
-
<span id="d-msg-l">{msgEntry.label}</span>
|
|
2763
|
-
<button
|
|
2764
|
-
type="button"
|
|
2765
|
-
title={`Copy ${msgEntry.label}`}
|
|
2766
|
-
aria-label={`Copy ${msgEntry.label}`}
|
|
2767
|
-
onClick={() => copyValue(msgText)}
|
|
2768
|
-
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"
|
|
2769
|
-
>
|
|
2770
|
-
<Copy size={13} aria-hidden />
|
|
2771
|
-
</button>
|
|
2772
|
-
</div>
|
|
2773
|
-
<div
|
|
2774
|
-
dir="auto"
|
|
2775
|
-
className="text-txt max-w-[68ch] text-[15.5px] leading-[1.7] break-words whitespace-pre-wrap @[1240px]:max-w-[75ch]"
|
|
2776
|
-
>
|
|
2777
|
-
{formatFieldDisplay(msgEntry.key, msgText, fieldMap.get(msgEntry.key))}
|
|
2778
|
-
</div>
|
|
2779
|
-
</section>
|
|
2780
|
-
) : null}
|
|
2781
2789
|
</div>
|
|
2782
2790
|
</div>
|
|
2783
2791
|
|
|
2784
2792
|
{/* Grey body area: cards */}
|
|
2785
2793
|
<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">
|
|
2794
|
+
{msgEntry ? (
|
|
2795
|
+
<article
|
|
2796
|
+
className="group border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:col-start-1"
|
|
2797
|
+
aria-labelledby="d-msg-l"
|
|
2798
|
+
>
|
|
2799
|
+
<h3
|
|
2800
|
+
id="d-msg-l"
|
|
2801
|
+
className="border-bdr text-txt m-0 flex items-center gap-2 border-b px-5 py-3 text-[13px] font-semibold"
|
|
2802
|
+
>
|
|
2803
|
+
{messageTitle}
|
|
2804
|
+
<button
|
|
2805
|
+
type="button"
|
|
2806
|
+
title={`Copy ${messageTitle}`}
|
|
2807
|
+
aria-label={`Copy ${messageTitle}`}
|
|
2808
|
+
onClick={() => copyValue(msgText)}
|
|
2809
|
+
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"
|
|
2810
|
+
>
|
|
2811
|
+
<Copy size={13} aria-hidden />
|
|
2812
|
+
</button>
|
|
2813
|
+
</h3>
|
|
2814
|
+
<div
|
|
2815
|
+
dir="auto"
|
|
2816
|
+
className="text-txt px-5 pt-4 pb-5 text-[15px] leading-[1.7] [text-wrap:pretty] break-words whitespace-pre-wrap"
|
|
2817
|
+
>
|
|
2818
|
+
{formatFieldDisplay(msgEntry.key, msgText, fieldMap.get(msgEntry.key))}
|
|
2819
|
+
</div>
|
|
2820
|
+
</article>
|
|
2821
|
+
) : null}
|
|
2786
2822
|
{/* Submission card */}
|
|
2787
2823
|
<article className="border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:col-start-1">
|
|
2788
2824
|
<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">
|
|
@@ -2792,37 +2828,29 @@ function EntryDetail({
|
|
|
2792
2828
|
</span>
|
|
2793
2829
|
</h3>
|
|
2794
2830
|
<dl className="divide-bdr m-0 divide-y">
|
|
2795
|
-
{
|
|
2831
|
+
{visibleRows.map(({ key, label }) => {
|
|
2796
2832
|
const raw = displayValue(entry.data[key])
|
|
2797
2833
|
const formatted = formatFieldDisplay(key, raw, fieldMap.get(key))
|
|
2798
2834
|
return (
|
|
2799
|
-
<DetailRow
|
|
2800
|
-
{
|
|
2835
|
+
<DetailRow
|
|
2836
|
+
key={key}
|
|
2837
|
+
label={label}
|
|
2838
|
+
copyText={formatted || undefined}
|
|
2839
|
+
onCopy={copyValue}
|
|
2840
|
+
>
|
|
2841
|
+
{formatted || <span className="text-faint">Not answered</span>}
|
|
2801
2842
|
</DetailRow>
|
|
2802
2843
|
)
|
|
2803
2844
|
})}
|
|
2804
|
-
{showEmpty
|
|
2805
|
-
? emptyRows.map(({ key, label }) => (
|
|
2806
|
-
<div
|
|
2807
|
-
key={key}
|
|
2808
|
-
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"
|
|
2809
|
-
>
|
|
2810
|
-
<dt className="text-sub text-[12.5px] leading-[1.5] font-medium">{label}</dt>
|
|
2811
|
-
<dd className="text-faint m-0 text-[14px] leading-[1.55]">Not answered</dd>
|
|
2812
|
-
</div>
|
|
2813
|
-
))
|
|
2814
|
-
: null}
|
|
2815
2845
|
</dl>
|
|
2816
|
-
{
|
|
2846
|
+
{hiddenFieldSummary ? (
|
|
2817
2847
|
<button
|
|
2818
2848
|
type="button"
|
|
2819
|
-
aria-expanded={
|
|
2820
|
-
onClick={() =>
|
|
2849
|
+
aria-expanded={showAllFields}
|
|
2850
|
+
onClick={() => setShowAllFields((v) => !v)}
|
|
2821
2851
|
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"
|
|
2822
2852
|
>
|
|
2823
|
-
{
|
|
2824
|
-
? 'Hide empty fields'
|
|
2825
|
-
: `Show ${emptyRows.length} empty ${emptyRows.length === 1 ? 'field' : 'fields'}`}
|
|
2853
|
+
{showAllFields ? 'Show fewer fields' : `Show all fields (${hiddenFieldSummary})`}
|
|
2826
2854
|
</button>
|
|
2827
2855
|
) : null}
|
|
2828
2856
|
</article>
|
|
@@ -2908,7 +2936,7 @@ function EntryDetail({
|
|
|
2908
2936
|
) : null}
|
|
2909
2937
|
|
|
2910
2938
|
{/* Attribution & technical card */}
|
|
2911
|
-
<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-
|
|
2939
|
+
<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">
|
|
2912
2940
|
<h3 className="m-0">
|
|
2913
2941
|
<button
|
|
2914
2942
|
type="button"
|
|
@@ -2982,9 +3010,10 @@ function EntryDetail({
|
|
|
2982
3010
|
href={attr.landingPage}
|
|
2983
3011
|
target="_blank"
|
|
2984
3012
|
rel="noopener noreferrer"
|
|
2985
|
-
|
|
3013
|
+
title={attr.landingPage}
|
|
3014
|
+
className="text-acc block truncate hover:underline"
|
|
2986
3015
|
>
|
|
2987
|
-
{attr.landingPage}
|
|
3016
|
+
{attr.landingPage.replace(/^https?:\/\/(?:www\.)?/, '')}
|
|
2988
3017
|
</a>
|
|
2989
3018
|
) : (
|
|
2990
3019
|
'—'
|
|
@@ -3052,10 +3081,10 @@ function DetailRow({
|
|
|
3052
3081
|
}) {
|
|
3053
3082
|
return (
|
|
3054
3083
|
<div
|
|
3055
|
-
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 ${
|
|
3084
|
+
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 ${
|
|
3056
3085
|
compact
|
|
3057
3086
|
? 'grid-cols-[minmax(110px,32%)_minmax(0,1fr)] py-[9px] @[1240px]:grid-cols-[118px_minmax(0,1fr)]'
|
|
3058
|
-
: 'grid-cols-[minmax(110px,
|
|
3087
|
+
: 'grid-cols-[minmax(110px,170px)_minmax(0,1fr)] py-2'
|
|
3059
3088
|
}`}
|
|
3060
3089
|
>
|
|
3061
3090
|
<dt className="text-sub text-[12.5px] leading-[1.5] font-medium">{label}</dt>
|