codacus commited on
Commit
417dbca
·
1 Parent(s): 4139dbd

added spinner

Browse files
Files changed (1) hide show
  1. app/components/chat/Artifact.tsx +11 -1
app/components/chat/Artifact.tsx CHANGED
@@ -28,6 +28,7 @@ interface ArtifactProps {
28
  export const Artifact = memo(({ messageId }: ArtifactProps) => {
29
  const userToggledActions = useRef(false);
30
  const [showActions, setShowActions] = useState(false);
 
31
 
32
  const artifacts = useStore(workbenchStore.artifacts);
33
  const artifact = artifacts[messageId];
@@ -47,6 +48,11 @@ export const Artifact = memo(({ messageId }: ArtifactProps) => {
47
  if (actions.length && !showActions && !userToggledActions.current) {
48
  setShowActions(true);
49
  }
 
 
 
 
 
50
  }, [actions]);
51
 
52
  return (
@@ -62,7 +68,11 @@ export const Artifact = memo(({ messageId }: ArtifactProps) => {
62
  {artifact.type == 'bundled' && (
63
  <>
64
  <div className="p-4">
65
- <div className={'i-ph:files-light'} style={{ fontSize: '2rem' }}></div>
 
 
 
 
66
  </div>
67
  <div className="bg-bolt-elements-artifacts-borderColor w-[1px]" />
68
  </>
 
28
  export const Artifact = memo(({ messageId }: ArtifactProps) => {
29
  const userToggledActions = useRef(false);
30
  const [showActions, setShowActions] = useState(false);
31
+ const [allActionFinished, setAllActionFinished] = useState(false);
32
 
33
  const artifacts = useStore(workbenchStore.artifacts);
34
  const artifact = artifacts[messageId];
 
48
  if (actions.length && !showActions && !userToggledActions.current) {
49
  setShowActions(true);
50
  }
51
+
52
+ if (actions.length !== 0) {
53
+ const finished = !actions.find((action) => action.status !== 'complete');
54
+ setAllActionFinished(finished);
55
+ }
56
  }, [actions]);
57
 
58
  return (
 
68
  {artifact.type == 'bundled' && (
69
  <>
70
  <div className="p-4">
71
+ {allActionFinished ? (
72
+ <div className={'i-ph:files-light'} style={{ fontSize: '2rem' }}></div>
73
+ ) : (
74
+ <div className={'i-svg-spinners:90-ring-with-bg'} style={{ fontSize: '2rem' }}></div>
75
+ )}
76
  </div>
77
  <div className="bg-bolt-elements-artifacts-borderColor w-[1px]" />
78
  </>