Skip to content

Commit

Permalink
feat: loading folder
Browse files Browse the repository at this point in the history
  • Loading branch information
vilde-barth-adsk committed Nov 7, 2023
1 parent 0ca0d17 commit a80ff19
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions analyses/dynamo/src/floatingpanel/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ try {
console.error(e);
}

function LoadingScriptList() {
return (
<div style={{ width: "100%" }}>
{[...Array(3)].map(() => {
return (
<div
style={{
display: "flex",
width: "100%",
height: "40px",
alignItems: "center",
}}
>
<weave-skeleton-item height="30px"></weave-skeleton-item>
</div>
);
})}
</div>
);
}

function ScriptListItem({ name, code, setScript }: any) {
const [hover, setHover] = useState(false);

Expand Down Expand Up @@ -106,14 +127,16 @@ function ScriptList({ setScript, dynamoHandler }: any) {
{error && <div style={{ color: "red" }}>{error}</div>}
{folder && (
<div>
{Object.entries(programs).map(([name, code]) => (
<ScriptListItem
key={name}
name={name}
code={code}
setScript={setScript}
/>
))}
{isLoading && <LoadingScriptList />}
{!isLoading &&
Object.entries(programs).map(([name, code]) => (
<ScriptListItem
key={name}
name={name}
code={code}
setScript={setScript}
/>
))}
{!isLoading && !error && Object.keys(programs).length === 0 && (
<div style={{ color: "gray" }}>No graphs found in folder.</div>
)}
Expand Down

0 comments on commit a80ff19

Please sign in to comment.