@drawnagency/primitives 0.1.11 → 0.1.12
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/{chunk-32H6Q6CX.js → chunk-2YYC2VJY.js} +1 -1
- package/dist/{chunk-XQXZHDNR.js → chunk-PHCEJP7I.js} +1 -1
- package/dist/{chunk-6SK5BLG3.js → chunk-Q7OKHD6I.js} +1 -1
- package/dist/components/editor/SectionWrapper.d.ts +1 -1
- package/dist/components/editor/SectionWrapper.d.ts.map +1 -1
- package/dist/components/editor/StatusDots.d.ts +25 -0
- package/dist/components/editor/StatusDots.d.ts.map +1 -0
- package/dist/components/editor/StatusPicker.d.ts +1 -1
- package/dist/components/editor/StatusPicker.d.ts.map +1 -1
- package/dist/components/editor/index.d.ts +1 -0
- package/dist/components/editor/index.d.ts.map +1 -1
- package/dist/components/shared/SegmentedControl.d.ts +13 -0
- package/dist/components/shared/SegmentedControl.d.ts.map +1 -0
- package/dist/components/shared/SplitButton.d.ts +17 -0
- package/dist/components/shared/SplitButton.d.ts.map +1 -0
- package/dist/components/shell/EditorContext.d.ts +2 -0
- package/dist/components/shell/EditorContext.d.ts.map +1 -1
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useContentLifecycle.d.ts +13 -0
- package/dist/hooks/useContentLifecycle.d.ts.map +1 -0
- package/dist/hooks/useEditorPublish.d.ts +5 -1
- package/dist/hooks/useEditorPublish.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/lib/dexie.d.ts +8 -1
- package/dist/lib/dexie.d.ts.map +1 -1
- package/dist/lib/index.js +2 -2
- package/dist/lib/registry.d.ts +6 -1
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/schemas/index.js +2 -2
- package/dist/schemas/site-config.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/editor/SectionWrapper.tsx +44 -2
- package/src/components/editor/StatusBadge.tsx +2 -2
- package/src/components/editor/StatusDots.tsx +131 -0
- package/src/components/editor/StatusPicker.tsx +6 -6
- package/src/components/editor/index.ts +1 -0
- package/src/components/sections/SectionLayout.tsx +1 -1
- package/src/components/shared/Navigation.tsx +3 -3
- package/src/components/shared/SegmentedControl.tsx +43 -0
- package/src/components/shared/SplitButton.tsx +97 -0
- package/src/components/shell/EditorContext.tsx +5 -1
- package/src/components/shell/EditorShell.tsx +157 -52
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useContentLifecycle.ts +34 -0
- package/src/hooks/useEditorPublish.ts +230 -66
- package/src/lib/dexie.ts +43 -2
- package/src/lib/registry.ts +6 -1
- package/src/schemas/site-config.ts +1 -1
|
@@ -155,7 +155,7 @@ function getSectionSchema() {
|
|
|
155
155
|
import { z as z3 } from "zod";
|
|
156
156
|
var SectionMetaSchema = z3.object({
|
|
157
157
|
type: z3.string(),
|
|
158
|
-
status: z3.enum(["draft", "
|
|
158
|
+
status: z3.enum(["draft", "live", "archived"]),
|
|
159
159
|
access: z3.array(z3.string())
|
|
160
160
|
});
|
|
161
161
|
var IndexSchema = z3.object({
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { WrapperProps } from "../../lib/registry";
|
|
2
|
-
export declare function SectionWrapper({ sectionId, sectionType, status, dirty, index, isLast, definition, options, audiences, access, onAccessChange, onStatusChange, onSectionChange, onReorder, onRequestInsert, onDelete, children, }: WrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function SectionWrapper({ sectionId, sectionType, status, dirty, index, isLast, definition, options, audiences, access, onAccessChange, onStatusChange, onSectionChange, onReorder, onRequestInsert, onDelete, isDeleted, onUndoDelete, mainStatus, contentDiffersFromMain, isLocalOnly, children, }: WrapperProps): import("react/jsx-runtime").JSX.Element | null;
|
|
3
3
|
//# sourceMappingURL=SectionWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/editor/SectionWrapper.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SectionWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/editor/SectionWrapper.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,WAAW,EACX,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,SAAS,EACT,MAAM,EACN,cAAc,EACd,cAAc,EACd,eAAe,EACf,SAAS,EACT,eAAe,EACf,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,UAAU,EACV,sBAAsB,EACtB,WAAW,EACX,QAAQ,GACT,EAAE,YAAY,kDA+Rd"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type StatusColor = "draft" | "live" | "archived" | "modified";
|
|
2
|
+
interface DotDef {
|
|
3
|
+
color: StatusColor;
|
|
4
|
+
}
|
|
5
|
+
interface DeriveInput {
|
|
6
|
+
mainStatus: string | null;
|
|
7
|
+
savedStatus: string;
|
|
8
|
+
contentDiffers: boolean;
|
|
9
|
+
isLocalOnly: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface DeriveResult {
|
|
12
|
+
dots: DotDef[];
|
|
13
|
+
label: "unsaved" | null;
|
|
14
|
+
description: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function deriveStatusDots({ mainStatus, savedStatus, contentDiffers, isLocalOnly }: DeriveInput): DeriveResult;
|
|
17
|
+
interface StatusDotsProps {
|
|
18
|
+
mainStatus: string | null;
|
|
19
|
+
savedStatus: string;
|
|
20
|
+
contentDiffers: boolean;
|
|
21
|
+
isLocalOnly: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function StatusDots(props: StatusDotsProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=StatusDots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusDots.d.ts","sourceRoot":"","sources":["../../../src/components/editor/StatusDots.tsx"],"names":[],"mappings":"AAIA,KAAK,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAE9D,UAAU,MAAM;IACd,KAAK,EAAE,WAAW,CAAC;CACpB;AAED,UAAU,WAAW;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB;AAqBD,wBAAgB,gBAAgB,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,EAAE,WAAW,GAAG,YAAY,CA8CpH;AAED,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CAiChD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusPicker.d.ts","sourceRoot":"","sources":["../../../src/components/editor/StatusPicker.tsx"],"names":[],"mappings":"AAMA,KAAK,MAAM,GAAG,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"StatusPicker.d.ts","sourceRoot":"","sources":["../../../src/components/editor/StatusPicker.tsx"],"names":[],"mappings":"AAMA,KAAK,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;AAE5C,UAAU,KAAK;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAgBD,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAyD9D"}
|
|
@@ -5,4 +5,5 @@ export { SettingsButton } from "./SettingsButton";
|
|
|
5
5
|
export { SettingsForm } from "./SettingsForm";
|
|
6
6
|
export { StatusBadge } from "./StatusBadge";
|
|
7
7
|
export { SectionWrapper } from "./SectionWrapper";
|
|
8
|
+
export { StatusDots, deriveStatusDots } from "./StatusDots";
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface SegmentedOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
}
|
|
5
|
+
interface SegmentedControlProps {
|
|
6
|
+
options: SegmentedOption[];
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function SegmentedControl({ options, value, onChange, className }: SegmentedControlProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=SegmentedControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../../../src/components/shared/SegmentedControl.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,qBAAqB;IAC7B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,qBAAqB,2CA4B9F"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface SplitButtonOption {
|
|
2
|
+
label: string;
|
|
3
|
+
onClick: () => void;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface SplitButtonProps {
|
|
7
|
+
label: string;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
options: SplitButtonOption[];
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
isLoading?: boolean;
|
|
12
|
+
loadingLabel?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function SplitButton({ label, onClick, options, disabled, isLoading, loadingLabel, className, }: SplitButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=SplitButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SplitButton.d.ts","sourceRoot":"","sources":["../../../src/components/shared/SplitButton.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,UAAU,gBAAgB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,OAAO,EACP,OAAO,EACP,QAAgB,EAChB,SAAiB,EACjB,YAAY,EACZ,SAAS,GACV,EAAE,gBAAgB,2CAkElB"}
|
|
@@ -2,8 +2,10 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
interface EditorContextValue {
|
|
3
3
|
isEditMode: boolean;
|
|
4
4
|
showAllChrome: boolean;
|
|
5
|
+
viewBranch: "saved" | "live";
|
|
5
6
|
toggleEditMode: () => void;
|
|
6
7
|
toggleShowAllChrome: () => void;
|
|
8
|
+
setViewBranch: (branch: "saved" | "live") => void;
|
|
7
9
|
}
|
|
8
10
|
interface EditorProviderProps {
|
|
9
11
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorContext.d.ts","sourceRoot":"","sources":["../../../src/components/shell/EditorContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzF,UAAU,kBAAkB;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,mBAAmB,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"EditorContext.d.ts","sourceRoot":"","sources":["../../../src/components/shell/EditorContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzF,UAAU,kBAAkB;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;CACnD;AAID,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CAqB/D;AAED,wBAAgB,gBAAgB,IAAI,kBAAkB,CAMrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorShell.d.ts","sourceRoot":"","sources":["../../../src/components/shell/EditorShell.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAYjD,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"EditorShell.d.ts","sourceRoot":"","sources":["../../../src/components/shell/EditorShell.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAYjD,OAAO,sBAAsB,CAAC;AAiC9B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAcxD,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,YAAY,EAAE;QACZ,KAAK,EAAE,OAAO,CAAC;QACf,aAAa,EAAE,OAAO,CAAC;QACvB,YAAY,EAAE,OAAO,CAAC;QACtB,cAAc,EAAE,OAAO,CAAC;QACxB,kBAAkB,EAAE,OAAO,CAAC;QAC5B,cAAc,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAA;KAAE,GAAG,IAAI,CAAC;CACjE;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,MAAM,EACN,SAAS,EAAE,gBAAgB,EAC3B,YAAY,EACZ,WAAW,GACZ,EAAE,KAAK,2CAkkBP"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useActiveHeadings } from "./useActiveHeadings";
|
|
2
|
+
export { useContentLifecycle } from "./useContentLifecycle";
|
|
2
3
|
export { useEditorPersistence } from "./useEditorPersistence";
|
|
3
4
|
export { useEditorPublish } from "./useEditorPublish";
|
|
4
5
|
export { useFocusTrap } from "./useFocusTrap";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type ButtonState = "synced" | "publish" | "saveAndPublish";
|
|
2
|
+
interface ContentLifecycleInput {
|
|
3
|
+
savedSha: string | null;
|
|
4
|
+
mainSha: string | null;
|
|
5
|
+
hasLocalChanges: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface ContentLifecycleResult {
|
|
8
|
+
buttonState: ButtonState;
|
|
9
|
+
hasSavedChanges: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function useContentLifecycle({ savedSha, mainSha, hasLocalChanges, }: ContentLifecycleInput): ContentLifecycleResult;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=useContentLifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useContentLifecycle.d.ts","sourceRoot":"","sources":["../../src/hooks/useContentLifecycle.ts"],"names":[],"mappings":"AAEA,KAAK,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,gBAAgB,CAAC;AAE3D,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,UAAU,sBAAsB;IAC9B,WAAW,EAAE,WAAW,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,OAAO,EACP,eAAe,GAChB,EAAE,qBAAqB,GAAG,sBAAsB,CAchD"}
|
|
@@ -9,16 +9,20 @@ interface PublishDeps {
|
|
|
9
9
|
siteIndexRef: React.RefObject<SiteIndex>;
|
|
10
10
|
siteConfig: SiteConfig | null;
|
|
11
11
|
sections: LoadedSection[];
|
|
12
|
+
deletedSectionIds?: string[];
|
|
12
13
|
onSuccess: () => void;
|
|
13
14
|
mediaManifest: MediaManifest;
|
|
14
15
|
pendingMediaItems: MediaItem[];
|
|
15
16
|
pendingMediaDeletions: string[];
|
|
16
17
|
onMediaPublished: (publishedItems: MediaItem[], publishedDeletions: string[]) => void;
|
|
18
|
+
onShasUpdated: (savedSha: string | null, mainSha: string | null) => void;
|
|
17
19
|
}
|
|
18
|
-
export declare function useEditorPublish({ flushNow, cancelPendingFlush, isConfigDirty, clearConfigDirty, siteIndexRef, siteConfig, sections, onSuccess, mediaManifest, pendingMediaItems, pendingMediaDeletions, onMediaPublished, }: PublishDeps): {
|
|
20
|
+
export declare function useEditorPublish({ flushNow, cancelPendingFlush, isConfigDirty, clearConfigDirty, siteIndexRef, siteConfig, sections, deletedSectionIds, onSuccess, mediaManifest, pendingMediaItems, pendingMediaDeletions, onMediaPublished, onShasUpdated, }: PublishDeps): {
|
|
19
21
|
isPublishing: boolean;
|
|
20
22
|
publishFeedback: string | null;
|
|
23
|
+
handleSave: () => Promise<void>;
|
|
21
24
|
handlePublish: () => Promise<void>;
|
|
25
|
+
handleSaveAndPublish: () => Promise<void>;
|
|
22
26
|
};
|
|
23
27
|
export {};
|
|
24
28
|
//# sourceMappingURL=useEditorPublish.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditorPublish.d.ts","sourceRoot":"","sources":["../../src/hooks/useEditorPublish.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAe/D,UAAU,WAAW;IACnB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,OAAO,CAAC;IAC7B,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACzC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,aAAa,EAAE,aAAa,CAAC;IAC7B,iBAAiB,EAAE,SAAS,EAAE,CAAC;IAC/B,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,gBAAgB,EAAE,CAAC,cAAc,EAAE,SAAS,EAAE,EAAE,kBAAkB,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"useEditorPublish.d.ts","sourceRoot":"","sources":["../../src/hooks/useEditorPublish.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE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
13
|
cn,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
safeRedirect,
|
|
28
28
|
sanitizeHtml,
|
|
29
29
|
toSectionId
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-Q7OKHD6I.js";
|
|
31
31
|
import {
|
|
32
32
|
ColorItemSchema,
|
|
33
33
|
ColorSpaceSchema,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
getSectionSchema,
|
|
49
49
|
registerSchema,
|
|
50
50
|
registerSection
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-PHCEJP7I.js";
|
|
52
52
|
import {
|
|
53
53
|
AUDIENCE_COOKIE,
|
|
54
54
|
LastOwnerError,
|
package/dist/lib/dexie.d.ts
CHANGED
|
@@ -10,9 +10,10 @@ export declare function restoreLocalChanges(): Promise<{
|
|
|
10
10
|
sections: Record<string, SectionContent>;
|
|
11
11
|
siteIndex?: SiteIndex;
|
|
12
12
|
siteConfig?: Record<string, unknown>;
|
|
13
|
+
deletedSections: string[];
|
|
13
14
|
}>;
|
|
14
15
|
export declare function discardLocalChanges(): Promise<void>;
|
|
15
|
-
export declare function persistSiteIndex(index: SiteIndex): Promise<void>;
|
|
16
|
+
export declare function persistSiteIndex(index: SiteIndex, deletedSections?: string[]): Promise<void>;
|
|
16
17
|
export declare function persistSiteConfig(config: Record<string, unknown>): Promise<void>;
|
|
17
18
|
export declare function hasLocalChanges(): Promise<boolean>;
|
|
18
19
|
export declare function getDirtySections(): Promise<{
|
|
@@ -23,6 +24,12 @@ export declare function persistAll(sections: {
|
|
|
23
24
|
sectionId: string;
|
|
24
25
|
content: SectionContent;
|
|
25
26
|
}[], siteIndex?: SiteIndex, deletedSectionIds?: string[], siteConfig?: Record<string, unknown>): Promise<void>;
|
|
27
|
+
export declare function updateBranchShas(savedSha: string | null, mainSha: string | null): Promise<void>;
|
|
28
|
+
export declare function getBranchShas(): Promise<{
|
|
29
|
+
savedSha: string | null;
|
|
30
|
+
mainSha: string | null;
|
|
31
|
+
} | null>;
|
|
32
|
+
export declare function getDeletedSections(): Promise<string[]>;
|
|
26
33
|
export declare function cacheContent(sha: string, sections: LoadedSection[], index: SiteIndex, siteConfig: Record<string, unknown>): Promise<void>;
|
|
27
34
|
export declare function getCachedContent(): Promise<{
|
|
28
35
|
sha: string;
|
package/dist/lib/dexie.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dexie.d.ts","sourceRoot":"","sources":["../../src/lib/dexie.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"dexie.d.ts","sourceRoot":"","sources":["../../src/lib/dexie.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAsH/D,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAcxF;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC;IACnD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,MAA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OKHD6I.js";
|
|
21
21
|
import {
|
|
22
22
|
clearRegistry,
|
|
23
23
|
createRegistry,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
getSection,
|
|
29
29
|
registerSchema,
|
|
30
30
|
registerSection
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-PHCEJP7I.js";
|
|
32
32
|
import "../chunk-F3Z6RISI.js";
|
|
33
33
|
import "../chunk-UMSFICAC.js";
|
|
34
34
|
export {
|
package/dist/lib/registry.d.ts
CHANGED
|
@@ -59,11 +59,16 @@ export interface WrapperProps {
|
|
|
59
59
|
audiences: Audience[];
|
|
60
60
|
access: string[];
|
|
61
61
|
onAccessChange?: (access: string[]) => void;
|
|
62
|
-
onStatusChange?: (status: "draft" | "
|
|
62
|
+
onStatusChange?: (status: "draft" | "live" | "archived") => void;
|
|
63
63
|
onSectionChange?: (options: Record<string, unknown>) => void;
|
|
64
64
|
onReorder?: (fromIndex: number, toIndex: number) => void;
|
|
65
65
|
onRequestInsert?: (index: number) => void;
|
|
66
66
|
onDelete?: () => void;
|
|
67
|
+
isDeleted?: boolean;
|
|
68
|
+
onUndoDelete?: () => void;
|
|
69
|
+
mainStatus?: string | null;
|
|
70
|
+
contentDiffersFromMain?: boolean;
|
|
71
|
+
isLocalOnly?: boolean;
|
|
67
72
|
children: React.ReactNode;
|
|
68
73
|
}
|
|
69
74
|
export interface SectionDefinition<T = unknown> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/lib/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAIhD,MAAM,MAAM,gBAAgB,GACxB;IACE,IAAI,EAAE,MAAM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AAG,EAAE,iBAAiB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IACnD,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACpD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;IACxD,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAC7C,cAAc,IAAI,iBAAiB,EAAE,CAAC;IACtC,aAAa,IAAI,OAAO,EAAE,CAAC;IAC3B,aAAa,IAAI,IAAI,CAAC;CACvB;AAED,wBAAgB,cAAc,IAAI,eAAe,CAiChD;AAYD,wBAAgB,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,GAAG,CAAC,GAAG,IAAI,CAEjE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAElE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAEtE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAE3D;AAED,wBAAgB,cAAc,IAAI,iBAAiB,EAAE,CAEpD;AAED,wBAAgB,aAAa,IAAI,OAAO,EAAE,CAEzC;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
SessionSchema,
|
|
8
8
|
SiteUserSchema,
|
|
9
9
|
slugifyAudienceName
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-2YYC2VJY.js";
|
|
11
11
|
import {
|
|
12
12
|
ColorItemSchema,
|
|
13
13
|
ColorSpaceSchema,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
TextLineSchema,
|
|
20
20
|
getSectionContentSchema,
|
|
21
21
|
getSectionSchema
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-PHCEJP7I.js";
|
|
23
23
|
import {
|
|
24
24
|
ImageManifestSchema,
|
|
25
25
|
MediaConfigSchema,
|
|
@@ -3,7 +3,7 @@ export declare const SectionMetaSchema: z.ZodObject<{
|
|
|
3
3
|
type: z.ZodString;
|
|
4
4
|
status: z.ZodEnum<{
|
|
5
5
|
draft: "draft";
|
|
6
|
-
|
|
6
|
+
live: "live";
|
|
7
7
|
archived: "archived";
|
|
8
8
|
}>;
|
|
9
9
|
access: z.ZodArray<z.ZodString>;
|
|
@@ -16,7 +16,7 @@ export declare const IndexSchema: z.ZodObject<{
|
|
|
16
16
|
type: z.ZodString;
|
|
17
17
|
status: z.ZodEnum<{
|
|
18
18
|
draft: "draft";
|
|
19
|
-
|
|
19
|
+
live: "live";
|
|
20
20
|
archived: "archived";
|
|
21
21
|
}>;
|
|
22
22
|
access: z.ZodArray<z.ZodString>;
|
package/package.json
CHANGED
|
@@ -7,11 +7,13 @@ import { SettingsButton } from "./SettingsButton";
|
|
|
7
7
|
import { StatusBadge } from "./StatusBadge";
|
|
8
8
|
import { StatusPicker } from "./StatusPicker";
|
|
9
9
|
import { AudiencePicker } from "./AudiencePicker";
|
|
10
|
+
import { StatusDots } from "./StatusDots";
|
|
10
11
|
import { SettingsForm } from "./SettingsForm";
|
|
11
12
|
import { useEditorContext } from "../shell/EditorContext";
|
|
12
13
|
import { useEditorModal } from "../shell/EditorModalContext";
|
|
13
14
|
import type { WrapperProps } from "../../lib/registry";
|
|
14
15
|
import { cn } from "../../lib/cn";
|
|
16
|
+
import { Button } from "../shared/Button";
|
|
15
17
|
|
|
16
18
|
export function SectionWrapper({
|
|
17
19
|
sectionId,
|
|
@@ -30,6 +32,11 @@ export function SectionWrapper({
|
|
|
30
32
|
onReorder,
|
|
31
33
|
onRequestInsert,
|
|
32
34
|
onDelete,
|
|
35
|
+
isDeleted,
|
|
36
|
+
onUndoDelete,
|
|
37
|
+
mainStatus,
|
|
38
|
+
contentDiffersFromMain,
|
|
39
|
+
isLocalOnly,
|
|
33
40
|
children,
|
|
34
41
|
}: WrapperProps) {
|
|
35
42
|
const { isEditMode, showAllChrome } = useEditorContext();
|
|
@@ -175,8 +182,35 @@ export function SectionWrapper({
|
|
|
175
182
|
}
|
|
176
183
|
}
|
|
177
184
|
|
|
185
|
+
if (isDeleted && isEditMode) {
|
|
186
|
+
return (
|
|
187
|
+
<div
|
|
188
|
+
ref={blockRef}
|
|
189
|
+
className="relative opacity-30 pointer-events-none"
|
|
190
|
+
data-section-id={sectionId}
|
|
191
|
+
data-section-type={sectionType}
|
|
192
|
+
>
|
|
193
|
+
<div className="pointer-events-auto absolute right-0 bottom-full z-30 mb-1">
|
|
194
|
+
<Button
|
|
195
|
+
variant="secondary"
|
|
196
|
+
size="sm"
|
|
197
|
+
onClick={onUndoDelete}
|
|
198
|
+
className="pointer-events-auto"
|
|
199
|
+
>
|
|
200
|
+
Undo delete
|
|
201
|
+
</Button>
|
|
202
|
+
</div>
|
|
203
|
+
{children}
|
|
204
|
+
</div>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (isDeleted) {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
|
|
178
212
|
if (!isEditMode) {
|
|
179
|
-
if (status && status !== "
|
|
213
|
+
if (status && status !== "live") {
|
|
180
214
|
return (
|
|
181
215
|
<div
|
|
182
216
|
className="relative"
|
|
@@ -244,6 +278,14 @@ export function SectionWrapper({
|
|
|
244
278
|
alwaysShow ? "opacity-100" : "opacity-0 group-hover:opacity-100",
|
|
245
279
|
)}
|
|
246
280
|
>
|
|
281
|
+
<div className="pointer-events-auto">
|
|
282
|
+
<StatusDots
|
|
283
|
+
mainStatus={mainStatus ?? null}
|
|
284
|
+
savedStatus={status as string}
|
|
285
|
+
contentDiffers={contentDiffersFromMain ?? false}
|
|
286
|
+
isLocalOnly={isLocalOnly ?? false}
|
|
287
|
+
/>
|
|
288
|
+
</div>
|
|
247
289
|
<div className="pointer-events-auto">
|
|
248
290
|
<AudiencePicker
|
|
249
291
|
access={access}
|
|
@@ -253,7 +295,7 @@ export function SectionWrapper({
|
|
|
253
295
|
</div>
|
|
254
296
|
<div className="pointer-events-auto">
|
|
255
297
|
<StatusPicker
|
|
256
|
-
status={status as "draft" | "
|
|
298
|
+
status={status as "draft" | "live" | "archived"}
|
|
257
299
|
dirty={dirty}
|
|
258
300
|
onChange={(s) => onStatusChange?.(s)}
|
|
259
301
|
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn";
|
|
2
2
|
|
|
3
|
-
type Status = "
|
|
3
|
+
type Status = "live" | "draft" | "archived";
|
|
4
4
|
|
|
5
5
|
interface StatusBadgeProps {
|
|
6
6
|
status: string;
|
|
@@ -8,7 +8,7 @@ interface StatusBadgeProps {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const statusClasses: Record<Status, string> = {
|
|
11
|
-
|
|
11
|
+
live: "bg-status-live-bg text-status-live-text",
|
|
12
12
|
draft: "bg-status-draft-bg text-status-draft-text",
|
|
13
13
|
archived: "bg-status-archived-bg text-status-archived-text",
|
|
14
14
|
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { useRef, useState } from "react";
|
|
2
|
+
import { cn } from "../../lib/cn";
|
|
3
|
+
import { Popover } from "../shared/Popover";
|
|
4
|
+
|
|
5
|
+
type StatusColor = "draft" | "live" | "archived" | "modified";
|
|
6
|
+
|
|
7
|
+
interface DotDef {
|
|
8
|
+
color: StatusColor;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface DeriveInput {
|
|
12
|
+
mainStatus: string | null;
|
|
13
|
+
savedStatus: string;
|
|
14
|
+
contentDiffers: boolean;
|
|
15
|
+
isLocalOnly: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface DeriveResult {
|
|
19
|
+
dots: DotDef[];
|
|
20
|
+
label: "unsaved" | null;
|
|
21
|
+
description: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const dotColorClasses: Record<StatusColor, string> = {
|
|
25
|
+
live: "bg-green-500",
|
|
26
|
+
draft: "bg-gray-400",
|
|
27
|
+
archived: "bg-white border-gray-300",
|
|
28
|
+
modified: "bg-orange-400",
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const descriptions: Record<string, string> = {
|
|
32
|
+
"live": "Live — synced",
|
|
33
|
+
"live,modified": "Live — unpublished content edits",
|
|
34
|
+
"live,draft": "Live on site, changed to draft",
|
|
35
|
+
"live,archived": "Live on site, will be hidden on publish",
|
|
36
|
+
"draft": "Draft — editor only",
|
|
37
|
+
"draft,live": "Draft, will become live on publish",
|
|
38
|
+
"archived": "Archived",
|
|
39
|
+
"archived,live": "Archived, will become live on publish",
|
|
40
|
+
"modified": "Unpublished content edits",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export function deriveStatusDots({ mainStatus, savedStatus, contentDiffers, isLocalOnly }: DeriveInput): DeriveResult {
|
|
44
|
+
const label: "unsaved" | null = isLocalOnly ? "unsaved" : null;
|
|
45
|
+
|
|
46
|
+
// New section — no main status
|
|
47
|
+
if (!mainStatus) {
|
|
48
|
+
return {
|
|
49
|
+
dots: [{ color: savedStatus as StatusColor }],
|
|
50
|
+
label,
|
|
51
|
+
description: `${savedStatus} — new section`,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Status changed between main and saved
|
|
56
|
+
if (mainStatus !== savedStatus) {
|
|
57
|
+
const key = `${mainStatus},${savedStatus}`;
|
|
58
|
+
return {
|
|
59
|
+
dots: [{ color: mainStatus as StatusColor }, { color: savedStatus as StatusColor }],
|
|
60
|
+
label,
|
|
61
|
+
description: descriptions[key] ?? `${mainStatus} → ${savedStatus}`,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Same status — check content differences
|
|
66
|
+
if (contentDiffers) {
|
|
67
|
+
// Only show orange (modified) dot for live sections
|
|
68
|
+
if (mainStatus === "live") {
|
|
69
|
+
return {
|
|
70
|
+
dots: [{ color: "live" }, { color: "modified" }],
|
|
71
|
+
label,
|
|
72
|
+
description: descriptions["live,modified"]!,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
// Draft/archived with content changes — no second dot
|
|
76
|
+
return {
|
|
77
|
+
dots: [{ color: mainStatus as StatusColor }],
|
|
78
|
+
label,
|
|
79
|
+
description: `${mainStatus} — with edits`,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Fully synced
|
|
84
|
+
return {
|
|
85
|
+
dots: [{ color: mainStatus as StatusColor }],
|
|
86
|
+
label: null,
|
|
87
|
+
description: descriptions[mainStatus] ?? mainStatus,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface StatusDotsProps {
|
|
92
|
+
mainStatus: string | null;
|
|
93
|
+
savedStatus: string;
|
|
94
|
+
contentDiffers: boolean;
|
|
95
|
+
isLocalOnly: boolean;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function StatusDots(props: StatusDotsProps) {
|
|
99
|
+
const { dots, label, description } = deriveStatusDots(props);
|
|
100
|
+
const [open, setOpen] = useState(false);
|
|
101
|
+
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<div className="relative">
|
|
105
|
+
<button
|
|
106
|
+
ref={buttonRef}
|
|
107
|
+
type="button"
|
|
108
|
+
onClick={() => setOpen((v) => !v)}
|
|
109
|
+
className="cursor-pointer inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium border border-base-200 hover:bg-base-accent"
|
|
110
|
+
aria-label={description}
|
|
111
|
+
>
|
|
112
|
+
<span className="flex -space-x-1">
|
|
113
|
+
{dots.map((dot, i) => (
|
|
114
|
+
<span
|
|
115
|
+
key={i}
|
|
116
|
+
aria-hidden="true"
|
|
117
|
+
className={cn("h-3 w-3 rounded-full border border-base", dotColorClasses[dot.color])}
|
|
118
|
+
/>
|
|
119
|
+
))}
|
|
120
|
+
</span>
|
|
121
|
+
{label && <span className="opacity-70">(unsaved)</span>}
|
|
122
|
+
</button>
|
|
123
|
+
|
|
124
|
+
<Popover isOpen={open} onClose={() => setOpen(false)} anchorRef={buttonRef} align="end" className="w-56">
|
|
125
|
+
<div className="px-3 py-2 text-xs text-base-contrast">
|
|
126
|
+
{description}
|
|
127
|
+
</div>
|
|
128
|
+
</Popover>
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
}
|