mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-01-23 03:07:05 +00:00
added spinner
This commit is contained in:
parent
4139dbd0df
commit
417dbcab9b
@ -28,6 +28,7 @@ interface ArtifactProps {
|
|||||||
export const Artifact = memo(({ messageId }: ArtifactProps) => {
|
export const Artifact = memo(({ messageId }: ArtifactProps) => {
|
||||||
const userToggledActions = useRef(false);
|
const userToggledActions = useRef(false);
|
||||||
const [showActions, setShowActions] = useState(false);
|
const [showActions, setShowActions] = useState(false);
|
||||||
|
const [allActionFinished, setAllActionFinished] = useState(false);
|
||||||
|
|
||||||
const artifacts = useStore(workbenchStore.artifacts);
|
const artifacts = useStore(workbenchStore.artifacts);
|
||||||
const artifact = artifacts[messageId];
|
const artifact = artifacts[messageId];
|
||||||
@ -47,6 +48,11 @@ export const Artifact = memo(({ messageId }: ArtifactProps) => {
|
|||||||
if (actions.length && !showActions && !userToggledActions.current) {
|
if (actions.length && !showActions && !userToggledActions.current) {
|
||||||
setShowActions(true);
|
setShowActions(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (actions.length !== 0) {
|
||||||
|
const finished = !actions.find((action) => action.status !== 'complete');
|
||||||
|
setAllActionFinished(finished);
|
||||||
|
}
|
||||||
}, [actions]);
|
}, [actions]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -62,7 +68,11 @@ export const Artifact = memo(({ messageId }: ArtifactProps) => {
|
|||||||
{artifact.type == 'bundled' && (
|
{artifact.type == 'bundled' && (
|
||||||
<>
|
<>
|
||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
|
{allActionFinished ? (
|
||||||
<div className={'i-ph:files-light'} style={{ fontSize: '2rem' }}></div>
|
<div className={'i-ph:files-light'} style={{ fontSize: '2rem' }}></div>
|
||||||
|
) : (
|
||||||
|
<div className={'i-svg-spinners:90-ring-with-bg'} style={{ fontSize: '2rem' }}></div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="bg-bolt-elements-artifacts-borderColor w-[1px]" />
|
<div className="bg-bolt-elements-artifacts-borderColor w-[1px]" />
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user