@nocode-factory/sanity-kit 2.24.0 → 2.26.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/dist/{componentDefaults-BY3hQ6aD.js → componentDefaults-2eWjLLBf.js} +6 -6
- package/dist/componentDefaults-2eWjLLBf.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +467 -367
- package/dist/index.js.map +1 -1
- package/dist/schema.js +1 -1
- package/dist/web-server.js +2 -2
- package/dist/web-server.js.map +1 -1
- package/dist/web.js +9 -9
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/PropagatePublish.tsx +14 -14
- package/src/actions/RemoveFromSite.tsx +9 -9
- package/src/config/defaults.ts +7 -7
- package/src/config/resolve.ts +1 -1
- package/src/config/validate.ts +24 -24
- package/src/context/BoardLayoutContext.tsx +1 -1
- package/src/context/KitContext.tsx +1 -1
- package/src/context/PreviewTargetContext.tsx +1 -1
- package/src/form/LanguageMismatch.tsx +85 -0
- package/src/form/OverrideInput.tsx +5 -5
- package/src/form/SlugUrlInput.tsx +2 -2
- package/src/form/TranslationTodoInput.tsx +2 -2
- package/src/hooks/useHistory.ts +5 -5
- package/src/hooks/useOccurrences.ts +1 -1
- package/src/hooks/useOpenOnline.ts +4 -4
- package/src/index.ts +7 -5
- package/src/lib/grouping.ts +2 -2
- package/src/lib/overrides.ts +10 -10
- package/src/lib/pages.ts +3 -3
- package/src/lib/previewLocale.ts +17 -0
- package/src/lib/service.ts +5 -5
- package/src/lib/status.ts +3 -3
- package/src/lib/studioLinks.ts +6 -6
- package/src/schema/boardLayout.ts +32 -32
- package/src/schema/componentDefaults.ts +5 -5
- package/src/schema/translationTodo.ts +6 -6
- package/src/tools/components/BlockCard.tsx +3 -3
- package/src/tools/components/ComponentsTool.tsx +17 -17
- package/src/tools/components/map/SectionNode.tsx +1 -1
- package/src/tools/components/map/SectionsMap.tsx +10 -10
- package/src/tools/designSystem/DesignSystemTool.tsx +3 -3
- package/src/tools/history/DiffPanel.tsx +23 -23
- package/src/tools/history/HistoryTool.tsx +21 -23
- package/src/tools/more/MoreTool.tsx +1 -1
- package/src/tools/navbar/KitUpdate.tsx +8 -8
- package/src/tools/navbar/PreviewLauncher.tsx +6 -6
- package/src/tools/navbar/ToolButtons.tsx +2 -2
- package/src/tools/pages/ColumnHeader.tsx +18 -18
- package/src/tools/pages/ColumnVisibility.tsx +10 -10
- package/src/tools/pages/FieldValue.tsx +9 -9
- package/src/tools/pages/PagesTable.tsx +11 -11
- package/src/tools/pages/PagesTool.tsx +19 -19
- package/src/tools/pages/PagesToolbar.tsx +3 -3
- package/src/tools/pages/PathCell.tsx +1 -1
- package/src/tools/pages/PreviewTarget.tsx +10 -10
- package/src/tools/pages/SharePreview.tsx +19 -20
- package/src/tools/pages/TagCell.tsx +2 -2
- package/src/tools/pages/ViewTabs.tsx +4 -4
- package/src/tools/pages/board/BoardView.tsx +11 -11
- package/src/tools/pages/board/PageNode.tsx +5 -5
- package/src/tools/pages/board/PagePanel.tsx +10 -10
- package/src/tools/presentation/PreviewHeader.tsx +1 -1
- package/src/tools/shared/AnnotationNode.tsx +3 -3
- package/src/ui/ActorName.tsx +1 -1
- package/src/ui/ConfigIssues.tsx +3 -3
- package/src/ui/PreviewOriginsNotice.tsx +3 -3
- package/src/ui/ProjectStatusNotice.tsx +7 -7
- package/src/ui/QueryError.tsx +2 -2
- package/src/ui/ToolPlaceholder.tsx +2 -2
- package/src/ui/formatDate.ts +1 -1
- package/src/version.ts +1 -1
- package/src/web/PreviewBanner.tsx +9 -9
- package/src/web/draftModeToggle.ts +1 -1
- package/src/web/previewGrant.ts +5 -5
- package/dist/componentDefaults-BY3hQ6aD.js.map +0 -1
|
@@ -11,9 +11,9 @@ import {BORDER, MONO} from '../../ui/tokens'
|
|
|
11
11
|
|
|
12
12
|
/** Durées proposées. Au-delà d'un mois, un lien oublié traîne trop longtemps. */
|
|
13
13
|
const DURATIONS = [
|
|
14
|
-
{days: 1, label: '1
|
|
15
|
-
{days: 7, label: '7
|
|
16
|
-
{days: 30, label: '30
|
|
14
|
+
{days: 1, label: '1 day'},
|
|
15
|
+
{days: 7, label: '7 days'},
|
|
16
|
+
{days: 30, label: '30 days'},
|
|
17
17
|
]
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -90,8 +90,8 @@ export function SharePreview() {
|
|
|
90
90
|
fontSize={1}
|
|
91
91
|
padding={2}
|
|
92
92
|
icon={ShareIcon}
|
|
93
|
-
text="
|
|
94
|
-
title="
|
|
93
|
+
text="Share preview"
|
|
94
|
+
title="Create a link anyone can open, without an account"
|
|
95
95
|
onClick={toggle}
|
|
96
96
|
/>
|
|
97
97
|
)}
|
|
@@ -104,24 +104,23 @@ export function SharePreview() {
|
|
|
104
104
|
{isProduction ? (
|
|
105
105
|
<Stack gap={3}>
|
|
106
106
|
<Text size={1} weight="semibold">
|
|
107
|
-
|
|
107
|
+
Nothing to share on the public site
|
|
108
108
|
</Text>
|
|
109
109
|
<Text size={0} muted>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
visite ordinaire.
|
|
110
|
+
Production never shows drafts: that is what protects your unpublished
|
|
111
|
+
content. A link to it would show nothing more than an ordinary visit.
|
|
113
112
|
</Text>
|
|
114
113
|
<Text size={0} muted>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
First choose a <b>preview</b> in the environment picker on the left: a
|
|
115
|
+
declared staging environment, or the address of a branch deployment that you
|
|
116
|
+
paste there.
|
|
118
117
|
</Text>
|
|
119
118
|
</Stack>
|
|
120
119
|
) : (
|
|
121
120
|
<>
|
|
122
121
|
<Text size={0} muted>
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
A link that opens <b>{environment?.label ?? 'the site'}</b> and lets you switch
|
|
123
|
+
between drafts and published content there. Whoever has it needs no account.
|
|
125
124
|
</Text>
|
|
126
125
|
|
|
127
126
|
{!link && (
|
|
@@ -130,7 +129,7 @@ export function SharePreview() {
|
|
|
130
129
|
fontSize={1}
|
|
131
130
|
padding={2}
|
|
132
131
|
radius={2}
|
|
133
|
-
placeholder="
|
|
132
|
+
placeholder="What is this link for? (optional)"
|
|
134
133
|
value={label}
|
|
135
134
|
onChange={(event) => setLabel(event.currentTarget.value)}
|
|
136
135
|
/>
|
|
@@ -154,7 +153,7 @@ export function SharePreview() {
|
|
|
154
153
|
<Flex align="center" gap={2}>
|
|
155
154
|
<Spinner muted />
|
|
156
155
|
<Text size={1} muted>
|
|
157
|
-
|
|
156
|
+
Creating…
|
|
158
157
|
</Text>
|
|
159
158
|
</Flex>
|
|
160
159
|
)}
|
|
@@ -188,14 +187,14 @@ export function SharePreview() {
|
|
|
188
187
|
fontSize={1}
|
|
189
188
|
padding={2}
|
|
190
189
|
icon={copied ? CheckmarkIcon : ShareIcon}
|
|
191
|
-
text={copied ? '
|
|
190
|
+
text={copied ? 'Copied' : 'Copy link'}
|
|
192
191
|
onClick={copy}
|
|
193
192
|
/>
|
|
194
193
|
<Button
|
|
195
194
|
mode="bleed"
|
|
196
195
|
fontSize={1}
|
|
197
196
|
padding={2}
|
|
198
|
-
text="
|
|
197
|
+
text="Another one"
|
|
199
198
|
onClick={() => {
|
|
200
199
|
setLink(null)
|
|
201
200
|
setCopied(false)
|
|
@@ -205,8 +204,8 @@ export function SharePreview() {
|
|
|
205
204
|
|
|
206
205
|
{expiresAt && (
|
|
207
206
|
<Text size={0} muted>
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
Valid until {new Date(expiresAt).toLocaleDateString('en-US')}. Can be revoked
|
|
208
|
+
at any time by NoCode Factory.
|
|
210
209
|
</Text>
|
|
211
210
|
)}
|
|
212
211
|
</Stack>
|
|
@@ -30,7 +30,7 @@ export function TagCell(props: TagCellProps) {
|
|
|
30
30
|
gap={2}
|
|
31
31
|
onClick={toggle}
|
|
32
32
|
style={{...CELL, cursor: 'pointer'}}
|
|
33
|
-
title="
|
|
33
|
+
title="Change tag"
|
|
34
34
|
>
|
|
35
35
|
{current ? (
|
|
36
36
|
<>
|
|
@@ -58,7 +58,7 @@ export function TagCell(props: TagCellProps) {
|
|
|
58
58
|
{({close}) => (
|
|
59
59
|
<Stack gap={0}>
|
|
60
60
|
<TagOption
|
|
61
|
-
label="
|
|
61
|
+
label="No tag"
|
|
62
62
|
selected={!current}
|
|
63
63
|
onClick={() => {
|
|
64
64
|
onChange(null)
|
|
@@ -6,9 +6,9 @@ import {CircleIcon} from '@sanity/icons/Circle'
|
|
|
6
6
|
export type PagesView = 'list' | 'tree' | 'brain'
|
|
7
7
|
|
|
8
8
|
const TABS: {value: PagesView; label: string; icon: typeof DocumentsIcon}[] = [
|
|
9
|
-
{value: 'list', label: '
|
|
10
|
-
{value: 'tree', label: '
|
|
11
|
-
{value: 'brain', label: '
|
|
9
|
+
{value: 'list', label: 'List', icon: DocumentsIcon},
|
|
10
|
+
{value: 'tree', label: 'Tree', icon: ProjectsIcon},
|
|
11
|
+
{value: 'brain', label: 'Graph', icon: CircleIcon},
|
|
12
12
|
]
|
|
13
13
|
|
|
14
14
|
export interface ViewTabsProps {
|
|
@@ -23,7 +23,7 @@ export interface ViewTabsProps {
|
|
|
23
23
|
*/
|
|
24
24
|
export function ViewTabs(props: ViewTabsProps) {
|
|
25
25
|
return (
|
|
26
|
-
<Flex gap={1} role="tablist" aria-label="
|
|
26
|
+
<Flex gap={1} role="tablist" aria-label="Pages view">
|
|
27
27
|
{TABS.map((tab) => {
|
|
28
28
|
const active = props.view === tab.value
|
|
29
29
|
return (
|
|
@@ -467,7 +467,7 @@ function Board(props: BoardViewProps) {
|
|
|
467
467
|
<Flex align="center" justify="center" padding={5} gap={3}>
|
|
468
468
|
<Spinner muted />
|
|
469
469
|
<Text size={1} muted>
|
|
470
|
-
|
|
470
|
+
Analyzing links between pages…
|
|
471
471
|
</Text>
|
|
472
472
|
</Flex>
|
|
473
473
|
)
|
|
@@ -510,7 +510,7 @@ function Board(props: BoardViewProps) {
|
|
|
510
510
|
value={tagFilter}
|
|
511
511
|
onChange={(event) => setTagFilter(event.currentTarget.value)}
|
|
512
512
|
>
|
|
513
|
-
<option value="">
|
|
513
|
+
<option value="">All tags</option>
|
|
514
514
|
{config.boardTags.map((tag) => (
|
|
515
515
|
<option key={tag.id} value={tag.id}>
|
|
516
516
|
{tag.label}
|
|
@@ -528,14 +528,14 @@ function Board(props: BoardViewProps) {
|
|
|
528
528
|
/>
|
|
529
529
|
<Button
|
|
530
530
|
icon={AddIcon}
|
|
531
|
-
text="
|
|
531
|
+
text="Shape"
|
|
532
532
|
mode="ghost"
|
|
533
533
|
fontSize={1}
|
|
534
534
|
padding={2}
|
|
535
535
|
onClick={() => addAnnotation('rect', screenToFlowPosition({x: 300, y: 320}))}
|
|
536
536
|
/>
|
|
537
537
|
<Button
|
|
538
|
-
text={arranging ? '
|
|
538
|
+
text={arranging ? 'Arranging…' : 'Auto arrange'}
|
|
539
539
|
mode="ghost"
|
|
540
540
|
fontSize={1}
|
|
541
541
|
padding={2}
|
|
@@ -543,22 +543,22 @@ function Board(props: BoardViewProps) {
|
|
|
543
543
|
onClick={() => void rearrange()}
|
|
544
544
|
/>
|
|
545
545
|
<Text size={0} muted>
|
|
546
|
-
{visibleNodes.length} pages · {graph.edges.length}
|
|
547
|
-
{graph.orphans.length > 0 ? ` · ${graph.orphans.length}
|
|
546
|
+
{visibleNodes.length} pages · {graph.edges.length} links
|
|
547
|
+
{graph.orphans.length > 0 ? ` · ${graph.orphans.length} without any link` : ''}
|
|
548
548
|
</Text>
|
|
549
549
|
</Flex>
|
|
550
550
|
|
|
551
551
|
{saveError && (
|
|
552
552
|
<Card padding={3} radius={2} tone="critical">
|
|
553
|
-
<Text size={1}>
|
|
553
|
+
<Text size={1}>The layout could not be saved: {saveError.message}</Text>
|
|
554
554
|
</Card>
|
|
555
555
|
)}
|
|
556
556
|
|
|
557
557
|
{graph.duplicatePaths.length > 0 && (
|
|
558
558
|
<Card padding={3} radius={2} tone="caution">
|
|
559
559
|
<Text size={1}>
|
|
560
|
-
|
|
561
|
-
|
|
560
|
+
Several pages share the same path ({graph.duplicatePaths.join(', ')}).
|
|
561
|
+
A link to this path can only point to one of them.
|
|
562
562
|
</Text>
|
|
563
563
|
</Card>
|
|
564
564
|
)}
|
|
@@ -642,8 +642,8 @@ function Board(props: BoardViewProps) {
|
|
|
642
642
|
</Flex>
|
|
643
643
|
))}
|
|
644
644
|
<Text size={0} muted>
|
|
645
|
-
{legend.length === 0 ? '
|
|
646
|
-
|
|
645
|
+
{legend.length === 0 ? 'Color derived from the entered value · ' : '· '}
|
|
646
|
+
click for details, double-click to open the page
|
|
647
647
|
</Text>
|
|
648
648
|
</Flex>
|
|
649
649
|
</Stack>
|
|
@@ -223,10 +223,10 @@ function TreeNode(props: NodeProps<PageFlowNode> & {data: PageNodeData}) {
|
|
|
223
223
|
<Flex align="center" justify="center" style={{height: '100%'}}>
|
|
224
224
|
<Text size={0} muted>
|
|
225
225
|
{thumbnailFailed
|
|
226
|
-
? '
|
|
226
|
+
? 'Screenshot not generated'
|
|
227
227
|
: siteUrl
|
|
228
|
-
? '
|
|
229
|
-
: '
|
|
228
|
+
? 'Hover to preview'
|
|
229
|
+
: 'No preview'}
|
|
230
230
|
</Text>
|
|
231
231
|
</Flex>
|
|
232
232
|
)}
|
|
@@ -259,7 +259,7 @@ function TreeNode(props: NodeProps<PageFlowNode> & {data: PageNodeData}) {
|
|
|
259
259
|
textOverflow="ellipsis"
|
|
260
260
|
style={{fontSize: Math.round(11 * textScale), lineHeight: 1.3}}
|
|
261
261
|
>
|
|
262
|
-
{tags.find((t) => t.id === tag)?.label ?? '
|
|
262
|
+
{tags.find((t) => t.id === tag)?.label ?? 'No tag'}
|
|
263
263
|
</Text>
|
|
264
264
|
) : (
|
|
265
265
|
<Flex gap={2} align="center">
|
|
@@ -272,7 +272,7 @@ function TreeNode(props: NodeProps<PageFlowNode> & {data: PageNodeData}) {
|
|
|
272
272
|
value={tag ?? ''}
|
|
273
273
|
onChange={(event) => onTag(props.id, event.currentTarget.value || null)}
|
|
274
274
|
>
|
|
275
|
-
<option value="">
|
|
275
|
+
<option value="">No tag</option>
|
|
276
276
|
{tags.map((option) => (
|
|
277
277
|
<option key={option.id} value={option.id}>
|
|
278
278
|
{option.label}
|
|
@@ -83,7 +83,7 @@ export function PagePanel(props: PagePanelProps) {
|
|
|
83
83
|
padding={1}
|
|
84
84
|
fontSize={0}
|
|
85
85
|
icon={CloseIcon}
|
|
86
|
-
aria-label="
|
|
86
|
+
aria-label="Close"
|
|
87
87
|
onClick={onClose}
|
|
88
88
|
/>
|
|
89
89
|
</Flex>
|
|
@@ -112,7 +112,7 @@ export function PagePanel(props: PagePanelProps) {
|
|
|
112
112
|
) : (
|
|
113
113
|
<Flex align="center" justify="center" style={{height: '100%'}} padding={3}>
|
|
114
114
|
<Text size={0} muted align="center">
|
|
115
|
-
{failed ? '
|
|
115
|
+
{failed ? 'Screenshot not generated' : 'No screenshot'}
|
|
116
116
|
</Text>
|
|
117
117
|
</Flex>
|
|
118
118
|
)}
|
|
@@ -145,19 +145,19 @@ export function PagePanel(props: PagePanelProps) {
|
|
|
145
145
|
</Text>
|
|
146
146
|
|
|
147
147
|
<Text size={0} muted>
|
|
148
|
-
{incoming}
|
|
148
|
+
{incoming} incoming link(s) · {outgoing} outgoing
|
|
149
149
|
</Text>
|
|
150
150
|
|
|
151
151
|
<Stack gap={2}>
|
|
152
152
|
<Text size={0} weight="semibold" muted>
|
|
153
|
-
|
|
153
|
+
Tag
|
|
154
154
|
</Text>
|
|
155
155
|
<Select
|
|
156
156
|
fontSize={1}
|
|
157
157
|
value={tag ?? ''}
|
|
158
158
|
onChange={(event) => onTag(row.id, event.currentTarget.value || null)}
|
|
159
159
|
>
|
|
160
|
-
<option value="">
|
|
160
|
+
<option value="">No tag</option>
|
|
161
161
|
{tags.map((option) => (
|
|
162
162
|
<option key={option.id} value={option.id}>
|
|
163
163
|
{option.label}
|
|
@@ -169,7 +169,7 @@ export function PagePanel(props: PagePanelProps) {
|
|
|
169
169
|
{columns.length > 0 && (
|
|
170
170
|
<Stack gap={2}>
|
|
171
171
|
<Text size={0} weight="semibold" muted>
|
|
172
|
-
|
|
172
|
+
Internal management
|
|
173
173
|
</Text>
|
|
174
174
|
{columns.map((column) => (
|
|
175
175
|
<Flex key={column.id} align="center" gap={2}>
|
|
@@ -199,8 +199,8 @@ export function PagePanel(props: PagePanelProps) {
|
|
|
199
199
|
mode="default"
|
|
200
200
|
fontSize={1}
|
|
201
201
|
padding={2}
|
|
202
|
-
text="
|
|
203
|
-
title="
|
|
202
|
+
text="Open page"
|
|
203
|
+
title="Opens in Presentation"
|
|
204
204
|
onClick={onOpen}
|
|
205
205
|
/>
|
|
206
206
|
<IntentLink
|
|
@@ -208,7 +208,7 @@ export function PagePanel(props: PagePanelProps) {
|
|
|
208
208
|
params={{id: row.id, type: row.type}}
|
|
209
209
|
style={{textDecoration: 'none'}}
|
|
210
210
|
>
|
|
211
|
-
<Button mode="ghost" fontSize={1} padding={2} text="
|
|
211
|
+
<Button mode="ghost" fontSize={1} padding={2} text="Edit" as="span" />
|
|
212
212
|
</IntentLink>
|
|
213
213
|
{siteUrl && (
|
|
214
214
|
<Button
|
|
@@ -228,7 +228,7 @@ export function PagePanel(props: PagePanelProps) {
|
|
|
228
228
|
icon={LaunchIcon}
|
|
229
229
|
// Le libellé nomme l'environnement dès qu'il y a un choix :
|
|
230
230
|
// « Voir en ligne » serait faux en pointant une recette.
|
|
231
|
-
text={environments.length > 1 ? (environment?.label ?? '
|
|
231
|
+
text={environments.length > 1 ? (environment?.label ?? 'View') : 'View live'}
|
|
232
232
|
title={siteUrl}
|
|
233
233
|
/>
|
|
234
234
|
)}
|
|
@@ -82,7 +82,7 @@ function AnnotationNodeComponent(props: NodeProps<AnnotationFlowNode>) {
|
|
|
82
82
|
overflow: 'hidden',
|
|
83
83
|
}}
|
|
84
84
|
>
|
|
85
|
-
{annotation.text || 'Double-
|
|
85
|
+
{annotation.text || 'Double-click to write'}
|
|
86
86
|
</Box>
|
|
87
87
|
)}
|
|
88
88
|
|
|
@@ -112,8 +112,8 @@ function AnnotationNodeComponent(props: NodeProps<AnnotationFlowNode>) {
|
|
|
112
112
|
fontSize={0}
|
|
113
113
|
icon={TrashIcon}
|
|
114
114
|
tone="critical"
|
|
115
|
-
title="
|
|
116
|
-
aria-label="
|
|
115
|
+
title="Delete annotation"
|
|
116
|
+
aria-label="Delete annotation"
|
|
117
117
|
onClick={() => onRemove(annotation.id)}
|
|
118
118
|
/>
|
|
119
119
|
</Flex>
|
package/src/ui/ActorName.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import {useUser} from 'sanity'
|
|
|
10
10
|
*/
|
|
11
11
|
export function ActorName(props: {actorId: string | null; actorName: string | null}) {
|
|
12
12
|
const [user] = useUser(props.actorId ?? '')
|
|
13
|
-
const label = props.actorName || user?.displayName || (props.actorId ? '
|
|
13
|
+
const label = props.actorName || user?.displayName || (props.actorId ? 'Unknown account' : '—')
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
16
|
<Text size={0} muted textOverflow="ellipsis" title={props.actorId ?? undefined}>
|
package/src/ui/ConfigIssues.tsx
CHANGED
|
@@ -19,8 +19,8 @@ export function ConfigIssues(props: {issues: ConfigIssue[]; toolTitle: string})
|
|
|
19
19
|
<Stack gap={4}>
|
|
20
20
|
<Text weight="semibold">
|
|
21
21
|
{blocking
|
|
22
|
-
?
|
|
23
|
-
:
|
|
22
|
+
? `"${toolTitle}" is disabled: the ncfKit() configuration is incomplete.`
|
|
23
|
+
: `"${toolTitle}" is running in degraded mode.`}
|
|
24
24
|
</Text>
|
|
25
25
|
<Stack gap={3} as="ul">
|
|
26
26
|
{issues.map((issue) => (
|
|
@@ -31,7 +31,7 @@ export function ConfigIssues(props: {issues: ConfigIssue[]; toolTitle: string})
|
|
|
31
31
|
))}
|
|
32
32
|
</Stack>
|
|
33
33
|
<Text size={1} muted>
|
|
34
|
-
|
|
34
|
+
Fix it in the ncfKit() call in sanity.config.ts.
|
|
35
35
|
</Text>
|
|
36
36
|
</Stack>
|
|
37
37
|
</Card>
|
|
@@ -22,15 +22,15 @@ export function PreviewOriginsNotice() {
|
|
|
22
22
|
<Container width={2}>
|
|
23
23
|
<Card padding={4} radius={3} shadow={1} tone="caution">
|
|
24
24
|
<Stack gap={3}>
|
|
25
|
-
<Text weight="semibold">
|
|
25
|
+
<Text weight="semibold">Preview not interactive on {missing.length > 1 ? 'these environments' : 'this environment'}</Text>
|
|
26
26
|
<Stack gap={2}>
|
|
27
27
|
{missing.map((origin) => (
|
|
28
28
|
<InlineCode key={origin}>{origin}</InlineCode>
|
|
29
29
|
))}
|
|
30
30
|
</Stack>
|
|
31
31
|
<Text size={1}>
|
|
32
|
-
Presentation
|
|
33
|
-
|
|
32
|
+
Presentation does not allow {missing.length > 1 ? 'these origins' : 'this origin'}: the page is shown without visual editing. In sanity.config.ts,
|
|
33
|
+
pass <InlineCode>allowOrigins: ncfAllowedOrigins(options)</InlineCode> to presentationTool.
|
|
34
34
|
</Text>
|
|
35
35
|
</Stack>
|
|
36
36
|
</Card>
|
|
@@ -25,10 +25,10 @@ export function ProjectStatusNotice(props: {registration: Registration | null})
|
|
|
25
25
|
<Card padding={3} radius={2} tone="caution">
|
|
26
26
|
<Stack gap={2}>
|
|
27
27
|
<Text size={1} weight="semibold">
|
|
28
|
-
|
|
28
|
+
The log is not enabled for this project yet.
|
|
29
29
|
</Text>
|
|
30
30
|
<Text size={0} muted>
|
|
31
|
-
NoCode Factory
|
|
31
|
+
NoCode Factory enables it by running <code>npx ncf-kit setup</code> in the studio folder.
|
|
32
32
|
</Text>
|
|
33
33
|
</Stack>
|
|
34
34
|
</Card>
|
|
@@ -37,10 +37,10 @@ export function ProjectStatusNotice(props: {registration: Registration | null})
|
|
|
37
37
|
|
|
38
38
|
const message =
|
|
39
39
|
status === 'expired'
|
|
40
|
-
? "
|
|
40
|
+
? "Access to this project has expired."
|
|
41
41
|
: status === 'suspended'
|
|
42
|
-
? '
|
|
43
|
-
: "
|
|
42
|
+
? 'This project is suspended.'
|
|
43
|
+
: "This project is no longer authorized."
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
46
|
<Card padding={3} radius={2} tone="caution">
|
|
@@ -49,8 +49,8 @@ export function ProjectStatusNotice(props: {registration: Registration | null})
|
|
|
49
49
|
{message}
|
|
50
50
|
</Text>
|
|
51
51
|
<Text size={0} muted>
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
The tools remain usable, but the change log is stopped.
|
|
53
|
+
Contact NoCode Factory to restore the service.
|
|
54
54
|
</Text>
|
|
55
55
|
</Stack>
|
|
56
56
|
</Card>
|
package/src/ui/QueryError.tsx
CHANGED
|
@@ -5,10 +5,10 @@ export function QueryError(props: {error: Error; onRetry: () => void}) {
|
|
|
5
5
|
return (
|
|
6
6
|
<Card padding={4} radius={3} shadow={1} tone="critical">
|
|
7
7
|
<Stack gap={4}>
|
|
8
|
-
<Text weight="semibold">
|
|
8
|
+
<Text weight="semibold">The query failed.</Text>
|
|
9
9
|
<Text size={1}>{props.error.message}</Text>
|
|
10
10
|
<div>
|
|
11
|
-
<Button text="
|
|
11
|
+
<Button text="Retry" mode="ghost" onClick={props.onRetry} />
|
|
12
12
|
</div>
|
|
13
13
|
</Stack>
|
|
14
14
|
</Card>
|
|
@@ -12,8 +12,8 @@ export function ToolPlaceholder(props: {title: string; phase: string; children?:
|
|
|
12
12
|
{title}
|
|
13
13
|
</Text>
|
|
14
14
|
<Text size={1} muted>
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
Coming in {phase}. The plugin foundation is in place: configuration read, validated, and
|
|
16
|
+
tool mounted in the Studio.
|
|
17
17
|
</Text>
|
|
18
18
|
{children}
|
|
19
19
|
</Stack>
|
package/src/ui/formatDate.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -61,7 +61,7 @@ export interface PreviewBannerProps {
|
|
|
61
61
|
* `isPreviewSite()`.
|
|
62
62
|
*/
|
|
63
63
|
export function NcfPreviewBanner(props: PreviewBannerProps) {
|
|
64
|
-
const {isDraft, togglePath = '/api/draft-mode/toggle', label = '
|
|
64
|
+
const {isDraft, togglePath = '/api/draft-mode/toggle', label = 'Preview'} = props
|
|
65
65
|
const pathname = usePathname()
|
|
66
66
|
// Clé de préversion mémorisée par le garde (absente avec une session Presentation).
|
|
67
67
|
const grant = useSyncExternalStore(noSubscribe, readGrant, () => null)
|
|
@@ -110,32 +110,32 @@ export function NcfPreviewBanner(props: PreviewBannerProps) {
|
|
|
110
110
|
</span>
|
|
111
111
|
|
|
112
112
|
<span aria-hidden style={divider} />
|
|
113
|
-
<span style={{opacity: 0.75}}>
|
|
113
|
+
<span style={{opacity: 0.75}}>Data</span>
|
|
114
114
|
|
|
115
|
-
<span role="group" aria-label="
|
|
115
|
+
<span role="group" aria-label="Displayed data" style={{display: 'inline-flex', gap: 2}}>
|
|
116
116
|
<a
|
|
117
117
|
href={href(true)}
|
|
118
|
-
title="
|
|
118
|
+
title="What will go live after publishing"
|
|
119
119
|
aria-current={isDraft ? 'true' : undefined}
|
|
120
120
|
style={isDraft ? segmentOn : segmentOff}
|
|
121
121
|
>
|
|
122
|
-
|
|
122
|
+
Drafts
|
|
123
123
|
</a>
|
|
124
124
|
<a
|
|
125
125
|
href={href(false)}
|
|
126
|
-
title="
|
|
126
|
+
title="What the public sees today"
|
|
127
127
|
aria-current={isDraft ? undefined : 'true'}
|
|
128
128
|
style={isDraft ? segmentOff : segmentOn}
|
|
129
129
|
>
|
|
130
|
-
|
|
130
|
+
Published
|
|
131
131
|
</a>
|
|
132
132
|
</span>
|
|
133
133
|
|
|
134
134
|
{grant && (
|
|
135
135
|
<>
|
|
136
136
|
<span aria-hidden style={divider} />
|
|
137
|
-
<button type="button" onClick={share} title="
|
|
138
|
-
{copied ? '
|
|
137
|
+
<button type="button" onClick={share} title="Copy the address of this page, including the preview key" style={shareButton}>
|
|
138
|
+
{copied ? 'Link copied' : 'Copy link'}
|
|
139
139
|
</button>
|
|
140
140
|
</>
|
|
141
141
|
)}
|
|
@@ -36,7 +36,7 @@ export function ncfDraftModeToggle(options: DraftModeToggleOptions = {}) {
|
|
|
36
36
|
if (isProductionSite()) {
|
|
37
37
|
;(await draftMode()).disable()
|
|
38
38
|
return NextResponse.json(
|
|
39
|
-
{error: '
|
|
39
|
+
{error: 'Draft mode is disabled in production.'},
|
|
40
40
|
{status: 403},
|
|
41
41
|
)
|
|
42
42
|
}
|
package/src/web/previewGrant.ts
CHANGED
|
@@ -193,14 +193,14 @@ function refuse(request: NextRequest): NextResponse {
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
const PAGE = `<!doctype html>
|
|
196
|
-
<html lang="
|
|
196
|
+
<html lang="en"><head><meta charset="utf-8">
|
|
197
197
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
198
198
|
<meta name="robots" content="noindex">
|
|
199
|
-
<title>
|
|
199
|
+
<title>Private preview</title></head>
|
|
200
200
|
<body style="margin:0;min-height:100vh;display:grid;place-items:center;background:#faf9f7;color:#1c1917;font:16px/1.6 ui-sans-serif,system-ui,-apple-system,Segoe UI,sans-serif">
|
|
201
201
|
<main style="max-width:30rem;padding:2rem;text-align:center">
|
|
202
202
|
<p style="display:inline-flex;align-items:center;gap:.5rem;margin:0 0 1.25rem;padding:.3rem .75rem;border-radius:999px;background:#fef3c7;color:#451a03;font-size:.8125rem;font-weight:500">
|
|
203
|
-
<span style="width:7px;height:7px;border-radius:50%;background:#d97706"></span>
|
|
204
|
-
<h1 style="margin:0 0 .75rem;font-size:1.375rem;font-weight:600">
|
|
205
|
-
<p style="margin:0;color:#57534e">
|
|
203
|
+
<span style="width:7px;height:7px;border-radius:50%;background:#d97706"></span>Preview</p>
|
|
204
|
+
<h1 style="margin:0 0 .75rem;font-size:1.375rem;font-weight:600">This version of the site is private</h1>
|
|
205
|
+
<p style="margin:0;color:#57534e">It is used to review content before it goes live. To access it, ask your NoCode Factory contact for a share link.</p>
|
|
206
206
|
</main></body></html>`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"componentDefaults-BY3hQ6aD.js","names":[],"sources":["../src/schema/componentDefaults.ts"],"sourcesContent":["import {defineField, defineType, type Rule} from 'sanity'\n\n/**\n * VALEURS PAR DÉFAUT DES COMPOSANTS, côté Studio.\n *\n * Un document (un par langue) avec un bloc par composant de la bibliothèque,\n * GÉNÉRÉ depuis les schémas des sections : une section ajoutée y apparaît sans\n * rien faire. Une instance dont un champ est vide affiche la valeur par défaut ;\n * un champ rempli (override) n'est jamais écrasé. Côté site :\n * `@nocode-factory/sanity-kit/web/defaults`. Dans le Studio, l'onglet Composants\n * ouvre chaque composant (rendu réel + réglages), et une pastille bleue marque\n * chaque champ d'instance qui diffère de la valeur par défaut.\n *\n * Deux règles pour les champs de section, qui en découlent :\n * - jamais d'`initialValue` (ce serait un override involontaire) ;\n * - « obligatoire » = `requiredUnlessDefault`.\n */\n\ntype FieldDef = {name: string; type: string; validation?: unknown; initialValue?: unknown; fields?: FieldDef[]; of?: FieldDef[]; [k: string]: unknown}\ntype SectionDef = {name: string; title?: string; fields: FieldDef[]}\n\nexport const DEFAULT_COMPONENT_DEFAULTS_TYPE = 'componentDefaults'\n\n/** Nom du champ d'un composant dans le document des valeurs par défaut : `section.cta` -> `cta`. */\nexport function defaultsFieldName(type: string, namespace = 'section.'): string {\n return type.startsWith(namespace) ? type.slice(namespace.length) : type\n}\n\n// Dans les valeurs par défaut, rien n'est obligatoire et rien n'est prérempli.\nconst relax = (f: FieldDef): FieldDef => {\n const {validation: _v, initialValue: _i, ...rest} = f\n return {\n ...rest,\n ...(rest.fields ? {fields: rest.fields.map(relax)} : {}),\n ...(rest.of ? {of: rest.of.map(relax)} : {}),\n }\n}\n\n/** Document « Composants : valeurs par défaut », généré depuis les sections. */\nexport function defineComponentDefaults(options: {sections: readonly unknown[]; name?: string; title?: string; namespace?: string}) {\n const {name = DEFAULT_COMPONENT_DEFAULTS_TYPE, title = '🧩 Composants : valeurs par défaut', namespace = 'section.'} = options\n return defineType({\n name,\n title,\n type: 'document',\n description:\n 'Valeurs appliquées à chaque instance d\\'un composant dont le champ est vide. Un champ rempli dans une instance reste prioritaire (override).',\n fields: (options.sections as SectionDef[]).map((t) =>\n defineField({\n name: defaultsFieldName(t.name, namespace),\n title: t.title || t.name,\n type: 'object',\n description: 'Valeurs par défaut de ce composant. Vide = valeur du design system.',\n options: {collapsible: true, collapsed: true},\n fields: t.fields.map(relax) as never,\n }),\n ),\n preview: {prepare: () => ({title: title.replace(/^\\S+\\s/, '')})},\n })\n}\n\nconst isEmpty = (v: unknown) => v === undefined || v === null || v === '' || (Array.isArray(v) && v.length === 0)\n\n/**\n * Règle « obligatoire SAUF si le composant a une valeur par défaut » pour un autre\n * type de document des valeurs par défaut ou un autre espace de noms.\n * `validation: requiredUnlessDefaultFor({type: 'mesDefauts'})`\n */\nexport function requiredUnlessDefaultFor(options: {type?: string; namespace?: string} = {}) {\n const {type: defaultsType = DEFAULT_COMPONENT_DEFAULTS_TYPE, namespace = 'section.'} = options\n return <R>(rule: R): R =>\n (rule as unknown as Rule).custom(async (value, context) => {\n if (!isEmpty(value)) return true\n const type = (context.parent as {_type?: string} | undefined)?._type\n const field = context.path?.[context.path.length - 1]\n const name = type ? defaultsFieldName(type, namespace) : ''\n if (!type?.startsWith(namespace) || typeof field !== 'string' || !/^\\w+$/.test(name) || !/^\\w+$/.test(field)) return 'Obligatoire.'\n const language = (context.document as {language?: string} | undefined)?.language ?? null\n const inherited = await context\n .getClient({apiVersion: '2024-10-01'})\n .fetch(\n `*[_type == $defaultsType && !(_id in path(\"drafts.**\")) && ($language == null || language == $language)][0].${name}.${field}`,\n {defaultsType, language},\n )\n return isEmpty(inherited) ? 'Obligatoire (ou à définir dans Composants > valeurs par défaut).' : true\n }) as unknown as R\n}\n\n/**\n * Champ de section obligatoire, SAUF si le composant a une valeur par défaut\n * pour ce champ (elle s'affichera). Tout type de champ.\n * `validation: requiredUnlessDefault`\n */\nexport const requiredUnlessDefault: <R>(rule: R) => R = requiredUnlessDefaultFor()\n\n/**\n * Presentation : la page qui rend un composant seul (par défaut\n * `/design-system/composant`) a pour document principal les valeurs par défaut.\n * Rendu réel et réglages côte à côte, en direct.\n * `presentationTool({resolve: {mainDocuments: defineDocuments([componentDefaultsMainDocument({language: 'fr'})])}})`\n */\nexport function componentDefaultsMainDocument(options: {language?: string; route?: string; type?: string} = {}): {route: string; filter: string} {\n const {language, route = '/design-system/composant', type = DEFAULT_COMPONENT_DEFAULTS_TYPE} = options\n const safeLang = language && /^[a-z]{2}(-[A-Za-z]{2})?$/.test(language) ? language : null\n return {route, filter: `_type == \"${type}\"${safeLang ? ` && language == \"${safeLang}\"` : ''}`}\n}\n\n/**\n * Presentation : les pages du design system ont pour document principal les valeurs\n * par défaut des composants. `/design-system` (toute la bibliothèque) et\n * `/design-system/composant` (un composant seul) : cliquer un composant ouvre ses\n * réglages globaux, et un style changé change le composant partout où il n'est\n * pas surchargé.\n * `presentationTool({resolve: {mainDocuments: defineDocuments(componentDefaultsMainDocuments({language: 'fr'}))}})`\n */\nexport function componentDefaultsMainDocuments(\n options: {language?: string; type?: string; routes?: string[]} = {},\n): {route: string; filter: string}[] {\n const {routes = ['/design-system/composant', '/design-system'], ...rest} = options\n return routes.map((route) => componentDefaultsMainDocument({...rest, route}))\n}\n"],"mappings":";AAqBA,MAAa,kCAAkC;;AAG/C,SAAgB,kBAAkB,MAAc,YAAY,YAAoB;CAC9E,OAAO,KAAK,WAAW,SAAS,IAAI,KAAK,MAAM,UAAU,MAAM,IAAI;AACrE;AAGA,MAAM,SAAS,MAA0B;CACvC,IAAM,EAAC,YAAY,IAAI,cAAc,IAAI,GAAG,SAAQ;CACpD,OAAO;EACL,GAAG;EACH,GAAI,KAAK,SAAS,EAAC,QAAQ,KAAK,OAAO,IAAI,KAAK,EAAC,IAAI,CAAC;EACtD,GAAI,KAAK,KAAK,EAAC,IAAI,KAAK,GAAG,IAAI,KAAK,EAAC,IAAI,CAAC;CAC5C;AACF;;AAGA,SAAgB,wBAAwB,SAA4F;CAClI,IAAM,EAAC,OAAO,iCAAiC,QAAQ,sCAAsC,YAAY,eAAc;CACvH,OAAO,WAAW;EAChB;EACA;EACA,MAAM;EACN,aACE;EACF,QAAS,QAAQ,SAA0B,KAAK,MAC9C,YAAY;GACV,MAAM,kBAAkB,EAAE,MAAM,SAAS;GACzC,OAAO,EAAE,SAAS,EAAE;GACpB,MAAM;GACN,aAAa;GACb,SAAS;IAAC,aAAa;IAAM,WAAW;GAAI;GAC5C,QAAQ,EAAE,OAAO,IAAI,KAAK;EAC5B,CAAC,CACH;EACA,SAAS,EAAC,gBAAgB,EAAC,OAAO,MAAM,QAAQ,UAAU,EAAE,EAAC,GAAE;CACjE,CAAC;AACH;AAEA,MAAM,WAAW,MAAe,KAAyB,QAAQ,MAAM,MAAO,MAAM,QAAQ,CAAC,KAAK,EAAE,WAAW;;;;;;AAO/G,SAAgB,yBAAyB,UAA+C,CAAC,GAAG;CAC1F,IAAM,EAAC,MAAM,eAAe,iCAAiC,YAAY,eAAc;CACvF,QAAW,SACR,KAAyB,OAAO,OAAO,OAAO,YAAY;EACzD,IAAI,CAAC,QAAQ,KAAK,GAAG,OAAO;EAC5B,IAAM,OAAQ,QAAQ,QAAyC,OACzD,QAAQ,QAAQ,OAAO,QAAQ,KAAK,SAAS,IAC7C,OAAO,OAAO,kBAAkB,MAAM,SAAS,IAAI;EACzD,IAAI,CAAC,MAAM,WAAW,SAAS,KAAK,OAAO,SAAU,YAAY,CAAC,QAAQ,KAAK,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,GAAG,OAAO;EACrH,IAAM,WAAY,QAAQ,UAA8C,YAAY,MAC9E,YAAY,MAAM,QACrB,UAAU,EAAC,YAAY,aAAY,CAAC,CAAC,CACrC,MACC,+GAA+G,KAAK,GAAG,SACvH;GAAC;GAAc;EAAQ,CACzB;EACF,OAAO,SAAQ,SAAS,KAAI;CAC9B,CAAC;AACL;;;;;;AAOA,MAAa,wBAA2C,yBAAyB;;;;;;;AAQjF,SAAgB,8BAA8B,UAA8D,CAAC,GAAoC;CAC/I,IAAM,EAAC,UAAU,QAAQ,4BAA4B,OAAO,oCAAmC,SACzF,WAAW,YAAY,4BAA4B,KAAK,QAAQ,IAAI,WAAW;CACrF,OAAO;EAAC;EAAO,QAAQ,aAAa,KAAK,GAAG,WAAW,oBAAoB,SAAS,KAAK;CAAI;AAC/F;;;;;;;;;AAUA,SAAgB,+BACd,UAAiE,CAAC,GAC/B;CACnC,IAAM,EAAC,SAAS,CAAC,4BAA4B,gBAAgB,GAAG,GAAG,SAAQ;CAC3E,OAAO,OAAO,KAAK,UAAU,8BAA8B;EAAC,GAAG;EAAM;CAAK,CAAC,CAAC;AAC9E"}
|