@drawnagency/primitives 0.1.22 → 0.1.24
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":"useBuildStatus.d.ts","sourceRoot":"","sources":["../../src/hooks/useBuildStatus.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useBuildStatus.d.ts","sourceRoot":"","sources":["../../src/hooks/useBuildStatus.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AASrE,UAAU,iBAAiB;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAMD,wBAAgB,cAAc,IAAI,iBAAiB,CAyHlD"}
|
package/package.json
CHANGED
|
@@ -890,8 +890,8 @@ function formatElapsed(seconds: number): string {
|
|
|
890
890
|
|
|
891
891
|
function DismissButton({ onClick }: { onClick: () => void }) {
|
|
892
892
|
return (
|
|
893
|
-
<button type="button" onClick={onClick} className="
|
|
894
|
-
<X size={12} />
|
|
893
|
+
<button type="button" onClick={onClick} className="cursor-pointer" aria-label="Dismiss">
|
|
894
|
+
<X size={12} className="text-base-content/30 hover:text-base-content/60" />
|
|
895
895
|
</button>
|
|
896
896
|
);
|
|
897
897
|
}
|
|
@@ -905,7 +905,7 @@ function StatusText({
|
|
|
905
905
|
}: {
|
|
906
906
|
publishAction: "idle" | "saving" | "publishing";
|
|
907
907
|
publishFeedback: string | null;
|
|
908
|
-
buildState: "idle" | "building" | "ready" | "error";
|
|
908
|
+
buildState: "idle" | "building" | "ready" | "error" | "fading";
|
|
909
909
|
buildElapsed: number;
|
|
910
910
|
onDismiss: () => void;
|
|
911
911
|
}) {
|
|
@@ -923,9 +923,12 @@ function StatusText({
|
|
|
923
923
|
</span>
|
|
924
924
|
);
|
|
925
925
|
}
|
|
926
|
-
if (buildState === "ready") {
|
|
926
|
+
if (buildState === "ready" || buildState === "fading") {
|
|
927
927
|
return (
|
|
928
|
-
<span className=
|
|
928
|
+
<span className={cn(
|
|
929
|
+
"inline-flex items-center gap-1.5 text-xs font-medium text-green-600 transition-opacity duration-1000",
|
|
930
|
+
buildState === "fading" ? "opacity-0" : "opacity-100",
|
|
931
|
+
)}>
|
|
929
932
|
Published in {formatElapsed(buildElapsed)}
|
|
930
933
|
<DismissButton onClick={onDismiss} />
|
|
931
934
|
</span>
|
|
@@ -979,7 +982,7 @@ function EditorToolbar({
|
|
|
979
982
|
onSettingsClick: () => void;
|
|
980
983
|
onMediaClick: () => void;
|
|
981
984
|
processingItems: QueueItem[];
|
|
982
|
-
buildState: "idle" | "building" | "ready" | "error";
|
|
985
|
+
buildState: "idle" | "building" | "ready" | "error" | "fading";
|
|
983
986
|
buildElapsed: number;
|
|
984
987
|
onBuildDismiss: () => void;
|
|
985
988
|
}) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useCallback, useEffect, useRef } from "react";
|
|
2
2
|
|
|
3
|
-
type BuildState = "idle" | "building" | "ready" | "error";
|
|
3
|
+
type BuildState = "idle" | "building" | "ready" | "error" | "fading";
|
|
4
4
|
|
|
5
5
|
interface BuildStatusResponse {
|
|
6
6
|
state: "building" | "ready" | "error";
|
|
@@ -18,7 +18,8 @@ interface BuildStatusResult {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const POLL_INTERVAL = 5000;
|
|
21
|
-
const AUTO_CLEAR_DELAY =
|
|
21
|
+
const AUTO_CLEAR_DELAY = 10000;
|
|
22
|
+
const FADE_DURATION = 1000;
|
|
22
23
|
|
|
23
24
|
export function useBuildStatus(): BuildStatusResult {
|
|
24
25
|
const [state, setState] = useState<BuildState>("idle");
|
|
@@ -81,7 +82,10 @@ export function useBuildStatus(): BuildStatusResult {
|
|
|
81
82
|
stopPolling();
|
|
82
83
|
stopTimer();
|
|
83
84
|
if (data.state === "ready") {
|
|
84
|
-
clearRef.current = setTimeout(() =>
|
|
85
|
+
clearRef.current = setTimeout(() => {
|
|
86
|
+
setState("fading");
|
|
87
|
+
clearRef.current = setTimeout(() => setState("idle"), FADE_DURATION);
|
|
88
|
+
}, AUTO_CLEAR_DELAY);
|
|
85
89
|
}
|
|
86
90
|
}
|
|
87
91
|
},
|