@drawnagency/primitives 0.1.16 → 0.1.18
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.
|
@@ -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;AAkC9B,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,2CAqkBP"}
|
package/package.json
CHANGED
|
@@ -37,7 +37,6 @@ import { useEditorPersistence } from "../../hooks/useEditorPersistence";
|
|
|
37
37
|
import { useEditorPublish } from "../../hooks/useEditorPublish";
|
|
38
38
|
import { useContentLifecycle } from "../../hooks/useContentLifecycle";
|
|
39
39
|
import { useBuildStatus } from "../../hooks/useBuildStatus";
|
|
40
|
-
import { BuildStatusIndicator } from "./BuildStatusIndicator";
|
|
41
40
|
import { useMediaPipeline } from "../../hooks/useMediaPipeline";
|
|
42
41
|
import { formatTimestamp } from "../../lib/timestamp";
|
|
43
42
|
import { generateNavLinks } from "../../lib/nav";
|
|
@@ -234,6 +233,7 @@ export default function EditorShell({
|
|
|
234
233
|
loadedConfig = SiteConfigSchema.parse(cached.siteConfig);
|
|
235
234
|
const savedManifest = await getMediaManifest();
|
|
236
235
|
if (savedManifest) loadedManifest = savedManifest;
|
|
236
|
+
setMainIndex(loadedIndex);
|
|
237
237
|
} else {
|
|
238
238
|
const response = await fetch("/api/content?branch=saved");
|
|
239
239
|
if (!response.ok) throw new Error(`Failed to load content: ${response.status}`);
|
|
@@ -249,9 +249,7 @@ export default function EditorShell({
|
|
|
249
249
|
setSavedSha(data.savedBranchSha ?? null);
|
|
250
250
|
setMainSha(data.sha);
|
|
251
251
|
setChangedSectionIds(new Set(data.changedSectionIds ?? []));
|
|
252
|
-
|
|
253
|
-
setMainIndex(data.mainIndex);
|
|
254
|
-
}
|
|
252
|
+
setMainIndex(data.mainIndex ?? data.index);
|
|
255
253
|
}
|
|
256
254
|
|
|
257
255
|
if (cancelled) return;
|
|
@@ -587,7 +585,6 @@ export default function EditorShell({
|
|
|
587
585
|
}}
|
|
588
586
|
processingItems={mediaPipeline.processingItems}
|
|
589
587
|
buildState={buildStatus.state}
|
|
590
|
-
buildDeployUrl={buildStatus.deployUrl}
|
|
591
588
|
/>
|
|
592
589
|
|
|
593
590
|
<EditorContent
|
|
@@ -874,6 +871,43 @@ function GlobalModal() {
|
|
|
874
871
|
);
|
|
875
872
|
}
|
|
876
873
|
|
|
874
|
+
function StatusText({
|
|
875
|
+
publishAction,
|
|
876
|
+
publishFeedback,
|
|
877
|
+
buildState,
|
|
878
|
+
}: {
|
|
879
|
+
publishAction: "idle" | "saving" | "publishing";
|
|
880
|
+
publishFeedback: string | null;
|
|
881
|
+
buildState: "idle" | "building" | "ready" | "error";
|
|
882
|
+
}) {
|
|
883
|
+
if (publishAction === "saving") {
|
|
884
|
+
return <span className="text-xs font-medium text-base-content/60">Saving...</span>;
|
|
885
|
+
}
|
|
886
|
+
if (publishAction === "publishing") {
|
|
887
|
+
return <span className="text-xs font-medium text-base-content/60">Publishing...</span>;
|
|
888
|
+
}
|
|
889
|
+
if (buildState === "building") {
|
|
890
|
+
return <span className="text-xs font-medium text-orange-600">Publishing...</span>;
|
|
891
|
+
}
|
|
892
|
+
if (buildState === "ready") {
|
|
893
|
+
return <span className="text-xs font-medium text-green-600">Published</span>;
|
|
894
|
+
}
|
|
895
|
+
if (buildState === "error") {
|
|
896
|
+
return <span className="text-xs font-medium text-red-600">Publish failed</span>;
|
|
897
|
+
}
|
|
898
|
+
if (publishFeedback) {
|
|
899
|
+
return (
|
|
900
|
+
<span className={cn(
|
|
901
|
+
"text-xs font-medium",
|
|
902
|
+
publishFeedback === "Saved" ? "text-green-600" : "text-red-600",
|
|
903
|
+
)}>
|
|
904
|
+
{publishFeedback}
|
|
905
|
+
</span>
|
|
906
|
+
);
|
|
907
|
+
}
|
|
908
|
+
return null;
|
|
909
|
+
}
|
|
910
|
+
|
|
877
911
|
function EditorToolbar({
|
|
878
912
|
buttonState,
|
|
879
913
|
localChangesExist,
|
|
@@ -887,7 +921,6 @@ function EditorToolbar({
|
|
|
887
921
|
onMediaClick,
|
|
888
922
|
processingItems,
|
|
889
923
|
buildState,
|
|
890
|
-
buildDeployUrl,
|
|
891
924
|
}: {
|
|
892
925
|
buttonState: "synced" | "publish" | "saveAndPublish";
|
|
893
926
|
localChangesExist: boolean;
|
|
@@ -901,31 +934,19 @@ function EditorToolbar({
|
|
|
901
934
|
onMediaClick: () => void;
|
|
902
935
|
processingItems: QueueItem[];
|
|
903
936
|
buildState: "idle" | "building" | "ready" | "error";
|
|
904
|
-
buildDeployUrl: string | null;
|
|
905
937
|
}) {
|
|
906
938
|
const { isEditMode, viewBranch, setViewBranch, toggleEditMode } = useEditorContext();
|
|
907
939
|
|
|
908
940
|
return (
|
|
909
941
|
<>
|
|
910
942
|
{isEditMode && (
|
|
911
|
-
<div className="fixed top-0 right-0 left-0 z-50
|
|
943
|
+
<div className="fixed top-0 right-0 left-0 z-50 grid grid-cols-3 items-center border-b border-base-200 bg-base px-4 py-2">
|
|
912
944
|
<div className="flex items-center gap-2">
|
|
913
|
-
{publishFeedback && (
|
|
914
|
-
<span className={cn(
|
|
915
|
-
"text-xs font-medium",
|
|
916
|
-
publishFeedback === "Saved"
|
|
917
|
-
? "text-green-600"
|
|
918
|
-
: "text-red-600",
|
|
919
|
-
)}>
|
|
920
|
-
{publishFeedback}
|
|
921
|
-
</span>
|
|
922
|
-
)}
|
|
923
945
|
{buttonState === "saveAndPublish" && (
|
|
924
946
|
<SplitButton
|
|
925
947
|
label="Save & Publish"
|
|
926
948
|
onClick={onSaveAndPublish}
|
|
927
|
-
|
|
928
|
-
loadingLabel={publishAction === "saving" ? "Saving..." : "Publishing..."}
|
|
949
|
+
disabled={publishAction !== "idle"}
|
|
929
950
|
options={[{ label: "Save", onClick: onSave }]}
|
|
930
951
|
/>
|
|
931
952
|
)}
|
|
@@ -933,14 +954,13 @@ function EditorToolbar({
|
|
|
933
954
|
<SplitButton
|
|
934
955
|
label="Publish"
|
|
935
956
|
onClick={onPublish}
|
|
936
|
-
|
|
937
|
-
loadingLabel="Publishing..."
|
|
957
|
+
disabled={publishAction !== "idle"}
|
|
938
958
|
options={[]}
|
|
939
959
|
/>
|
|
940
960
|
)}
|
|
941
961
|
{buttonState === "synced" && (
|
|
942
962
|
<SplitButton
|
|
943
|
-
label="
|
|
963
|
+
label="Up to date"
|
|
944
964
|
onClick={() => {}}
|
|
945
965
|
disabled
|
|
946
966
|
options={[]}
|
|
@@ -955,12 +975,15 @@ function EditorToolbar({
|
|
|
955
975
|
Discard Changes
|
|
956
976
|
</Button>
|
|
957
977
|
)}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
978
|
+
</div>
|
|
979
|
+
<div className="flex items-center justify-center">
|
|
980
|
+
<StatusText
|
|
981
|
+
publishAction={publishAction}
|
|
982
|
+
publishFeedback={publishFeedback}
|
|
983
|
+
buildState={buildState}
|
|
961
984
|
/>
|
|
962
985
|
</div>
|
|
963
|
-
<div className="flex items-center gap-2">
|
|
986
|
+
<div className="flex items-center justify-end gap-2">
|
|
964
987
|
<ProcessingIndicator items={processingItems} />
|
|
965
988
|
<IconButton
|
|
966
989
|
icon={<ImageIcon size={16} />}
|