@nocode-factory/sanity-kit 2.68.0-rc.1 → 2.70.0-rc.1

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +34 -18
  2. package/dist/index.d.ts +48 -16
  3. package/dist/index.js +593 -381
  4. package/dist/index.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/hooks/useAssets.ts +1 -1
  7. package/src/hooks/useCollection.ts +5 -3
  8. package/src/hooks/useComponentDefaults.ts +1 -1
  9. package/src/hooks/useComponentNames.ts +1 -1
  10. package/src/hooks/usePageContents.ts +0 -1
  11. package/src/hooks/usePages.ts +5 -3
  12. package/src/hooks/useQueryData.ts +27 -59
  13. package/src/hooks/useRedirectMap.ts +1 -1
  14. package/src/hooks/useScheduledReleases.ts +27 -0
  15. package/src/hooks/useTranslationTodo.ts +1 -1
  16. package/src/hooks/useTranslationTodos.ts +0 -1
  17. package/src/lib/collectionRows.ts +26 -26
  18. package/src/lib/colors.ts +3 -6
  19. package/src/lib/pages.ts +16 -3
  20. package/src/lib/status.ts +118 -22
  21. package/src/tools/assets/AssetDetail.tsx +4 -4
  22. package/src/tools/assets/AssetTable.tsx +3 -3
  23. package/src/tools/collections/CollectionTable.tsx +53 -30
  24. package/src/tools/pages/FieldValue.tsx +2 -2
  25. package/src/tools/pages/PagesTable.tsx +2 -2
  26. package/src/tools/pages/PagesTool.tsx +25 -2
  27. package/src/tools/pages/PathCell.tsx +1 -1
  28. package/src/tools/pages/TagCell.tsx +2 -2
  29. package/src/tools/pages/board/BoardView.tsx +2 -6
  30. package/src/tools/pages/board/PageNode.tsx +1 -1
  31. package/src/tools/pages/board/PagePanel.tsx +2 -2
  32. package/src/tools/presentation/PagesNavigator.tsx +1 -1
  33. package/src/ui/ActorName.tsx +1 -1
  34. package/src/ui/QuietInput.tsx +1 -1
  35. package/src/ui/StatusBadge.tsx +93 -7
  36. package/src/ui/StatusFilter.tsx +68 -0
  37. package/src/ui/formatDate.ts +2 -2
  38. package/src/version.ts +1 -1
  39. package/src/hooks/sharedListener.ts +0 -101
package/dist/index.js CHANGED
@@ -34,6 +34,7 @@ import { TranslateIcon } from "@sanity/icons/Translate";
34
34
  import { ChevronDownIcon } from "@sanity/icons/ChevronDown";
35
35
  import { ChevronRightIcon } from "@sanity/icons/ChevronRight";
36
36
  import { ChevronUpIcon } from "@sanity/icons/ChevronUp";
37
+ import { Tooltip } from "@sanity/ui/tooltip";
37
38
  import { ChevronLeftIcon } from "@sanity/icons/ChevronLeft";
38
39
  import { UlistIcon } from "@sanity/icons/Ulist";
39
40
  import { SyncIcon } from "@sanity/icons/Sync";
@@ -47,7 +48,6 @@ import { ThLargeIcon } from "@sanity/icons/ThLarge";
47
48
  import { ThListIcon } from "@sanity/icons/ThList";
48
49
  import { UploadIcon } from "@sanity/icons/Upload";
49
50
  import { DocumentIcon } from "@sanity/icons/Document";
50
- import { Tooltip } from "@sanity/ui/tooltip";
51
51
  import { EyeClosedIcon } from "@sanity/icons/EyeClosed";
52
52
  import { usePresentationNavigate, usePresentationParams } from "sanity/presentation";
53
53
  import { useToast } from "@sanity/ui/toast";
@@ -641,7 +641,13 @@ function collectLinks(value) {
641
641
  refs: [...refs]
642
642
  };
643
643
  }
644
- const isDraftId = (id) => id.startsWith("drafts."), isVersionId = (id) => id.startsWith("versions.");
644
+ /** Ordre d'affichage et de tri : du plus urgent au plus calme. */
645
+ const STATUS_ORDER$1 = [
646
+ "scheduled",
647
+ "modified",
648
+ "draft",
649
+ "published"
650
+ ], isDraftId = (id) => id.startsWith("drafts."), isVersionId = (id) => id.startsWith("versions.");
645
651
  /** Identifiant de la release, pour un id `versions.<release>.<doc>`. */
646
652
  function releaseId(id) {
647
653
  if (!isVersionId(id)) return null;
@@ -661,14 +667,17 @@ const mostRecent = (a, b) => a ? b ? a > b ? a : b : a : b;
661
667
  /**
662
668
  * Regroupe les documents par identifiant de base.
663
669
  *
664
- * - publié seul -> 'published'
665
- * - brouillon seul -> 'draft' (jamais publié, absent du site)
670
+ * - publication programmée -> 'scheduled' (prime sur tout : c'est ce qui va changer)
666
671
  * - publié + brouillon -> 'modified' (modifications non publiées)
672
+ * - brouillon seul -> 'draft' (jamais publié ou retiré du site)
673
+ * - publié seul -> 'published'
667
674
  *
668
- * Les versions de release sont conservées mais n'influencent pas le statut :
669
- * elles ne sont ni en ligne, ni des modifications en attente au sens du Studio.
675
+ * Une version de release ne compte que si sa release est programmée
676
+ * (`schedules`) : une release en préparation n'est ni en ligne ni attendue.
677
+ * Un item qui n'existe QUE dans une release programmée (brouillon programmé,
678
+ * jamais publié) est bien listé, en `scheduled`.
670
679
  */
671
- function mergeVersions(docs) {
680
+ function mergeVersions(docs, schedules = /* @__PURE__ */ new Map()) {
672
681
  let groups = /* @__PURE__ */ new Map();
673
682
  for (let doc of docs) {
674
683
  let id = baseId(doc._id), group = groups.get(id) ?? { versions: {} };
@@ -681,9 +690,12 @@ function mergeVersions(docs) {
681
690
  }
682
691
  let merged = [];
683
692
  for (let [id, group] of groups) {
684
- let reference = group.draft ?? group.published ?? Object.values(group.versions)[0];
685
- if (!reference || !group.published && !group.draft) continue;
686
- let status = group.published ? group.draft ? "modified" : "published" : "draft";
693
+ let scheduled = Object.keys(group.versions).map((release) => ({
694
+ release,
695
+ at: schedules.get(release)
696
+ })).filter((entry) => !!entry.at).sort((a, b) => a.at < b.at ? -1 : +(a.at > b.at))[0], reference = group.draft ?? group.published ?? (scheduled ? group.versions[scheduled.release] : void 0);
697
+ if (!reference) continue;
698
+ let status = scheduled ? "scheduled" : group.published ? group.draft ? "modified" : "published" : "draft", updatedAt = mostRecent(group.published?._updatedAt, group.draft?._updatedAt) ?? reference._updatedAt;
687
699
  merged.push({
688
700
  id,
689
701
  status,
@@ -691,7 +703,10 @@ function mergeVersions(docs) {
691
703
  ...group.published ? { published: group.published } : {},
692
704
  ...group.draft ? { draft: group.draft } : {},
693
705
  versions: group.versions,
694
- ...mostRecent(group.published?._updatedAt, group.draft?._updatedAt) ? { updatedAt: mostRecent(group.published?._updatedAt, group.draft?._updatedAt) } : {}
706
+ ...updatedAt ? { updatedAt } : {},
707
+ ...scheduled ? { scheduledAt: scheduled.at } : {},
708
+ live: !!group.published,
709
+ hasDraft: !!group.draft
695
710
  });
696
711
  }
697
712
  return merged;
@@ -700,19 +715,66 @@ const STATUS_LABELS = {
700
715
  published: {
701
716
  label: "Published",
702
717
  tone: "positive",
703
- help: "Live, up to date"
718
+ help: "Live, up to date."
704
719
  },
705
720
  modified: {
706
721
  label: "Modified",
707
722
  tone: "caution",
708
- help: "Live, with unpublished changes"
723
+ help: "Live, with changes not published yet."
724
+ },
725
+ scheduled: {
726
+ label: "Scheduled",
727
+ tone: "primary",
728
+ help: "Publication scheduled: it goes live automatically on the date shown."
709
729
  },
710
730
  draft: {
711
- label: "Not published",
731
+ label: "Draft",
712
732
  tone: "default",
713
- help: "Not on the site: never published, or removed from the site (content kept in the draft)"
733
+ help: "Not on the site: never published, or removed from the site (content kept in the draft)."
714
734
  }
715
- };
735
+ }, STATUS_COLORS = {
736
+ draft: "#8b93a1",
737
+ modified: "#f08a24",
738
+ scheduled: "#2f7bf5",
739
+ published: "#2fb466"
740
+ }, scheduleFormat = new Intl.DateTimeFormat(void 0, {
741
+ day: "numeric",
742
+ month: "short",
743
+ year: "numeric",
744
+ hour: "2-digit",
745
+ minute: "2-digit"
746
+ }), shortFormat = new Intl.DateTimeFormat(void 0, {
747
+ day: "numeric",
748
+ month: "short",
749
+ hour: "2-digit",
750
+ minute: "2-digit"
751
+ });
752
+ /** Date de programmation lisible (« 1 Mar 2027, 10:00 », fuseau du navigateur). */
753
+ function formatSchedule(iso, short = !1) {
754
+ if (!iso) return "";
755
+ let date = new Date(iso);
756
+ return Number.isNaN(date.getTime()) ? "" : (short ? shortFormat : scheduleFormat).format(date);
757
+ }
758
+ /** Lignes de l'infobulle : ce qu'est le statut, puis ce qu'il faut savoir en plus. */
759
+ function statusHelp(details) {
760
+ let { status, scheduledAt, live, hasDraft } = details;
761
+ if (status === "scheduled") {
762
+ let lines = [live ? "Currently live: this update goes live automatically on the date shown." : "Not on the site yet: it goes live automatically on the date shown."];
763
+ return hasDraft && lines.push("Also has other changes not scheduled (draft)."), lines.push("Change the date in Scheduled drafts / Releases."), scheduledAt ? [`Scheduled for ${formatSchedule(scheduledAt)}.`, ...lines] : lines;
764
+ }
765
+ return [STATUS_LABELS[status].help];
766
+ }
767
+ /** Nombre d'items par statut (filtres). */
768
+ function countStatuses(rows) {
769
+ let counts = {
770
+ published: 0,
771
+ modified: 0,
772
+ scheduled: 0,
773
+ draft: 0
774
+ };
775
+ for (let row of rows) counts[row.status] += 1;
776
+ return counts;
777
+ }
716
778
  /**
717
779
  * Graphe des liens réels entre pages.
718
780
  *
@@ -1423,7 +1485,7 @@ function explainGrantError(error) {
1423
1485
  * quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
1424
1486
  * le vérifie.
1425
1487
  */
1426
- const KIT_VERSION = "2.68.0-rc.1";
1488
+ const KIT_VERSION = "2.70.0-rc.1";
1427
1489
  /**
1428
1490
  * Signale ce Studio au service du kit, une fois par montage.
1429
1491
  *
@@ -1931,7 +1993,7 @@ function useKitUpdate() {
1931
1993
  !controller.signal.aborted && body?.version && setLatest(body.version);
1932
1994
  }).catch(() => {}), () => controller.abort();
1933
1995
  }, []);
1934
- let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.68.0-rc.1") > 0);
1996
+ let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.70.0-rc.1") > 0);
1935
1997
  return {
1936
1998
  current: KIT_VERSION,
1937
1999
  latest,
@@ -2300,64 +2362,19 @@ function createPreviewLauncher(config, issues) {
2300
2362
  });
2301
2363
  };
2302
2364
  }
2303
- const entries = /* @__PURE__ */ new Map(), RETRY_MIN_MS = 5e3;
2304
- function listenFilter(types, publishedOnly) {
2305
- return publishedOnly ? "*[_type in $types && !(_id in path(\"drafts.**\")) && !(_id in path(\"versions.**\"))]" : "*[_type in $types]";
2306
- }
2307
- function subscribeShared(client, types, publishedOnly, listener, tag) {
2308
- let { projectId, dataset } = client.config(), sorted = [...types].sort(), key = `${projectId}:${dataset}:${publishedOnly ? "published" : "all"}:${sorted.join(",")}`, entry = entries.get(key);
2309
- if (!entry) {
2310
- let listeners = /* @__PURE__ */ new Set(), notify = () => listeners.forEach((l) => l()), retry = RETRY_MIN_MS, retryTimer, stopped = !1, unsubscribe = () => {}, open = (reconnect) => {
2311
- let subscription = client.listen(listenFilter(sorted, publishedOnly), { types: sorted }, {
2312
- visibility: "query",
2313
- events: ["welcome", "mutation"],
2314
- includeResult: !1,
2315
- includePreviousRevision: !1,
2316
- tag
2317
- }).subscribe({
2318
- next: (event) => {
2319
- if (event.type === "welcome") {
2320
- retry = RETRY_MIN_MS, reconnect && notify();
2321
- return;
2322
- }
2323
- notify();
2324
- },
2325
- error: () => {
2326
- stopped || (retryTimer = setTimeout(() => open(!0), retry), retry = Math.min(retry * 2, 6e4));
2327
- }
2328
- });
2329
- unsubscribe = () => subscription.unsubscribe();
2330
- };
2331
- open(!1), entry = {
2332
- listeners,
2333
- stop: () => {
2334
- stopped = !0, retryTimer && clearTimeout(retryTimer), unsubscribe();
2335
- }
2336
- }, entries.set(key, entry);
2337
- }
2338
- entry.listeners.add(listener);
2339
- let current = entry;
2340
- return () => {
2341
- current.listeners.delete(listener), current.listeners.size === 0 && (current.stop(), entries.delete(key));
2342
- };
2343
- }
2344
- /** Étiquette acceptée par Sanity : lettres, chiffres, . _ - (75 caractères au plus). */
2345
- function kitTag(tag) {
2346
- return `ncf-kit.${(tag ?? "query").replace(/[^a-zA-Z0-9._-]/g, "-").slice(0, 66)}`;
2347
- }
2348
2365
  /**
2349
2366
  * Exécute une requête GROQ et la rejoue quand le contenu change.
2350
2367
  *
2351
- * Le rafraîchissement passe par un signal d'écoute puis une nouvelle requête, plutôt
2368
+ * Le rafraîchissement passe par un `listen` puis une nouvelle requête, plutôt
2352
2369
  * que par l'application des mutations reçues : c'est plus lent mais toujours
2353
2370
  * cohérent, y compris quand une publication modifie plusieurs documents.
2354
2371
  */
2355
2372
  function useQueryData(query, params, options = {}) {
2356
- let client = useKitClient(), { listenTypes, enabled = !0, publishedOnly = !1 } = options, tag = kitTag(options.tag), [data, setData] = useState(null), [loading, setLoading] = useState(enabled), [error, setError] = useState(null), [tick, setTick] = useState(0), refresh = useCallback(() => setTick((n) => n + 1), []), paramsKey = JSON.stringify(params), stableParams = useMemo(() => JSON.parse(paramsKey), [paramsKey]);
2373
+ let client = useKitClient(), { listenTypes, listenQuery, enabled = !0 } = options, [data, setData] = useState(null), [loading, setLoading] = useState(enabled), [error, setError] = useState(null), [tick, setTick] = useState(0), refresh = useCallback(() => setTick((n) => n + 1), []), paramsKey = JSON.stringify(params), stableParams = useMemo(() => JSON.parse(paramsKey), [paramsKey]);
2357
2374
  useEffect(() => {
2358
2375
  if (!enabled) return;
2359
2376
  let cancelled = !1;
2360
- return setLoading(!0), client.fetch(query, stableParams, { tag }).then((result) => {
2377
+ return setLoading(!0), client.fetch(query, stableParams).then((result) => {
2361
2378
  cancelled || (setData(result), setError(null));
2362
2379
  }).catch((cause) => {
2363
2380
  cancelled || setError(cause instanceof Error ? cause : Error(String(cause)));
@@ -2377,29 +2394,24 @@ function useQueryData(query, params, options = {}) {
2377
2394
  refreshRef.current = refresh;
2378
2395
  let typesKey = (listenTypes ?? []).join(",");
2379
2396
  return useEffect(() => {
2380
- if (!enabled || !typesKey) return;
2381
- let timer, lastRefresh = Date.now(), staleWhileHidden = !1, run = () => {
2382
- if (timer = void 0, typeof document < "u" && document.hidden) {
2383
- staleWhileHidden = !0;
2384
- return;
2385
- }
2386
- lastRefresh = Date.now(), refreshRef.current();
2387
- }, onChange = () => {
2388
- if (timer) return;
2389
- let wait = Math.max(600, 3e3 - (Date.now() - lastRefresh));
2390
- timer = setTimeout(run, wait);
2391
- }, onVisible = () => {
2392
- !document.hidden && staleWhileHidden && (staleWhileHidden = !1, lastRefresh = Date.now(), refreshRef.current());
2393
- }, unsubscribe = subscribeShared(client, typesKey.split(","), publishedOnly, onChange, tag);
2394
- return document.addEventListener("visibilitychange", onVisible), () => {
2395
- timer && clearTimeout(timer), unsubscribe(), document.removeEventListener("visibilitychange", onVisible);
2397
+ if (!enabled || !typesKey && !listenQuery) return;
2398
+ let types = typesKey ? typesKey.split(",") : [], timer, subscription = client.listen(listenQuery ?? "*[_type in $types]", listenQuery ? {} : { types }, {
2399
+ visibility: "query",
2400
+ events: ["mutation"]
2401
+ }).subscribe({
2402
+ next: () => {
2403
+ timer && clearTimeout(timer), timer = setTimeout(() => refreshRef.current(), 600);
2404
+ },
2405
+ error: () => {}
2406
+ });
2407
+ return () => {
2408
+ timer && clearTimeout(timer), subscription.unsubscribe();
2396
2409
  };
2397
2410
  }, [
2398
2411
  client,
2399
2412
  typesKey,
2400
- enabled,
2401
- publishedOnly,
2402
- tag
2413
+ listenQuery,
2414
+ enabled
2403
2415
  ]), {
2404
2416
  data,
2405
2417
  loading,
@@ -2415,10 +2427,7 @@ const ASSET_TYPES = ["sanity.imageAsset", "sanity.fileAsset"];
2415
2427
  * pris au prochain rafraîchissement.
2416
2428
  */
2417
2429
  function useAssets() {
2418
- return useQueryData("*[_type in $types]{\n _id, _type, _createdAt, _updatedAt, originalFilename, extension, mimeType, size, url,\n title, altText, description,\n \"dimensions\": metadata.dimensions, \"lqip\": metadata.lqip,\n \"uses\": count(*[references(^._id)])\n } | order(_createdAt desc)", { types: ASSET_TYPES }, {
2419
- listenTypes: ASSET_TYPES,
2420
- tag: "assets"
2421
- });
2430
+ return useQueryData("*[_type in $types]{\n _id, _type, _createdAt, _updatedAt, originalFilename, extension, mimeType, size, url,\n title, altText, description,\n \"dimensions\": metadata.dimensions, \"lqip\": metadata.lqip,\n \"uses\": count(*[references(^._id)])\n } | order(_createdAt desc)", { types: ASSET_TYPES }, { listenTypes: ASSET_TYPES });
2422
2431
  }
2423
2432
  const newId$1 = () => `f${Math.random().toString(36).slice(2, 10)}`;
2424
2433
  /**
@@ -3343,8 +3352,8 @@ function reorderBefore(ordered, dragged, target) {
3343
3352
  function formatDocumentValue(value, type, invert = !1) {
3344
3353
  return value == null ? type === "boolean" && invert ? "Yes" : "" : type === "boolean" ? (invert ? !value : value) ? "Yes" : "No" : type === "number" ? typeof value == "number" ? String(value) : "" : typeof value == "string" ? value.trim() : typeof value == "number" || typeof value == "boolean" ? String(value) : "";
3345
3354
  }
3346
- function buildPageRows(docs, config, documentColumns = [], redirects = null) {
3347
- return mergeVersions(docs).map((merged) => {
3355
+ function buildPageRows(docs, config, documentColumns = [], redirects = null, schedules) {
3356
+ return mergeVersions(docs, schedules).map((merged) => {
3348
3357
  let doc = merged.doc, pageType = pageTypeFor(doc._type, config.pageTypes), path = finalPath({
3349
3358
  slug: doc.ncfSlug ?? null,
3350
3359
  locale: doc.ncfLocale ?? null
@@ -3357,6 +3366,9 @@ function buildPageRows(docs, config, documentColumns = [], redirects = null) {
3357
3366
  url: toUrl(config.previewUrl, path),
3358
3367
  locale: doc.ncfLocale ?? null,
3359
3368
  status: merged.status,
3369
+ scheduledAt: merged.scheduledAt ?? null,
3370
+ live: merged.live,
3371
+ hasDraft: merged.hasDraft,
3360
3372
  updatedAt: merged.updatedAt ?? null,
3361
3373
  blockCount: doc.ncfBlockCount ?? 0,
3362
3374
  noindex: !!doc.ncfNoindex,
@@ -3365,11 +3377,7 @@ function buildPageRows(docs, config, documentColumns = [], redirects = null) {
3365
3377
  });
3366
3378
  }
3367
3379
  /** Ordre d'affichage des statuts : du plus « à traiter » au plus stable. */
3368
- const STATUS_ORDER = {
3369
- modified: 0,
3370
- draft: 1,
3371
- published: 2
3372
- }, compare = (a, b, key, options) => {
3380
+ const STATUS_ORDER = Object.fromEntries(STATUS_ORDER$1.map((status, index) => [status, index])), compare = (a, b, key, options) => {
3373
3381
  switch (key) {
3374
3382
  case "structure": {
3375
3383
  let order = options.typeOrder ?? [], rank = (row) => {
@@ -3405,13 +3413,19 @@ function localesInRows(rows) {
3405
3413
  }
3406
3414
  /** Redirections publiées du Studio, tenues à jour : pour afficher les URL finales. */
3407
3415
  function useRedirectMap(redirectType) {
3408
- let { data } = useQueryData("*[_type == $type && defined(from) && defined(to) && !(_id in path(\"drafts.**\"))]{from, to}", useMemo(() => ({ type: redirectType }), [redirectType]), {
3409
- listenTypes: useMemo(() => [redirectType], [redirectType]),
3410
- publishedOnly: !0,
3411
- tag: "redirect-map"
3412
- });
3416
+ let { data } = useQueryData("*[_type == $type && defined(from) && defined(to) && !(_id in path(\"drafts.**\"))]{from, to}", useMemo(() => ({ type: redirectType }), [redirectType]), { listenTypes: useMemo(() => [redirectType], [redirectType]) });
3413
3417
  return useMemo(() => redirectMapOf(data ?? []), [data]);
3414
3418
  }
3419
+ /** Releases programmées (Scheduled drafts et Releases : même mécanisme). */
3420
+ const EMPTY = /* @__PURE__ */ new Map();
3421
+ /**
3422
+ * Publications programmées, tenues à jour : nom de la release -> date.
3423
+ * Sert à afficher le statut « Scheduled » dans les listes du kit.
3424
+ */
3425
+ function useScheduledReleases() {
3426
+ let { data } = useQueryData("*[_id in path(\"_.releases.**\") && state == \"scheduled\"]{name, \"at\": coalesce(publishAt, metadata.intendedPublishAt)}", {}, { listenQuery: "*[_id in path(\"_.releases.**\")]" });
3427
+ return useMemo(() => data?.length ? new Map(data.filter((r) => !!(r.name && r.at)).map((r) => [r.name, r.at])) : EMPTY, [data]);
3428
+ }
3415
3429
  /**
3416
3430
  * Toutes les pages du site, brouillons compris, tenues à jour.
3417
3431
  *
@@ -3427,16 +3441,14 @@ function usePages(documentColumns = []) {
3427
3441
  config,
3428
3442
  pageBuilderField,
3429
3443
  columns
3430
- ]), useMemo(() => ({ types: config.pageTypeNames }), [config.pageTypeNames]), {
3431
- listenTypes: config.pageTypeNames,
3432
- tag: "pages"
3433
- }), redirects = useRedirectMap(config.redirectType);
3444
+ ]), useMemo(() => ({ types: config.pageTypeNames }), [config.pageTypeNames]), { listenTypes: config.pageTypeNames }), redirects = useRedirectMap(config.redirectType), schedules = useScheduledReleases();
3434
3445
  return {
3435
- rows: useMemo(() => data ? buildPageRows(data, config, columns, redirects) : [], [
3446
+ rows: useMemo(() => data ? buildPageRows(data, config, columns, redirects, schedules) : [], [
3436
3447
  data,
3437
3448
  config,
3438
3449
  columns,
3439
- redirects
3450
+ redirects,
3451
+ schedules
3440
3452
  ]),
3441
3453
  loading,
3442
3454
  error,
@@ -4671,7 +4683,6 @@ function LanguagesSync() {
4671
4683
  function useTranslationTodos() {
4672
4684
  let config = useKitConfig(), { data } = useQueryData("*[_type == $type && count(paths) > 0]{documentId, \"count\": count(paths)}", useMemo(() => ({ type: TRANSLATION_TODO_TYPE }), []), {
4673
4685
  listenTypes: [TRANSLATION_TODO_TYPE],
4674
- tag: "translation-todos",
4675
4686
  enabled: !!config.i18n
4676
4687
  });
4677
4688
  return useMemo(() => new Map((data ?? []).map((t) => [t.documentId, t.count])), [data]);
@@ -4739,12 +4750,6 @@ function groupPageRows(rows, groupBy, options) {
4739
4750
  rows: buckets.get(value) ?? []
4740
4751
  }));
4741
4752
  }
4742
- /** Couleurs des statuts, alignées sur les tons des badges. */
4743
- const STATUS_COLORS = {
4744
- published: "#43d675",
4745
- modified: "#f5a623",
4746
- draft: "#8a8a8a"
4747
- };
4748
4753
  /**
4749
4754
  * Applique une opacité à une couleur hexadécimale.
4750
4755
  *
@@ -4948,13 +4953,87 @@ function QueryError(props) {
4948
4953
  })
4949
4954
  });
4950
4955
  }
4951
- function StatusBadge(props) {
4952
- let { label, tone } = STATUS_LABELS[props.status];
4953
- return /* @__PURE__ */ jsx(Badge, {
4954
- tone,
4955
- fontSize: 0,
4956
- title: STATUS_LABELS[props.status].help,
4957
- children: label
4956
+ /**
4957
+ * Pastille de statut, la MÊME partout dans le kit (collections, onglet Pages,
4958
+ * navigateur de Presentation, board) : point de couleur + libellé, jamais la
4959
+ * couleur seule. Survol : ce que veut dire le statut, la date d'une
4960
+ * publication programmée et si l'item est déjà en ligne.
4961
+ */
4962
+ function StatusBadge({ status, scheduledAt, live, hasDraft, showDate }) {
4963
+ let color = STATUS_COLORS[status], { label } = STATUS_LABELS[status], lines = statusHelp({
4964
+ status,
4965
+ scheduledAt,
4966
+ live,
4967
+ hasDraft
4968
+ }), date = showDate && status === "scheduled" ? formatSchedule(scheduledAt, !0) : "";
4969
+ return /* @__PURE__ */ jsx(Tooltip, {
4970
+ portal: !0,
4971
+ placement: "top",
4972
+ content: /* @__PURE__ */ jsx(Box, {
4973
+ padding: 2,
4974
+ style: { maxWidth: 280 },
4975
+ children: /* @__PURE__ */ jsxs(Stack, {
4976
+ gap: 2,
4977
+ children: [/* @__PURE__ */ jsx(Text, {
4978
+ size: 1,
4979
+ weight: "semibold",
4980
+ children: label
4981
+ }), lines.map((line) => /* @__PURE__ */ jsx(Text, {
4982
+ size: 1,
4983
+ muted: !0,
4984
+ children: line
4985
+ }, line))]
4986
+ })
4987
+ }),
4988
+ children: /* @__PURE__ */ jsxs("span", {
4989
+ "data-ncf-status": status,
4990
+ style: {
4991
+ display: "inline-flex",
4992
+ alignItems: "center",
4993
+ gap: 8,
4994
+ flex: "none",
4995
+ maxWidth: "100%"
4996
+ },
4997
+ children: [/* @__PURE__ */ jsxs("span", {
4998
+ style: {
4999
+ display: "inline-flex",
5000
+ alignItems: "center",
5001
+ gap: 6,
5002
+ padding: "2px 9px 2px 7px",
5003
+ borderRadius: 999,
5004
+ background: `color-mix(in srgb, ${color} 15%, transparent)`,
5005
+ color: "var(--card-fg-color)",
5006
+ fontSize: 12,
5007
+ lineHeight: "18px",
5008
+ fontWeight: 500,
5009
+ whiteSpace: "nowrap"
5010
+ },
5011
+ children: [/* @__PURE__ */ jsx(StatusDot, { status }), label]
5012
+ }), date ? /* @__PURE__ */ jsx(Text, {
5013
+ size: 1,
5014
+ muted: !0,
5015
+ style: {
5016
+ whiteSpace: "nowrap",
5017
+ ...TABULAR
5018
+ },
5019
+ children: date
5020
+ }) : null]
5021
+ })
5022
+ });
5023
+ }
5024
+ /** Point de couleur seul (filtres, légendes). Draft : point vide, lisible sans la couleur. */
5025
+ function StatusDot({ status, size = 7 }) {
5026
+ let color = STATUS_COLORS[status];
5027
+ return /* @__PURE__ */ jsx("span", {
5028
+ "aria-hidden": !0,
5029
+ style: {
5030
+ width: size,
5031
+ height: size,
5032
+ flex: "none",
5033
+ borderRadius: "50%",
5034
+ background: status === "draft" ? "transparent" : color,
5035
+ boxShadow: status === "draft" ? `inset 0 0 0 1.5px ${color}` : void 0
5036
+ }
4958
5037
  });
4959
5038
  }
4960
5039
  const formatter = new Intl.DateTimeFormat("en-US", {
@@ -4966,9 +5045,9 @@ const formatter = new Intl.DateTimeFormat("en-US", {
4966
5045
  });
4967
5046
  /** Date lisible, ou un tiret cadratin quand il n'y en a pas. */
4968
5047
  function formatDate$1(value) {
4969
- if (!value) return "—";
5048
+ if (!value) return "";
4970
5049
  let date = new Date(value);
4971
- return Number.isNaN(date.getTime()) ? "—" : formatter.format(date);
5050
+ return Number.isNaN(date.getTime()) ? "" : formatter.format(date);
4972
5051
  }
4973
5052
  /**
4974
5053
  * Champ de saisie d'une cellule de tableau.
@@ -4983,7 +5062,7 @@ function QuietInput(props) {
4983
5062
  return /* @__PURE__ */ jsx("input", {
4984
5063
  type: "text",
4985
5064
  defaultValue: props.value,
4986
- placeholder: props.placeholder ?? "—",
5065
+ placeholder: props.placeholder ?? "",
4987
5066
  onBlur: (event) => {
4988
5067
  event.currentTarget.value !== props.value && props.onCommit(event.currentTarget.value);
4989
5068
  },
@@ -5046,7 +5125,8 @@ function FieldValue(props) {
5046
5125
  })] }) : /* @__PURE__ */ jsx(Text, {
5047
5126
  size: 0,
5048
5127
  muted: !0,
5049
- children: "—"
5128
+ "aria-label": "Not set",
5129
+ children: "\xA0"
5050
5130
  })
5051
5131
  }),
5052
5132
  children: ({ close }) => /* @__PURE__ */ jsx(OptionEditor, {
@@ -5452,7 +5532,7 @@ function PathCell(props) {
5452
5532
  if (!path) return /* @__PURE__ */ jsx(Text, {
5453
5533
  size: 1,
5454
5534
  muted: !0,
5455
- children: "—"
5535
+ children: "No address"
5456
5536
  });
5457
5537
  let segments = path.split("/").filter(Boolean), last = segments.length > 0 ? segments[segments.length - 1] : null, prefix = last ? path.slice(0, path.length - last.length) : path, label = /* @__PURE__ */ jsxs(Text, {
5458
5538
  size: 1,
@@ -5547,7 +5627,8 @@ function TagCell(props) {
5547
5627
  })] }) : /* @__PURE__ */ jsx(Text, {
5548
5628
  size: 0,
5549
5629
  muted: !0,
5550
- children: "—"
5630
+ "aria-label": "Not set",
5631
+ children: "\xA0"
5551
5632
  })
5552
5633
  }),
5553
5634
  children: ({ close }) => /* @__PURE__ */ jsxs(Stack, {
@@ -5823,7 +5904,13 @@ function PagesTable(props) {
5823
5904
  wrap: "wrap",
5824
5905
  style: CELL,
5825
5906
  children: [
5826
- /* @__PURE__ */ jsx(StatusBadge, { status: entryRow.status }),
5907
+ /* @__PURE__ */ jsx(StatusBadge, {
5908
+ status: entryRow.status,
5909
+ scheduledAt: entryRow.scheduledAt,
5910
+ live: entryRow.live,
5911
+ hasDraft: entryRow.hasDraft,
5912
+ showDate: !0
5913
+ }),
5827
5914
  !!todos?.get(entryRow.id) && /* @__PURE__ */ jsxs(Badge, {
5828
5915
  tone: "caution",
5829
5916
  fontSize: 0,
@@ -5865,7 +5952,7 @@ function PagesTable(props) {
5865
5952
  size: 0,
5866
5953
  muted: !value,
5867
5954
  textOverflow: "ellipsis",
5868
- children: value || "—"
5955
+ children: value || ""
5869
5956
  })
5870
5957
  }, column.key);
5871
5958
  }),
@@ -5894,6 +5981,74 @@ function PagesTable(props) {
5894
5981
  })]
5895
5982
  });
5896
5983
  }
5984
+ /** Ordre des filtres : ce qui est en ligne d'abord, puis ce qui demande une action. */
5985
+ const FILTER_ORDER = [
5986
+ "published",
5987
+ "modified",
5988
+ "scheduled",
5989
+ "draft"
5990
+ ];
5991
+ /**
5992
+ * Filtres de statut au-dessus d'une liste (collections, onglet Pages) : « All »
5993
+ * puis un bouton par statut avec son nombre. Un clic filtre, un second clic sur
5994
+ * le même statut revient à « All ».
5995
+ */
5996
+ function StatusFilter({ rows, value, onChange }) {
5997
+ let counts = countStatuses(rows);
5998
+ return /* @__PURE__ */ jsxs(Flex, {
5999
+ gap: 2,
6000
+ wrap: "wrap",
6001
+ role: "group",
6002
+ "aria-label": "Filter by status",
6003
+ children: [/* @__PURE__ */ jsx(Chip, {
6004
+ selected: value === null,
6005
+ onClick: () => onChange(null),
6006
+ label: "All",
6007
+ count: rows.length
6008
+ }), FILTER_ORDER.map((status) => /* @__PURE__ */ jsx(Chip, {
6009
+ selected: value === status,
6010
+ onClick: () => onChange(value === status ? null : status),
6011
+ label: STATUS_LABELS[status].label,
6012
+ count: counts[status],
6013
+ status
6014
+ }, status))]
6015
+ });
6016
+ }
6017
+ function Chip(props) {
6018
+ let { selected, onClick, label, count, status } = props;
6019
+ return /* @__PURE__ */ jsxs("button", {
6020
+ type: "button",
6021
+ "aria-pressed": selected,
6022
+ onClick,
6023
+ style: {
6024
+ display: "inline-flex",
6025
+ alignItems: "center",
6026
+ gap: 6,
6027
+ padding: "3px 10px",
6028
+ borderRadius: 999,
6029
+ border: `1px solid ${selected ? "var(--card-focus-ring-color, #2276fc)" : "var(--card-border-color, rgba(127,127,127,0.25))"}`,
6030
+ background: selected ? "color-mix(in srgb, var(--card-focus-ring-color, #2276fc) 12%, transparent)" : "transparent",
6031
+ color: "var(--card-fg-color)",
6032
+ opacity: count === 0 && !selected ? .55 : 1,
6033
+ font: "inherit",
6034
+ fontSize: 12,
6035
+ lineHeight: "18px",
6036
+ cursor: "pointer"
6037
+ },
6038
+ children: [
6039
+ status ? /* @__PURE__ */ jsx(StatusDot, { status }) : null,
6040
+ /* @__PURE__ */ jsx("span", { children: label }),
6041
+ /* @__PURE__ */ jsx("span", {
6042
+ style: {
6043
+ color: "var(--card-muted-fg-color)",
6044
+ fontWeight: 600,
6045
+ ...TABULAR
6046
+ },
6047
+ children: count
6048
+ })
6049
+ ]
6050
+ });
6051
+ }
5897
6052
  /**
5898
6053
  * Recherche et rafraîchissement.
5899
6054
  *
@@ -6167,7 +6322,13 @@ function PagePanel(props) {
6167
6322
  gap: 2,
6168
6323
  align: "center",
6169
6324
  wrap: "wrap",
6170
- children: [/* @__PURE__ */ jsx(StatusBadge, { status: row.status }), colorLabel && color && /* @__PURE__ */ jsxs(Flex, {
6325
+ children: [/* @__PURE__ */ jsx(StatusBadge, {
6326
+ status: row.status,
6327
+ scheduledAt: row.scheduledAt,
6328
+ live: row.live,
6329
+ hasDraft: row.hasDraft,
6330
+ showDate: !0
6331
+ }), colorLabel && color && /* @__PURE__ */ jsxs(Flex, {
6171
6332
  gap: 2,
6172
6333
  align: "center",
6173
6334
  children: [/* @__PURE__ */ jsx(Box, { style: {
@@ -6187,7 +6348,7 @@ function PagePanel(props) {
6187
6348
  size: 1,
6188
6349
  textOverflow: "ellipsis",
6189
6350
  style: MONO,
6190
- children: row.path ?? "—"
6351
+ children: row.path ?? "No address"
6191
6352
  }),
6192
6353
  /* @__PURE__ */ jsxs(Text, {
6193
6354
  size: 0,
@@ -6398,10 +6559,7 @@ function usePageContents() {
6398
6559
  let config = useKitConfig(), { field: pageBuilderField } = usePageBuilder(), { data, loading, error, refresh } = useQueryData(useMemo(() => buildContentsQuery({
6399
6560
  ...config,
6400
6561
  pageBuilderField
6401
- }, CONTENT_SCAN_LIMIT), [config, pageBuilderField]), useMemo(() => ({ types: config.pageTypeNames }), [config.pageTypeNames]), {
6402
- listenTypes: config.pageTypeNames,
6403
- tag: "page-contents"
6404
- });
6562
+ }, CONTENT_SCAN_LIMIT), [config, pageBuilderField]), useMemo(() => ({ types: config.pageTypeNames }), [config.pageTypeNames]), { listenTypes: config.pageTypeNames });
6405
6563
  return {
6406
6564
  contents: useMemo(() => {
6407
6565
  let map = /* @__PURE__ */ new Map();
@@ -6568,7 +6726,12 @@ function TreeNode(props) {
6568
6726
  }) : /* @__PURE__ */ jsxs(Flex, {
6569
6727
  gap: 2,
6570
6728
  align: "center",
6571
- children: [/* @__PURE__ */ jsx(StatusBadge, { status: row.status }), /* @__PURE__ */ jsxs(Select, {
6729
+ children: [/* @__PURE__ */ jsx(StatusBadge, {
6730
+ status: row.status,
6731
+ scheduledAt: row.scheduledAt,
6732
+ live: row.live,
6733
+ hasDraft: row.hasDraft
6734
+ }), /* @__PURE__ */ jsxs(Select, {
6572
6735
  className: "nodrag",
6573
6736
  fontSize: 0,
6574
6737
  padding: 1,
@@ -6733,11 +6896,7 @@ function useAnnotations(scope) {
6733
6896
  const nodeTypes$1 = {
6734
6897
  page: PageNode,
6735
6898
  annotation: AnnotationNode
6736
- }, isPageNode = (node) => node.type === "page", MINIMAP_COLORS = {
6737
- published: "#43d675",
6738
- modified: "#f5a623",
6739
- draft: "#8a8a8a"
6740
- }, FLOW_THEME$1 = {
6899
+ }, isPageNode = (node) => node.type === "page", MINIMAP_COLORS = STATUS_COLORS, FLOW_THEME$1 = {
6741
6900
  width: "100%",
6742
6901
  height: "100%",
6743
6902
  "--xy-background-color": "var(--card-bg-color)",
@@ -7219,14 +7378,15 @@ function BoardView(props) {
7219
7378
  return /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(Board, { ...props }) });
7220
7379
  }
7221
7380
  function PagesTool() {
7222
- let config = useKitConfig(), router = useRouter(), { byId, saveColumns, patchNode, patchField, pageOrder } = useBoardLayout(), columnOptions = useColumnOptions(), preview = usePreviewTarget(), columns = useInternalColumns(), [view, setView] = useState("list"), [search, setSearch] = useState(""), [locale, setLocale] = useState(""), todos = useTranslationTodos(), [onlyTodo, setOnlyTodo] = useState(!1), [groupBy, setGroupBy] = useState("none"), [rawColorBy, setColorBy] = useState("tag"), [sortKey, setSortKey] = useState(null), [sortDirection, setSortDirection] = useState("asc"), [page, setPage] = useState(0), [hidden, setHidden] = useState(/* @__PURE__ */ new Set()), [shownData, setShownData] = useState(/* @__PURE__ */ new Set()), toggleData = useCallback((key) => {
7381
+ let config = useKitConfig(), router = useRouter(), { byId, saveColumns, patchNode, patchField, pageOrder } = useBoardLayout(), columnOptions = useColumnOptions(), preview = usePreviewTarget(), columns = useInternalColumns(), [view, setView] = useState("list"), [search, setSearch] = useState(""), [locale, setLocale] = useState(""), todos = useTranslationTodos(), [onlyTodo, setOnlyTodo] = useState(!1), [statusFilter, setStatusFilter] = useState(null), [groupBy, setGroupBy] = useState("none"), [rawColorBy, setColorBy] = useState("tag"), [sortKey, setSortKey] = useState(null), [sortDirection, setSortDirection] = useState("asc"), [page, setPage] = useState(0), [hidden, setHidden] = useState(/* @__PURE__ */ new Set()), [shownData, setShownData] = useState(/* @__PURE__ */ new Set()), toggleData = useCallback((key) => {
7223
7382
  setShownData((current) => {
7224
7383
  let next = new Set(current);
7225
7384
  return next.has(key) ? next.delete(key) : next.add(key), next;
7226
7385
  });
7227
7386
  }, []), documentColumns = useDocumentColumns(), visibleDataColumns = useMemo(() => documentColumns.filter((column) => shownData.has(column.key)), [documentColumns, shownData]), { rows, loading, error, refresh } = usePages(visibleDataColumns), colorBy = resolveColorBy(rawColorBy, columns), locales = useMemo(() => config.i18n?.locales.length ? config.i18n.locales : localesInRows(rows), [config.i18n, rows]), effectiveSortKey = sortKey ?? (pageOrder.length > 0 ? "manual" : "structure"), visible = useMemo(() => sortRows$1(filterRows$1(rows, {
7228
7387
  search,
7229
- locales: locale ? [locale] : void 0
7388
+ locales: locale ? [locale] : void 0,
7389
+ statuses: statusFilter ? [statusFilter] : void 0
7230
7390
  }).filter((row) => !onlyTodo || todos.has(row.id)), effectiveSortKey, sortDirection, {
7231
7391
  typeOrder: config.pageTypeNames,
7232
7392
  pageOrder
@@ -7234,13 +7394,14 @@ function PagesTool() {
7234
7394
  rows,
7235
7395
  search,
7236
7396
  locale,
7397
+ statusFilter,
7237
7398
  onlyTodo,
7238
7399
  todos,
7239
7400
  effectiveSortKey,
7240
7401
  sortDirection,
7241
7402
  config.pageTypeNames,
7242
7403
  pageOrder
7243
- ]), pageCount = Math.max(1, Math.ceil(visible.length / 100)), current = Math.min(page, pageCount - 1), slice = visible.slice(current * 100, current * 100 + 100), groups = useMemo(() => groupPageRows(slice, groupBy, {
7404
+ ]), statusScope = useMemo(() => filterRows$1(rows, { locales: locale ? [locale] : void 0 }), [rows, locale]), pageCount = Math.max(1, Math.ceil(visible.length / 100)), current = Math.min(page, pageCount - 1), slice = visible.slice(current * 100, current * 100 + 100), groups = useMemo(() => groupPageRows(slice, groupBy, {
7244
7405
  meta: byId,
7245
7406
  tags: config.boardTags,
7246
7407
  fields: columns
@@ -7456,6 +7617,13 @@ function PagesTool() {
7456
7617
  busy: loading,
7457
7618
  summary
7458
7619
  }),
7620
+ rows.length > 0 && /* @__PURE__ */ jsx(StatusFilter, {
7621
+ rows: statusScope,
7622
+ value: statusFilter,
7623
+ onChange: (value) => {
7624
+ setStatusFilter(value), setPage(0);
7625
+ }
7626
+ }),
7459
7627
  view === "list" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Card, {
7460
7628
  radius: 3,
7461
7629
  shadow: 1,
@@ -9248,7 +9416,7 @@ function Line(props) {
9248
9416
  * d'avoir à détenir un jeton Sanity par client.
9249
9417
  */
9250
9418
  function ActorName(props) {
9251
- let [user] = useUser(props.actorId ?? ""), label = props.actorName || user?.displayName || (props.actorId ? "Unknown account" : "—");
9419
+ let [user] = useUser(props.actorId ?? ""), label = props.actorName || user?.displayName || (props.actorId ? "Unknown account" : "Unknown");
9252
9420
  return /* @__PURE__ */ jsx(Text, {
9253
9421
  size: 0,
9254
9422
  muted: !0,
@@ -10275,7 +10443,7 @@ function AssetTable(props) {
10275
10443
  size: 1,
10276
10444
  muted: !0,
10277
10445
  style: TABULAR,
10278
- children: asset.dimensions?.width ? `${asset.dimensions.width}×${asset.dimensions.height}` : "—"
10446
+ children: asset.dimensions?.width ? `${asset.dimensions.width}×${asset.dimensions.height}` : ""
10279
10447
  })
10280
10448
  }),
10281
10449
  /* @__PURE__ */ jsx("td", {
@@ -10287,7 +10455,7 @@ function AssetTable(props) {
10287
10455
  size: 1,
10288
10456
  muted: !0,
10289
10457
  textOverflow: "ellipsis",
10290
- children: folder ? folderName(folder) : "—"
10458
+ children: folder ? folderName(folder) : ""
10291
10459
  })
10292
10460
  }),
10293
10461
  /* @__PURE__ */ jsx("td", {
@@ -10303,7 +10471,7 @@ function AssetTable(props) {
10303
10471
  }) : /* @__PURE__ */ jsx(Text, {
10304
10472
  size: 1,
10305
10473
  style: TABULAR,
10306
- children: asset.uses ?? "—"
10474
+ children: asset.uses ?? ""
10307
10475
  })
10308
10476
  }),
10309
10477
  /* @__PURE__ */ jsx("td", {
@@ -10356,7 +10524,7 @@ function toPatchPath(segments) {
10356
10524
  function assetUnsetPaths(doc, assetId) {
10357
10525
  return findAssetRefPaths(doc, assetId).map(toPatchPath).filter(Boolean);
10358
10526
  }
10359
- const baseId$2 = (id) => id.replace(/^drafts\./, "");
10527
+ const baseId$1 = (id) => id.replace(/^drafts\./, "");
10360
10528
  /**
10361
10529
  * Suppression d'un asset depuis l'outil Assets. Sanity refuse de supprimer un
10362
10530
  * asset référencé : on retire d'abord l'asset de chaque document (le champ
@@ -10368,7 +10536,7 @@ function useAssetDelete() {
10368
10536
  usage: useCallback(async (assetId) => {
10369
10537
  let docs = await client.fetch("*[references($id)]{_id, _type, \"title\": coalesce(title, name, originalFilename, slug.current, _id)}", { id: assetId }), seen = /* @__PURE__ */ new Map();
10370
10538
  for (let doc of docs ?? []) {
10371
- let id = baseId$2(doc._id);
10539
+ let id = baseId$1(doc._id);
10372
10540
  seen.has(id) || seen.set(id, {
10373
10541
  id,
10374
10542
  type: doc._type,
@@ -10481,7 +10649,7 @@ function AssetDetail(props) {
10481
10649
  children: /* @__PURE__ */ jsxs(Text, {
10482
10650
  size: 1,
10483
10651
  muted: !0,
10484
- children: [asset.extension?.toUpperCase() || "Fichier", " — pas d'aperçu"]
10652
+ children: [asset.extension?.toUpperCase() || "Fichier", " (pas d'aperçu)"]
10485
10653
  })
10486
10654
  })
10487
10655
  }),
@@ -10577,7 +10745,7 @@ function AssetDetail(props) {
10577
10745
  children: [
10578
10746
  /* @__PURE__ */ jsx(Metric, {
10579
10747
  label: "Fichier",
10580
- value: asset.originalFilename ?? "—"
10748
+ value: asset.originalFilename ?? "None"
10581
10749
  }),
10582
10750
  /* @__PURE__ */ jsx(Metric, {
10583
10751
  label: "Type",
@@ -10589,11 +10757,11 @@ function AssetDetail(props) {
10589
10757
  }),
10590
10758
  /* @__PURE__ */ jsx(Metric, {
10591
10759
  label: "Dimensions",
10592
- value: asset.dimensions?.width ? `${asset.dimensions.width}×${asset.dimensions.height}` : "—"
10760
+ value: asset.dimensions?.width ? `${asset.dimensions.width}×${asset.dimensions.height}` : "Unknown"
10593
10761
  }),
10594
10762
  /* @__PURE__ */ jsx(Metric, {
10595
10763
  label: "Usage",
10596
- value: asset.uses === void 0 ? "—" : `${asset.uses}`
10764
+ value: asset.uses === void 0 ? "Unknown" : `${asset.uses}`
10597
10765
  }),
10598
10766
  /* @__PURE__ */ jsx(Metric, {
10599
10767
  label: "Ajouté",
@@ -11096,8 +11264,7 @@ function entryFor$1(client, type, languageField, language) {
11096
11264
  load();
11097
11265
  let sub = client.listen(`*[${filter}]`, params, {
11098
11266
  visibility: "query",
11099
- includeResult: !1,
11100
- tag: "ncf-kit.component-defaults"
11267
+ includeResult: !1
11101
11268
  }).subscribe({ next: () => void load() });
11102
11269
  e.stop = () => sub.unsubscribe();
11103
11270
  }
@@ -11648,9 +11815,7 @@ function useComponentNames() {
11648
11815
  load();
11649
11816
  let subscription = client.listen("*[_id == $id]", { id: COMPONENT_META_ID }, {
11650
11817
  visibility: "query",
11651
- events: ["mutation"],
11652
- includeResult: !1,
11653
- tag: "ncf-kit.component-names"
11818
+ events: ["mutation"]
11654
11819
  }).subscribe({
11655
11820
  next: () => void load(),
11656
11821
  error: () => {}
@@ -11703,8 +11868,7 @@ function entryFor(client, documentId) {
11703
11868
  load();
11704
11869
  let sub = client.listen("*[_id == $id]", { id }, {
11705
11870
  visibility: "query",
11706
- includeResult: !1,
11707
- tag: "ncf-kit.translation-todo"
11871
+ includeResult: !1
11708
11872
  }).subscribe({ next: () => void load() });
11709
11873
  e.stop = () => sub.unsubscribe();
11710
11874
  }
@@ -12949,7 +13113,12 @@ function PagesNavigator() {
12949
13113
  children: row.path
12950
13114
  })]
12951
13115
  }),
12952
- row.status !== "published" && /* @__PURE__ */ jsx(StatusBadge, { status: row.status })
13116
+ /* @__PURE__ */ jsx(StatusBadge, {
13117
+ status: row.status,
13118
+ scheduledAt: row.scheduledAt,
13119
+ live: row.live,
13120
+ hasDraft: row.hasDraft
13121
+ })
12953
13122
  ]
12954
13123
  })
12955
13124
  }, row.id);
@@ -13545,7 +13714,7 @@ function buildCollectionQuery(columns, filter) {
13545
13714
  "}"
13546
13715
  ].join("\n");
13547
13716
  }
13548
- const baseId$1 = (id) => id.startsWith("drafts.") ? id.slice(7) : id, isDraft = (id) => id.startsWith("drafts."), dateFormatter = new Intl.DateTimeFormat("en-US", {
13717
+ const dateFormatter = new Intl.DateTimeFormat("en-US", {
13549
13718
  day: "2-digit",
13550
13719
  month: "2-digit",
13551
13720
  year: "numeric"
@@ -13586,30 +13755,29 @@ function cellOf(raw, kind) {
13586
13755
  }
13587
13756
  /**
13588
13757
  * Documents → lignes, une par item. Le client (perspective `raw`) renvoie le
13589
- * brouillon ET la version publiée : on les fusionne par id de base, en gardant
13590
- * le brouillon s'il existe (valeurs les plus fraîches).
13758
+ * brouillon, la version publiée et les versions de release : on les fusionne
13759
+ * par id de base (`mergeVersions`, même règle que les pages), en gardant le
13760
+ * brouillon s'il existe (valeurs les plus fraîches). Une version de release non
13761
+ * programmée ne crée jamais de ligne à part.
13591
13762
  */
13592
- function buildCollectionRows(docs, columns) {
13593
- let byId = /* @__PURE__ */ new Map();
13594
- for (let doc of docs) {
13595
- if (!doc?._id) continue;
13596
- let entry = byId.get(baseId$1(doc._id)) ?? {};
13597
- isDraft(doc._id) ? entry.draft = doc : entry.published = doc, byId.set(baseId$1(doc._id), entry);
13598
- }
13599
- let rows = [];
13600
- for (let [id, { draft, published }] of byId) {
13601
- let source = draft ?? published;
13602
- if (!source) continue;
13603
- let cells = {};
13763
+ function buildCollectionRows(docs, columns, schedules) {
13764
+ return mergeVersions(docs.filter((doc) => !!doc?._id).map((doc) => ({
13765
+ ...doc,
13766
+ _type: "",
13767
+ _updatedAt: doc._updatedAt ?? void 0
13768
+ })), schedules).map((merged) => {
13769
+ let source = merged.doc, cells = {};
13604
13770
  for (let column of columns) cells[column.key] = cellOf(source[`${DATA_PREFIX}${column.key}`], column.kind);
13605
- rows.push({
13606
- id,
13607
- updatedAt: source._updatedAt ?? null,
13608
- draftOnly: !!draft && !published,
13771
+ return {
13772
+ id: merged.id,
13773
+ updatedAt: merged.updatedAt ?? null,
13774
+ status: merged.status,
13775
+ scheduledAt: merged.scheduledAt ?? null,
13776
+ live: merged.live,
13777
+ hasDraft: merged.hasDraft,
13609
13778
  cells
13610
- });
13611
- }
13612
- return rows;
13779
+ };
13780
+ });
13613
13781
  }
13614
13782
  /**
13615
13783
  * Données d'une collection pour la vue table : colonnes tirées du schéma,
@@ -13624,14 +13792,15 @@ function useCollection(type, visibleKeys, options = {}) {
13624
13792
  let { filter, params: extraParams } = options, schema = useSchema(), allColumns = useMemo(() => deriveCollectionColumns(schema.get(type)), [schema, type]), visibleColumns = useMemo(() => visibleKeys.map((key) => allColumns.find((c) => c.key === key)).filter((c) => !!c), [allColumns, visibleKeys]), { data, loading, error, refresh } = useQueryData(useMemo(() => buildCollectionQuery(visibleColumns, filter), [visibleColumns, filter]), {
13625
13793
  type,
13626
13794
  ...extraParams
13627
- }, {
13628
- listenTypes: [type],
13629
- tag: `collection.${type}`
13630
- });
13795
+ }, { listenTypes: [type] }), schedules = useScheduledReleases();
13631
13796
  return {
13632
13797
  allColumns,
13633
13798
  visibleColumns,
13634
- rows: useMemo(() => buildCollectionRows(data ?? [], visibleColumns), [data, visibleColumns]),
13799
+ rows: useMemo(() => buildCollectionRows(data ?? [], visibleColumns, schedules), [
13800
+ data,
13801
+ visibleColumns,
13802
+ schedules
13803
+ ]),
13635
13804
  loading,
13636
13805
  error,
13637
13806
  refresh
@@ -13882,8 +14051,8 @@ function CollectionToolbar(props) {
13882
14051
  ]
13883
14052
  });
13884
14053
  }
13885
- /** Colonnes montrées par défaut : le titre d'abord, puis les premières. */
13886
- const MEDIA = "2.0625rem";
14054
+ /** Clé de tri de la colonne Status (colonne du kit, pas un champ du schéma). */
14055
+ const STATUS_KEY = "__status", MEDIA = "2.0625rem";
13887
14056
  function defaultVisible(columns) {
13888
14057
  let title = columns.find((c) => c.key === "title") ?? columns.find((c) => c.kind === "text");
13889
14058
  return (title ? [title, ...columns.filter((c) => c !== title)] : [...columns]).slice(0, 6).map((c) => c.key);
@@ -13910,21 +14079,29 @@ function CollectionTable({ type, filter, params, newTemplate }) {
13910
14079
  let router = useRouter(), { ChildLink } = usePaneRouter(), [view, setView] = useState("table"), [selected, setSelected] = useState(null), [sort, setSort] = useState({
13911
14080
  key: null,
13912
14081
  direction: "asc"
13913
- }), [search, setSearch] = useState(""), [widths, setWidths] = useState({}), schemaType = useSchema().get(type), TypeIcon = schemaType?.icon, allColumns = useMemo(() => deriveCollectionColumns(schemaType), [schemaType]), visibleKeys = useMemo(() => selected ?? defaultVisible(allColumns), [selected, allColumns]), { visibleColumns, rows, loading, error, refresh } = useCollection(type, visibleKeys, {
14082
+ }), [search, setSearch] = useState(""), [statusFilter, setStatusFilter] = useState(null), [widths, setWidths] = useState({}), schemaType = useSchema().get(type), TypeIcon = schemaType?.icon, allColumns = useMemo(() => deriveCollectionColumns(schemaType), [schemaType]), visibleKeys = useMemo(() => selected ?? defaultVisible(allColumns), [selected, allColumns]), { visibleColumns, rows, loading, error, refresh } = useCollection(type, visibleKeys, {
13914
14083
  filter,
13915
14084
  params
13916
- }), visible = useMemo(() => sortRows(filterRows(rows, {
13917
- search,
13918
- columns: {}
13919
- }, visibleColumns), sort, visibleColumns), [
14085
+ }), visible = useMemo(() => {
14086
+ let searched = filterRows(rows, {
14087
+ search,
14088
+ columns: {}
14089
+ }, visibleColumns), filtered = statusFilter ? searched.filter((row) => row.status === statusFilter) : searched;
14090
+ if (sort.key === STATUS_KEY) {
14091
+ let rank = (status) => STATUS_ORDER$1.indexOf(status), sorted = [...filtered].sort((a, b) => rank(a.status) - rank(b.status));
14092
+ return sort.direction === "asc" ? sorted : sorted.reverse();
14093
+ }
14094
+ return sortRows(filtered, sort, visibleColumns);
14095
+ }, [
13920
14096
  rows,
13921
14097
  search,
14098
+ statusFilter,
13922
14099
  visibleColumns,
13923
14100
  sort
13924
14101
  ]), cols = useMemo(() => visibleColumns.map((column, index) => ({
13925
14102
  column,
13926
14103
  width: widths[column.key] ?? defaultWidth(column, index === 0)
13927
- })), [visibleColumns, widths]), totalWidth = useMemo(() => cols.reduce((sum, c) => sum + c.width, 0), [cols]), onToggleColumn = useCallback((key) => {
14104
+ })), [visibleColumns, widths]), totalWidth = useMemo(() => cols.reduce((sum, c) => sum + c.width, 0) + 230, [cols]), onToggleColumn = useCallback((key) => {
13928
14105
  setSelected((current) => {
13929
14106
  let base = current ?? defaultVisible(allColumns);
13930
14107
  return base.includes(key) ? base.filter((k) => k !== key) : [...base, key];
@@ -13971,153 +14148,89 @@ function CollectionTable({ type, filter, params, newTemplate }) {
13971
14148
  error,
13972
14149
  onRetry: refresh
13973
14150
  });
13974
- let summary = visible.length === rows.length ? `${rows.length} item${rows.length > 1 ? "s" : ""}` : `${visible.length} of ${rows.length}`, titleKey = visibleColumns[0]?.key, subtitleKey = visibleColumns.find((c, i) => i > 0 && /slug|path|url|email/i.test(c.key))?.key ?? visibleColumns.find((c, i) => i > 0 && c.kind === "text")?.key;
13975
- return /* @__PURE__ */ jsxs(Stack, {
13976
- gap: 3,
13977
- children: [/* @__PURE__ */ jsx(CollectionToolbar, {
13978
- view,
13979
- onView: setView,
13980
- search,
13981
- onSearch: setSearch,
13982
- columns: allColumns,
13983
- visible: visibleKeys,
13984
- onToggleColumn,
13985
- onExport,
13986
- onRefresh: refresh,
13987
- onCreate,
13988
- busy: loading,
13989
- summary
13990
- }), loading && rows.length === 0 ? /* @__PURE__ */ jsxs(Flex, {
14151
+ let summary = visible.length === rows.length ? `${rows.length} item${rows.length > 1 ? "s" : ""}` : `${visible.length} of ${rows.length}`, titleKey = visibleColumns[0]?.key, subtitleKey = visibleColumns.find((c, i) => i > 0 && /slug|path|url|email/i.test(c.key))?.key ?? visibleColumns.find((c, i) => i > 0 && c.kind === "text")?.key, StatusArrow = sort.direction === "asc" ? ChevronUpIcon : ChevronDownIcon, statusHeader = /* @__PURE__ */ jsx(Box, {
14152
+ paddingRight: 2,
14153
+ style: {
14154
+ width: 230,
14155
+ flex: "none",
14156
+ boxSizing: "border-box",
14157
+ borderLeft: "2px solid transparent"
14158
+ },
14159
+ children: /* @__PURE__ */ jsxs(Flex, {
13991
14160
  align: "center",
13992
- justify: "center",
13993
- padding: 6,
13994
- gap: 3,
13995
- children: [/* @__PURE__ */ jsx(Spinner, { muted: !0 }), /* @__PURE__ */ jsx(Text, {
13996
- size: 1,
13997
- muted: !0,
13998
- children: "Loading…"
13999
- })]
14000
- }) : visibleColumns.length === 0 ? /* @__PURE__ */ jsx(Box, {
14001
- padding: 5,
14002
- children: /* @__PURE__ */ jsx(Text, {
14003
- size: 1,
14004
- muted: !0,
14005
- align: "center",
14006
- children: "No displayable field in this type. Pick columns above."
14007
- })
14008
- }) : view === "list" ? /* @__PURE__ */ jsxs(Box, {
14161
+ gap: 1,
14162
+ onClick: () => onSort(STATUS_KEY),
14009
14163
  style: {
14010
- border: `1px solid ${BORDER_SOFT}`,
14011
- borderRadius: 6,
14012
- overflow: "hidden"
14164
+ cursor: "pointer",
14165
+ userSelect: "none"
14013
14166
  },
14014
- children: [/* @__PURE__ */ jsx("style", { children: ".ncf-coll-body a{display:block;color:inherit;text-decoration:none}" }), /* @__PURE__ */ jsxs(Box, {
14015
- className: "ncf-coll-body",
14016
- children: [visible.map((row) => /* @__PURE__ */ jsx(ChildLink, {
14017
- childId: row.id,
14018
- children: /* @__PURE__ */ jsx(ListRowView, {
14019
- row,
14020
- titleKey,
14021
- subtitleKey,
14022
- Icon: TypeIcon
14023
- })
14024
- }, row.id)), visible.length === 0 && /* @__PURE__ */ jsx(Box, {
14025
- padding: 5,
14026
- children: /* @__PURE__ */ jsx(Text, {
14027
- size: 1,
14028
- muted: !0,
14029
- align: "center",
14030
- children: rows.length === 0 ? "No item yet." : "No match."
14031
- })
14167
+ title: "Sort by status",
14168
+ children: [/* @__PURE__ */ jsx(Text, {
14169
+ size: 1,
14170
+ weight: "semibold",
14171
+ muted: sort.key !== STATUS_KEY,
14172
+ children: "Status"
14173
+ }), sort.key === STATUS_KEY && /* @__PURE__ */ jsx(StatusArrow, { style: {
14174
+ fontSize: 14,
14175
+ opacity: .7,
14176
+ flex: "none"
14177
+ } })]
14178
+ })
14179
+ }, STATUS_KEY);
14180
+ return /* @__PURE__ */ jsxs(Stack, {
14181
+ gap: 3,
14182
+ children: [
14183
+ /* @__PURE__ */ jsx(CollectionToolbar, {
14184
+ view,
14185
+ onView: setView,
14186
+ search,
14187
+ onSearch: setSearch,
14188
+ columns: allColumns,
14189
+ visible: visibleKeys,
14190
+ onToggleColumn,
14191
+ onExport,
14192
+ onRefresh: refresh,
14193
+ onCreate,
14194
+ busy: loading,
14195
+ summary
14196
+ }),
14197
+ rows.length > 0 && /* @__PURE__ */ jsx(StatusFilter, {
14198
+ rows,
14199
+ value: statusFilter,
14200
+ onChange: setStatusFilter
14201
+ }),
14202
+ loading && rows.length === 0 ? /* @__PURE__ */ jsxs(Flex, {
14203
+ align: "center",
14204
+ justify: "center",
14205
+ padding: 6,
14206
+ gap: 3,
14207
+ children: [/* @__PURE__ */ jsx(Spinner, { muted: !0 }), /* @__PURE__ */ jsx(Text, {
14208
+ size: 1,
14209
+ muted: !0,
14210
+ children: "Loading…"
14032
14211
  })]
14033
- })]
14034
- }) : /* @__PURE__ */ jsxs(Box, {
14035
- style: {
14036
- overflowX: "auto",
14037
- border: `1px solid ${BORDER_SOFT}`,
14038
- borderRadius: 6
14039
- },
14040
- children: [/* @__PURE__ */ jsx("style", { children: ".ncf-coll-body a{display:contents;color:inherit;text-decoration:none}" }), /* @__PURE__ */ jsxs(Box, {
14212
+ }) : visibleColumns.length === 0 ? /* @__PURE__ */ jsx(Box, {
14213
+ padding: 5,
14214
+ children: /* @__PURE__ */ jsx(Text, {
14215
+ size: 1,
14216
+ muted: !0,
14217
+ align: "center",
14218
+ children: "No displayable field in this type. Pick columns above."
14219
+ })
14220
+ }) : view === "list" ? /* @__PURE__ */ jsxs(Box, {
14041
14221
  style: {
14042
- width: totalWidth,
14043
- minWidth: "100%"
14222
+ border: `1px solid ${BORDER_SOFT}`,
14223
+ borderRadius: 6,
14224
+ overflow: "hidden"
14044
14225
  },
14045
- children: [/* @__PURE__ */ jsx(Flex, {
14046
- paddingX: 3,
14047
- paddingY: 3,
14048
- align: "center",
14049
- style: {
14050
- borderBottom: `1px solid ${BORDER}`,
14051
- position: "sticky",
14052
- top: 0,
14053
- background: "var(--card-muted-bg-color, var(--card-bg-color, inherit))",
14054
- zIndex: 2
14055
- },
14056
- children: cols.map(({ column, width }) => {
14057
- let active = sort.key === column.key, Arrow = sort.direction === "asc" ? ChevronUpIcon : ChevronDownIcon, alignEnd = column.kind === "number";
14058
- return /* @__PURE__ */ jsxs(Box, {
14059
- paddingRight: 2,
14060
- onDragOver: (e) => {
14061
- dragKeyRef.current && dragKeyRef.current !== column.key && (e.preventDefault(), setDragOverKey(column.key));
14062
- },
14063
- onDrop: () => onReorder(column.key),
14064
- style: {
14065
- width,
14066
- flex: "none",
14067
- position: "relative",
14068
- boxSizing: "border-box",
14069
- borderLeft: dragOverKey === column.key ? "2px solid var(--card-focus-ring-color, #2276fc)" : "2px solid transparent"
14070
- },
14071
- children: [/* @__PURE__ */ jsxs(Flex, {
14072
- align: "center",
14073
- gap: 1,
14074
- justify: alignEnd ? "flex-end" : "flex-start",
14075
- draggable: !0,
14076
- onDragStart: () => {
14077
- dragKeyRef.current = column.key;
14078
- },
14079
- onDragEnd: () => {
14080
- dragKeyRef.current = null, setDragOverKey(null);
14081
- },
14082
- onClick: () => onSort(column.key),
14083
- style: {
14084
- cursor: "grab",
14085
- userSelect: "none"
14086
- },
14087
- title: `Sort by ${column.label.toLowerCase()} — drag to reorder`,
14088
- children: [/* @__PURE__ */ jsx(Text, {
14089
- size: 1,
14090
- weight: "semibold",
14091
- muted: !active,
14092
- textOverflow: "ellipsis",
14093
- children: column.label
14094
- }), active && /* @__PURE__ */ jsx(Arrow, { style: {
14095
- fontSize: 14,
14096
- opacity: .7,
14097
- flex: "none"
14098
- } })]
14099
- }), /* @__PURE__ */ jsx("div", {
14100
- onPointerDown: onResizeStart(column.key, width),
14101
- title: "Drag to resize",
14102
- style: {
14103
- position: "absolute",
14104
- top: 0,
14105
- right: 0,
14106
- width: 9,
14107
- height: "100%",
14108
- cursor: "col-resize",
14109
- touchAction: "none"
14110
- }
14111
- })]
14112
- }, column.key);
14113
- })
14114
- }), /* @__PURE__ */ jsxs(Box, {
14226
+ children: [/* @__PURE__ */ jsx("style", { children: ".ncf-coll-body a{display:block;color:inherit;text-decoration:none}" }), /* @__PURE__ */ jsxs(Box, {
14115
14227
  className: "ncf-coll-body",
14116
14228
  children: [visible.map((row) => /* @__PURE__ */ jsx(ChildLink, {
14117
14229
  childId: row.id,
14118
- children: /* @__PURE__ */ jsx(TableRowView, {
14230
+ children: /* @__PURE__ */ jsx(ListRowView, {
14119
14231
  row,
14120
- cols,
14232
+ titleKey,
14233
+ subtitleKey,
14121
14234
  Icon: TypeIcon
14122
14235
  })
14123
14236
  }, row.id)), visible.length === 0 && /* @__PURE__ */ jsx(Box, {
@@ -14130,21 +14243,108 @@ function CollectionTable({ type, filter, params, newTemplate }) {
14130
14243
  })
14131
14244
  })]
14132
14245
  })]
14133
- })]
14134
- })]
14135
- });
14136
- }
14137
- /** Pastille de statut : vert = publié, ambre = brouillon jamais publié. */
14138
- function StatusDot(props) {
14139
- return /* @__PURE__ */ jsx("span", {
14140
- title: props.draftOnly ? "Not published" : "Published",
14141
- style: {
14142
- flex: "none",
14143
- width: 9,
14144
- height: 9,
14145
- borderRadius: "50%",
14146
- background: props.draftOnly ? "#f5a623" : "#43d675"
14147
- }
14246
+ }) : /* @__PURE__ */ jsxs(Box, {
14247
+ style: {
14248
+ overflowX: "auto",
14249
+ border: `1px solid ${BORDER_SOFT}`,
14250
+ borderRadius: 6
14251
+ },
14252
+ children: [/* @__PURE__ */ jsx("style", { children: ".ncf-coll-body a{display:contents;color:inherit;text-decoration:none}" }), /* @__PURE__ */ jsxs(Box, {
14253
+ style: {
14254
+ width: totalWidth,
14255
+ minWidth: "100%"
14256
+ },
14257
+ children: [/* @__PURE__ */ jsx(Flex, {
14258
+ paddingX: 3,
14259
+ paddingY: 3,
14260
+ align: "center",
14261
+ style: {
14262
+ borderBottom: `1px solid ${BORDER}`,
14263
+ position: "sticky",
14264
+ top: 0,
14265
+ background: "var(--card-muted-bg-color, var(--card-bg-color, inherit))",
14266
+ zIndex: 2
14267
+ },
14268
+ children: cols.map(({ column, width }, index) => {
14269
+ let active = sort.key === column.key, Arrow = sort.direction === "asc" ? ChevronUpIcon : ChevronDownIcon, alignEnd = column.kind === "number", cell = /* @__PURE__ */ jsxs(Box, {
14270
+ paddingRight: 2,
14271
+ onDragOver: (e) => {
14272
+ dragKeyRef.current && dragKeyRef.current !== column.key && (e.preventDefault(), setDragOverKey(column.key));
14273
+ },
14274
+ onDrop: () => onReorder(column.key),
14275
+ style: {
14276
+ width,
14277
+ flex: "none",
14278
+ position: "relative",
14279
+ boxSizing: "border-box",
14280
+ borderLeft: dragOverKey === column.key ? "2px solid var(--card-focus-ring-color, #2276fc)" : "2px solid transparent"
14281
+ },
14282
+ children: [/* @__PURE__ */ jsxs(Flex, {
14283
+ align: "center",
14284
+ gap: 1,
14285
+ justify: alignEnd ? "flex-end" : "flex-start",
14286
+ draggable: !0,
14287
+ onDragStart: () => {
14288
+ dragKeyRef.current = column.key;
14289
+ },
14290
+ onDragEnd: () => {
14291
+ dragKeyRef.current = null, setDragOverKey(null);
14292
+ },
14293
+ onClick: () => onSort(column.key),
14294
+ style: {
14295
+ cursor: "grab",
14296
+ userSelect: "none"
14297
+ },
14298
+ title: `Sort by ${column.label.toLowerCase()} — drag to reorder`,
14299
+ children: [/* @__PURE__ */ jsx(Text, {
14300
+ size: 1,
14301
+ weight: "semibold",
14302
+ muted: !active,
14303
+ textOverflow: "ellipsis",
14304
+ children: column.label
14305
+ }), active && /* @__PURE__ */ jsx(Arrow, { style: {
14306
+ fontSize: 14,
14307
+ opacity: .7,
14308
+ flex: "none"
14309
+ } })]
14310
+ }), /* @__PURE__ */ jsx("div", {
14311
+ onPointerDown: onResizeStart(column.key, width),
14312
+ title: "Drag to resize",
14313
+ style: {
14314
+ position: "absolute",
14315
+ top: 0,
14316
+ right: 0,
14317
+ width: 9,
14318
+ height: "100%",
14319
+ cursor: "col-resize",
14320
+ touchAction: "none"
14321
+ }
14322
+ })]
14323
+ }, column.key);
14324
+ return index === 0 ? [cell, statusHeader] : cell;
14325
+ })
14326
+ }), /* @__PURE__ */ jsxs(Box, {
14327
+ className: "ncf-coll-body",
14328
+ children: [visible.map((row) => /* @__PURE__ */ jsx(ChildLink, {
14329
+ childId: row.id,
14330
+ children: /* @__PURE__ */ jsx(TableRowView, {
14331
+ row,
14332
+ cols,
14333
+ Icon: TypeIcon
14334
+ })
14335
+ }, row.id)), visible.length === 0 && /* @__PURE__ */ jsx(Box, {
14336
+ padding: 5,
14337
+ children: /* @__PURE__ */ jsx(Text, {
14338
+ size: 1,
14339
+ muted: !0,
14340
+ align: "center",
14341
+ children: rows.length === 0 ? "No item yet." : "No match."
14342
+ })
14343
+ })]
14344
+ })]
14345
+ })]
14346
+ })
14347
+ ]
14148
14348
  });
14149
14349
  }
14150
14350
  /** Ligne de la vue TABLE : une cellule par colonne, largeurs fixes. */
@@ -14162,8 +14362,7 @@ function TableRowView(props) {
14162
14362
  background: hovered ? "var(--card-muted-bg-color, rgba(127,127,127,0.08))" : "transparent"
14163
14363
  },
14164
14364
  children: cols.map(({ column, width }, index) => {
14165
- let cell = row.cells[column.key], empty = !cell || cell.raw === null || cell.text === "", first = index === 0, alignEnd = column.kind === "number";
14166
- return /* @__PURE__ */ jsxs(Flex, {
14365
+ let cell = row.cells[column.key], empty = !cell || cell.raw === null || cell.text === "", first = index === 0, alignEnd = column.kind === "number", content = /* @__PURE__ */ jsxs(Flex, {
14167
14366
  align: "center",
14168
14367
  gap: 2,
14169
14368
  paddingRight: 2,
@@ -14173,36 +14372,43 @@ function TableRowView(props) {
14173
14372
  flex: "none",
14174
14373
  boxSizing: "border-box"
14175
14374
  },
14176
- children: [
14177
- first && /* @__PURE__ */ jsx(Text, {
14178
- size: 1,
14179
- muted: !0,
14180
- style: {
14181
- flex: "none",
14182
- display: "flex"
14183
- },
14184
- children: jsx(Icon || DocumentIcon, {})
14185
- }),
14186
- /* @__PURE__ */ jsx(Text, {
14187
- size: 1,
14188
- muted: empty,
14189
- weight: first ? "medium" : "regular",
14190
- textOverflow: "ellipsis",
14191
- style: {
14192
- flex: alignEnd ? "none" : 1,
14193
- minWidth: 0,
14194
- ...column.kind === "number" || column.kind === "date" ? TABULAR : null
14195
- },
14196
- children: empty ? "—" : cell.text
14197
- }),
14198
- first && row.draftOnly && /* @__PURE__ */ jsx(Badge, {
14199
- tone: "caution",
14200
- fontSize: 0,
14201
- style: { flex: "none" },
14202
- children: "Draft"
14203
- })
14204
- ]
14375
+ children: [first && /* @__PURE__ */ jsx(Text, {
14376
+ size: 1,
14377
+ muted: !0,
14378
+ style: {
14379
+ flex: "none",
14380
+ display: "flex"
14381
+ },
14382
+ children: jsx(Icon || DocumentIcon, {})
14383
+ }), /* @__PURE__ */ jsx(Text, {
14384
+ size: 1,
14385
+ muted: empty,
14386
+ weight: first ? "medium" : "regular",
14387
+ textOverflow: "ellipsis",
14388
+ style: {
14389
+ flex: alignEnd ? "none" : 1,
14390
+ minWidth: 0,
14391
+ ...column.kind === "number" || column.kind === "date" ? TABULAR : null
14392
+ },
14393
+ children: empty ? "" : cell.text
14394
+ })]
14205
14395
  }, column.key);
14396
+ return first ? [content, /* @__PURE__ */ jsx(Flex, {
14397
+ align: "center",
14398
+ paddingRight: 2,
14399
+ style: {
14400
+ width: 230,
14401
+ flex: "none",
14402
+ boxSizing: "border-box"
14403
+ },
14404
+ children: /* @__PURE__ */ jsx(StatusBadge, {
14405
+ status: row.status,
14406
+ scheduledAt: row.scheduledAt,
14407
+ live: row.live,
14408
+ hasDraft: row.hasDraft,
14409
+ showDate: !0
14410
+ })
14411
+ }, STATUS_KEY)] : content;
14206
14412
  })
14207
14413
  });
14208
14414
  }
@@ -14254,7 +14460,13 @@ function ListRowView(props) {
14254
14460
  children: subtitle
14255
14461
  }) : null]
14256
14462
  }),
14257
- /* @__PURE__ */ jsx(StatusDot, { draftOnly: row.draftOnly })
14463
+ /* @__PURE__ */ jsx(StatusBadge, {
14464
+ status: row.status,
14465
+ scheduledAt: row.scheduledAt,
14466
+ live: row.live,
14467
+ hasDraft: row.hasDraft,
14468
+ showDate: !0
14469
+ })
14258
14470
  ]
14259
14471
  });
14260
14472
  }