@nocode-factory/sanity-kit 2.0.0
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/bin/ncf-kit.mjs +201 -0
- package/dist/index.d.ts +1643 -0
- package/dist/index.js +6632 -0
- package/dist/index.js.map +1 -0
- package/dist/web-server.d.ts +46 -0
- package/dist/web-server.js +51 -0
- package/dist/web-server.js.map +1 -0
- package/dist/web.d.ts +27 -0
- package/dist/web.js +117 -0
- package/dist/web.js.map +1 -0
- package/package.json +90 -0
- package/scripts/use-client.mjs +20 -0
- package/src/config/defaults.ts +74 -0
- package/src/config/resolve.ts +153 -0
- package/src/config/types.ts +290 -0
- package/src/config/validate.ts +193 -0
- package/src/context/BoardLayoutContext.tsx +24 -0
- package/src/context/KitContext.tsx +30 -0
- package/src/context/PreviewTargetContext.tsx +27 -0
- package/src/hooks/useAnnotations.ts +60 -0
- package/src/hooks/useBoardLayout.ts +398 -0
- package/src/hooks/useColumnOptions.ts +47 -0
- package/src/hooks/useDocumentColumns.ts +61 -0
- package/src/hooks/useHistory.ts +89 -0
- package/src/hooks/useInternalColumns.ts +19 -0
- package/src/hooks/useKitClient.ts +15 -0
- package/src/hooks/useOccurrences.ts +62 -0
- package/src/hooks/usePageContents.ts +65 -0
- package/src/hooks/usePages.ts +41 -0
- package/src/hooks/usePreviewTarget.ts +162 -0
- package/src/hooks/useQueryData.ts +103 -0
- package/src/hooks/useRegistration.ts +50 -0
- package/src/index.ts +280 -0
- package/src/lib/blocks.ts +38 -0
- package/src/lib/colors.ts +103 -0
- package/src/lib/columns.ts +137 -0
- package/src/lib/diff.ts +200 -0
- package/src/lib/elkLayout.ts +124 -0
- package/src/lib/graph.ts +238 -0
- package/src/lib/grouping.ts +116 -0
- package/src/lib/links.ts +70 -0
- package/src/lib/occurrences.ts +93 -0
- package/src/lib/pageThumbnail.ts +43 -0
- package/src/lib/pages.ts +199 -0
- package/src/lib/paths.ts +68 -0
- package/src/lib/query.ts +113 -0
- package/src/lib/schemaColumns.ts +162 -0
- package/src/lib/schemaTypes.ts +75 -0
- package/src/lib/sectionsMap.ts +83 -0
- package/src/lib/service.ts +88 -0
- package/src/lib/siteRoutes.ts +43 -0
- package/src/lib/status.ts +122 -0
- package/src/lib/studioLinks.ts +137 -0
- package/src/schema/boardLayout.ts +190 -0
- package/src/tools/components/BlockCard.tsx +79 -0
- package/src/tools/components/ComponentsTool.tsx +171 -0
- package/src/tools/components/map/SectionNode.tsx +109 -0
- package/src/tools/components/map/SectionsMap.tsx +339 -0
- package/src/tools/createToolComponent.tsx +67 -0
- package/src/tools/history/ChangeRow.tsx +87 -0
- package/src/tools/history/DiffPanel.tsx +227 -0
- package/src/tools/history/HistoryTool.tsx +230 -0
- package/src/tools/more/MoreTool.tsx +82 -0
- package/src/tools/pages/ColumnHeader.tsx +216 -0
- package/src/tools/pages/ColumnVisibility.tsx +173 -0
- package/src/tools/pages/FieldValue.tsx +327 -0
- package/src/tools/pages/PagesTable.tsx +394 -0
- package/src/tools/pages/PagesTool.tsx +333 -0
- package/src/tools/pages/PagesToolbar.tsx +53 -0
- package/src/tools/pages/PathCell.tsx +71 -0
- package/src/tools/pages/PreviewTarget.tsx +226 -0
- package/src/tools/pages/TagCell.tsx +124 -0
- package/src/tools/pages/ViewTabs.tsx +57 -0
- package/src/tools/pages/board/BoardView.tsx +661 -0
- package/src/tools/pages/board/PageNode.tsx +306 -0
- package/src/tools/pages/board/PagePanel.tsx +228 -0
- package/src/tools/presentation/PreviewHeader.tsx +75 -0
- package/src/tools/shared/AnnotationNode.tsx +126 -0
- package/src/ui/ActorName.tsx +20 -0
- package/src/ui/ConfigIssues.tsx +41 -0
- package/src/ui/InlineCode.tsx +22 -0
- package/src/ui/Popover.tsx +85 -0
- package/src/ui/ProjectStatusNotice.tsx +58 -0
- package/src/ui/QueryError.tsx +16 -0
- package/src/ui/QuietInput.tsx +64 -0
- package/src/ui/StatusBadge.tsx +11 -0
- package/src/ui/ToolPlaceholder.tsx +23 -0
- package/src/ui/formatDate.ts +14 -0
- package/src/ui/tokens.ts +54 -0
- package/src/version.ts +5 -0
- package/src/web/PreviewBanner.tsx +115 -0
- package/src/web/draftModeToggle.ts +56 -0
- package/src/web/environment.ts +21 -0
- package/src/web/index.ts +15 -0
- package/src/web/server.ts +11 -0
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import {useState} from 'react'
|
|
2
|
+
import {Badge, Box, Flex, Stack, Text} from '@sanity/ui'
|
|
3
|
+
import {ChevronDownIcon} from '@sanity/icons/ChevronDown'
|
|
4
|
+
import {ChevronRightIcon} from '@sanity/icons/ChevronRight'
|
|
5
|
+
import {ChevronUpIcon} from '@sanity/icons/ChevronUp'
|
|
6
|
+
import {StatusBadge} from '../../ui/StatusBadge'
|
|
7
|
+
import {formatDate} from '../../ui/formatDate'
|
|
8
|
+
import {BORDER, BORDER_SOFT, CELL, TABULAR, TINT_ALPHA} from '../../ui/tokens'
|
|
9
|
+
import {colorForRow, withAlpha, type ColorBy} from '../../lib/colors'
|
|
10
|
+
import type {PageRow, SortDirection, SortKey} from '../../lib/pages'
|
|
11
|
+
import type {RowGroup} from '../../lib/grouping'
|
|
12
|
+
import type {NcfBoardTag, NcfInternalField, ResolvedDocumentColumn} from '../../config/types'
|
|
13
|
+
import type {NodeLayout} from '../../lib/graph'
|
|
14
|
+
import {FieldValue} from './FieldValue'
|
|
15
|
+
import {usePreviewTarget} from '../../context/PreviewTargetContext'
|
|
16
|
+
import {AddColumn, ColumnHeader} from './ColumnHeader'
|
|
17
|
+
import {PathCell} from './PathCell'
|
|
18
|
+
import {TagCell} from './TagCell'
|
|
19
|
+
|
|
20
|
+
const BASE_COLUMNS: {key: SortKey; label: string; align?: 'right'; width: string}[] = [
|
|
21
|
+
{key: 'title', label: 'Titre', width: 'minmax(180px, 1.6fr)'},
|
|
22
|
+
{key: 'path', label: 'Chemin', width: 'minmax(200px, 2fr)'},
|
|
23
|
+
{key: 'status', label: 'Statut', width: '118px'},
|
|
24
|
+
{key: 'blockCount', label: 'Blocs', align: 'right', width: '64px'},
|
|
25
|
+
{key: 'updatedAt', label: 'Modifiée', width: '132px'},
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
export interface PagesTableProps {
|
|
29
|
+
/** Un seul groupe sans libellé quand aucun regroupement n'est demandé. */
|
|
30
|
+
groups: readonly RowGroup[]
|
|
31
|
+
sortKey: SortKey
|
|
32
|
+
sortDirection: SortDirection
|
|
33
|
+
onSort: (key: SortKey) => void
|
|
34
|
+
/** Colonnes ajoutées depuis l'interface. */
|
|
35
|
+
columns: readonly NcfInternalField[]
|
|
36
|
+
meta: ReadonlyMap<string, NodeLayout>
|
|
37
|
+
tags: readonly NcfBoardTag[]
|
|
38
|
+
colorBy: ColorBy
|
|
39
|
+
fields: readonly NcfInternalField[]
|
|
40
|
+
onField: (documentId: string, fieldId: string, value: string) => void
|
|
41
|
+
/** Données du document affichées, dans l'ordre de déclaration. */
|
|
42
|
+
dataColumns: readonly ResolvedDocumentColumn[]
|
|
43
|
+
onAddOption: (columnId: string, label: string) => void
|
|
44
|
+
onRemoveOption: (columnId: string, optionId: string) => void
|
|
45
|
+
onOptionColor: (columnId: string, optionId: string, color: string | null) => void
|
|
46
|
+
onAddColumn: (label: string, type: 'text' | 'select') => void
|
|
47
|
+
onRenameColumn: (id: string, label: string) => void
|
|
48
|
+
onRemoveColumn: (id: string) => void
|
|
49
|
+
onMoveColumn: (id: string, delta: number) => void
|
|
50
|
+
/** Ouvre la page : Presentation si le front est connu, édition sinon. */
|
|
51
|
+
onOpen: (row: PageRow) => void
|
|
52
|
+
/** Colonnes masquées par l'utilisateur. */
|
|
53
|
+
hidden: ReadonlySet<string>
|
|
54
|
+
onTag: (documentId: string, tag: string | null) => void
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Les contrôles d'une ligne restent invisibles tant qu'on ne s'y intéresse
|
|
59
|
+
* pas : dans un tableau, une bordure par cellule concurrence la donnée. Ils
|
|
60
|
+
* réapparaissent au survol de la ligne et au focus, pour rester atteignables
|
|
61
|
+
* au clavier.
|
|
62
|
+
*/
|
|
63
|
+
const QUIET_CONTROLS = `
|
|
64
|
+
.ncf-row .ncf-quiet select {
|
|
65
|
+
box-shadow: none;
|
|
66
|
+
background: transparent;
|
|
67
|
+
}
|
|
68
|
+
.ncf-row:hover .ncf-quiet select,
|
|
69
|
+
.ncf-row .ncf-quiet select:focus {
|
|
70
|
+
box-shadow: inset 0 0 0 1px var(--card-border-color, rgba(127,127,127,0.28));
|
|
71
|
+
background: var(--card-bg-color);
|
|
72
|
+
}
|
|
73
|
+
`
|
|
74
|
+
|
|
75
|
+
export function PagesTable(props: PagesTableProps) {
|
|
76
|
+
const {
|
|
77
|
+
groups,
|
|
78
|
+
sortKey,
|
|
79
|
+
sortDirection,
|
|
80
|
+
onSort,
|
|
81
|
+
columns,
|
|
82
|
+
meta,
|
|
83
|
+
tags,
|
|
84
|
+
colorBy,
|
|
85
|
+
fields,
|
|
86
|
+
onField,
|
|
87
|
+
dataColumns,
|
|
88
|
+
onAddOption,
|
|
89
|
+
onRemoveOption,
|
|
90
|
+
onOptionColor,
|
|
91
|
+
onAddColumn,
|
|
92
|
+
onRenameColumn,
|
|
93
|
+
onRemoveColumn,
|
|
94
|
+
onMoveColumn,
|
|
95
|
+
onOpen,
|
|
96
|
+
hidden,
|
|
97
|
+
onTag,
|
|
98
|
+
} = props
|
|
99
|
+
|
|
100
|
+
// Tout est déplié au départ : on ne cache pas des pages à quelqu'un qui
|
|
101
|
+
// vient d'activer un regroupement.
|
|
102
|
+
const [collapsed, setCollapsed] = useState<ReadonlySet<string>>(new Set())
|
|
103
|
+
const [hovered, setHovered] = useState<string | null>(null)
|
|
104
|
+
// Le lien du chemin mène au site tel qu'il est choisi dans la barre, pas à
|
|
105
|
+
// une URL de production figée.
|
|
106
|
+
const {siteUrlFor} = usePreviewTarget()
|
|
107
|
+
|
|
108
|
+
const toggle = (key: string) =>
|
|
109
|
+
setCollapsed((current) => {
|
|
110
|
+
const next = new Set(current)
|
|
111
|
+
if (next.has(key)) next.delete(key)
|
|
112
|
+
else next.add(key)
|
|
113
|
+
return next
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const showLocale = [...meta.keys()].length >= 0 && groups.some((g) => g.rows.some((r) => r.locale))
|
|
117
|
+
const locales = new Set(groups.flatMap((g) => g.rows.map((r) => r.locale)).filter(Boolean))
|
|
118
|
+
|
|
119
|
+
const baseColumns = BASE_COLUMNS.filter((column) => !hidden.has(column.key))
|
|
120
|
+
const showTag = !hidden.has('tag')
|
|
121
|
+
|
|
122
|
+
// Faits de la page d'abord (colonnes de base, données du document), puis ce
|
|
123
|
+
// qui relève du suivi et s'édite (étiquette, colonnes ajoutées), enfin la
|
|
124
|
+
// commande d'ajout.
|
|
125
|
+
const grid = [
|
|
126
|
+
...baseColumns.map((c) => c.width),
|
|
127
|
+
...dataColumns.map(() => 'minmax(160px, 1.4fr)'),
|
|
128
|
+
...(showTag ? ['124px'] : []),
|
|
129
|
+
...columns.map(() => 'minmax(140px, 1fr)'),
|
|
130
|
+
'104px',
|
|
131
|
+
].join(' ')
|
|
132
|
+
|
|
133
|
+
const row: React.CSSProperties = {
|
|
134
|
+
display: 'grid',
|
|
135
|
+
gridTemplateColumns: grid,
|
|
136
|
+
gap: '0.875rem',
|
|
137
|
+
alignItems: 'center',
|
|
138
|
+
borderBottom: `1px solid ${BORDER_SOFT}`,
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
// Beaucoup de colonnes possibles : le tableau défile horizontalement
|
|
143
|
+
// plutôt que d'écraser les libellés.
|
|
144
|
+
<Box style={{overflowX: 'auto'}}>
|
|
145
|
+
<style>{QUIET_CONTROLS}</style>
|
|
146
|
+
<Box style={{minWidth: 'min-content'}}>
|
|
147
|
+
<Box
|
|
148
|
+
paddingX={3}
|
|
149
|
+
paddingY={2}
|
|
150
|
+
style={{
|
|
151
|
+
...row,
|
|
152
|
+
borderBottom: `1px solid ${BORDER}`,
|
|
153
|
+
position: 'sticky',
|
|
154
|
+
top: 0,
|
|
155
|
+
background: 'var(--card-bg-color, inherit)',
|
|
156
|
+
zIndex: 2,
|
|
157
|
+
}}
|
|
158
|
+
>
|
|
159
|
+
{baseColumns.map((column) => {
|
|
160
|
+
const active = sortKey === column.key
|
|
161
|
+
const Arrow = sortDirection === 'asc' ? ChevronUpIcon : ChevronDownIcon
|
|
162
|
+
return (
|
|
163
|
+
<Flex
|
|
164
|
+
key={column.key}
|
|
165
|
+
align="center"
|
|
166
|
+
gap={1}
|
|
167
|
+
justify={column.align === 'right' ? 'flex-end' : 'flex-start'}
|
|
168
|
+
onClick={() => onSort(column.key)}
|
|
169
|
+
style={{cursor: 'pointer', userSelect: 'none'}}
|
|
170
|
+
title={`Trier par ${column.label.toLowerCase()}`}
|
|
171
|
+
>
|
|
172
|
+
<Text size={0} weight="medium" muted={!active}>
|
|
173
|
+
{column.label}
|
|
174
|
+
</Text>
|
|
175
|
+
{active && <Arrow style={{fontSize: 13, opacity: 0.7}} />}
|
|
176
|
+
</Flex>
|
|
177
|
+
)
|
|
178
|
+
})}
|
|
179
|
+
|
|
180
|
+
{dataColumns.map((column) => (
|
|
181
|
+
<Text key={column.key} size={0} weight="medium" muted textOverflow="ellipsis">
|
|
182
|
+
{column.label}
|
|
183
|
+
</Text>
|
|
184
|
+
))}
|
|
185
|
+
|
|
186
|
+
{showTag && (
|
|
187
|
+
<Text size={0} weight="medium" muted>
|
|
188
|
+
Étiquette
|
|
189
|
+
</Text>
|
|
190
|
+
)}
|
|
191
|
+
|
|
192
|
+
{columns.map((column) => (
|
|
193
|
+
<ColumnHeader
|
|
194
|
+
key={column.id}
|
|
195
|
+
column={column}
|
|
196
|
+
onRename={onRenameColumn}
|
|
197
|
+
onRemove={onRemoveColumn}
|
|
198
|
+
onMove={onMoveColumn}
|
|
199
|
+
options={{
|
|
200
|
+
onAddOption: (label) => onAddOption(column.id, label),
|
|
201
|
+
onRemoveOption: (optionId) => onRemoveOption(column.id, optionId),
|
|
202
|
+
onOptionColor: (optionId, color) => onOptionColor(column.id, optionId, color),
|
|
203
|
+
}}
|
|
204
|
+
/>
|
|
205
|
+
))}
|
|
206
|
+
|
|
207
|
+
<AddColumn onAdd={onAddColumn} />
|
|
208
|
+
</Box>
|
|
209
|
+
|
|
210
|
+
{groups.map((group) => {
|
|
211
|
+
const shut = Boolean(group.label) && collapsed.has(group.key)
|
|
212
|
+
return (
|
|
213
|
+
<Stack gap={0} key={group.key || '__all__'}>
|
|
214
|
+
{group.label && (
|
|
215
|
+
<Flex
|
|
216
|
+
align="center"
|
|
217
|
+
gap={2}
|
|
218
|
+
paddingX={3}
|
|
219
|
+
paddingY={2}
|
|
220
|
+
onClick={() => toggle(group.key)}
|
|
221
|
+
style={{
|
|
222
|
+
background: 'var(--card-muted-bg-color, rgba(127,127,127,0.06))',
|
|
223
|
+
borderBottom: `1px solid ${BORDER_SOFT}`,
|
|
224
|
+
position: 'sticky',
|
|
225
|
+
top: 34,
|
|
226
|
+
zIndex: 1,
|
|
227
|
+
cursor: 'pointer',
|
|
228
|
+
userSelect: 'none',
|
|
229
|
+
}}
|
|
230
|
+
>
|
|
231
|
+
{shut ? (
|
|
232
|
+
<ChevronRightIcon style={{fontSize: 14, opacity: 0.6}} />
|
|
233
|
+
) : (
|
|
234
|
+
<ChevronDownIcon style={{fontSize: 14, opacity: 0.6}} />
|
|
235
|
+
)}
|
|
236
|
+
{group.color && (
|
|
237
|
+
<Box
|
|
238
|
+
style={{
|
|
239
|
+
width: 8,
|
|
240
|
+
height: 8,
|
|
241
|
+
borderRadius: '50%',
|
|
242
|
+
background: group.color,
|
|
243
|
+
flex: 'none',
|
|
244
|
+
}}
|
|
245
|
+
/>
|
|
246
|
+
)}
|
|
247
|
+
<Text size={1} weight="medium">
|
|
248
|
+
{group.label}
|
|
249
|
+
</Text>
|
|
250
|
+
<Text size={0} muted style={TABULAR}>
|
|
251
|
+
{group.rows.length}
|
|
252
|
+
</Text>
|
|
253
|
+
</Flex>
|
|
254
|
+
)}
|
|
255
|
+
|
|
256
|
+
{(shut ? [] : group.rows).map((entryRow) => {
|
|
257
|
+
const entry = meta.get(entryRow.id)
|
|
258
|
+
const {color} = colorForRow(entryRow, colorBy, {meta, tags, fields})
|
|
259
|
+
const isHovered = hovered === entryRow.id
|
|
260
|
+
|
|
261
|
+
return (
|
|
262
|
+
<Box
|
|
263
|
+
key={entryRow.id}
|
|
264
|
+
className="ncf-row"
|
|
265
|
+
paddingX={3}
|
|
266
|
+
paddingY={2}
|
|
267
|
+
onMouseEnter={() => setHovered(entryRow.id)}
|
|
268
|
+
onMouseLeave={() => setHovered(null)}
|
|
269
|
+
style={{
|
|
270
|
+
...row,
|
|
271
|
+
// Teinte très basse : le fond situe la ligne, il ne la
|
|
272
|
+
// crie pas. Le survol l'appuie d'un cran.
|
|
273
|
+
background: color
|
|
274
|
+
? withAlpha(color, isHovered ? TINT_ALPHA + 0.05 : TINT_ALPHA)
|
|
275
|
+
: isHovered
|
|
276
|
+
? 'var(--card-muted-bg-color, rgba(127,127,127,0.05))'
|
|
277
|
+
: undefined,
|
|
278
|
+
transition: 'background 120ms ease',
|
|
279
|
+
}}
|
|
280
|
+
>
|
|
281
|
+
<Box style={CELL}>
|
|
282
|
+
<Flex align="center" gap={2}>
|
|
283
|
+
{color && (
|
|
284
|
+
<Box
|
|
285
|
+
style={{
|
|
286
|
+
width: 6,
|
|
287
|
+
height: 6,
|
|
288
|
+
borderRadius: '50%',
|
|
289
|
+
background: color,
|
|
290
|
+
flex: 'none',
|
|
291
|
+
}}
|
|
292
|
+
/>
|
|
293
|
+
)}
|
|
294
|
+
<Box
|
|
295
|
+
style={{...CELL, cursor: 'pointer'}}
|
|
296
|
+
onClick={() => onOpen(entryRow)}
|
|
297
|
+
title="Ouvrir dans Presentation"
|
|
298
|
+
>
|
|
299
|
+
<Text size={1} weight="medium" textOverflow="ellipsis">
|
|
300
|
+
{entryRow.title}
|
|
301
|
+
</Text>
|
|
302
|
+
</Box>
|
|
303
|
+
</Flex>
|
|
304
|
+
</Box>
|
|
305
|
+
|
|
306
|
+
{!hidden.has('path') && (
|
|
307
|
+
<Box style={CELL}>
|
|
308
|
+
<PathCell
|
|
309
|
+
path={entryRow.path}
|
|
310
|
+
locale={entryRow.locale}
|
|
311
|
+
showLocale={showLocale && locales.size > 1}
|
|
312
|
+
url={siteUrlFor(entryRow.url)}
|
|
313
|
+
/>
|
|
314
|
+
</Box>
|
|
315
|
+
)}
|
|
316
|
+
|
|
317
|
+
{!hidden.has('status') && (
|
|
318
|
+
<Flex align="center" gap={2} style={CELL}>
|
|
319
|
+
<StatusBadge status={entryRow.status} />
|
|
320
|
+
{/* L'indexation ne se signale que lorsqu'elle bloque :
|
|
321
|
+
une page indexable est le cas normal. */}
|
|
322
|
+
{entryRow.noindex && (
|
|
323
|
+
<Badge
|
|
324
|
+
tone="caution"
|
|
325
|
+
fontSize={0}
|
|
326
|
+
title="Exclue de Google, du sitemap et de llms.txt"
|
|
327
|
+
>
|
|
328
|
+
Noindex
|
|
329
|
+
</Badge>
|
|
330
|
+
)}
|
|
331
|
+
</Flex>
|
|
332
|
+
)}
|
|
333
|
+
|
|
334
|
+
{!hidden.has('blockCount') && (
|
|
335
|
+
<Box style={{textAlign: 'right'}}>
|
|
336
|
+
<Text size={1} muted={entryRow.blockCount === 0} style={TABULAR}>
|
|
337
|
+
{entryRow.blockCount}
|
|
338
|
+
</Text>
|
|
339
|
+
</Box>
|
|
340
|
+
)}
|
|
341
|
+
|
|
342
|
+
{!hidden.has('updatedAt') && (
|
|
343
|
+
<Box style={CELL}>
|
|
344
|
+
<Text size={0} muted style={TABULAR}>
|
|
345
|
+
{formatDate(entryRow.updatedAt)}
|
|
346
|
+
</Text>
|
|
347
|
+
</Box>
|
|
348
|
+
)}
|
|
349
|
+
|
|
350
|
+
{dataColumns.map((column) => {
|
|
351
|
+
const value = entryRow.data[column.key] ?? ''
|
|
352
|
+
return (
|
|
353
|
+
<Box key={column.key} style={CELL} title={value || undefined}>
|
|
354
|
+
<Text size={0} muted={!value} textOverflow="ellipsis">
|
|
355
|
+
{value || '—'}
|
|
356
|
+
</Text>
|
|
357
|
+
</Box>
|
|
358
|
+
)
|
|
359
|
+
})}
|
|
360
|
+
|
|
361
|
+
{showTag && (
|
|
362
|
+
<TagCell
|
|
363
|
+
tag={entry?.tag ?? null}
|
|
364
|
+
tags={tags}
|
|
365
|
+
onChange={(next) => onTag(entryRow.id, next)}
|
|
366
|
+
/>
|
|
367
|
+
)}
|
|
368
|
+
|
|
369
|
+
{columns.map((column) => (
|
|
370
|
+
<Box key={column.id} style={CELL}>
|
|
371
|
+
<FieldValue
|
|
372
|
+
column={column}
|
|
373
|
+
value={entry?.fields?.[column.id] ?? ''}
|
|
374
|
+
onChange={(next) => onField(entryRow.id, column.id, next)}
|
|
375
|
+
onAddOption={(label) => onAddOption(column.id, label)}
|
|
376
|
+
onRemoveOption={(optionId) => onRemoveOption(column.id, optionId)}
|
|
377
|
+
onOptionColor={(optionId, color) =>
|
|
378
|
+
onOptionColor(column.id, optionId, color)
|
|
379
|
+
}
|
|
380
|
+
/>
|
|
381
|
+
</Box>
|
|
382
|
+
))}
|
|
383
|
+
|
|
384
|
+
<Box />
|
|
385
|
+
</Box>
|
|
386
|
+
)
|
|
387
|
+
})}
|
|
388
|
+
</Stack>
|
|
389
|
+
)
|
|
390
|
+
})}
|
|
391
|
+
</Box>
|
|
392
|
+
</Box>
|
|
393
|
+
)
|
|
394
|
+
}
|