Skip to content

Commit ae990d4

Browse files
committed
Refactor on /Modals/SelectSandboxModal/index.js
1 parent e11c3ea commit ae990d4

File tree

2 files changed

+40
-31
lines changed

2 files changed

+40
-31
lines changed

packages/app/src/app/pages/common/Modals/SelectSandboxModal/index.js

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React, { FunctionComponent } from 'react';
2+
import Sandbox from './Sandbox';
3+
4+
import { Padding } from './elements';
5+
import { useOvermind } from 'app/overmind';
6+
7+
export const SelectSandboxModal: FunctionComponent = () => {
8+
const {
9+
state: {
10+
profile: {
11+
isLoadingSandboxes,
12+
showcasedSandbox,
13+
userSandboxes
14+
}
15+
},
16+
actions: {
17+
profile: { newSandboxShowcaseSelected }
18+
}
19+
} = useOvermind();
20+
21+
if (isLoadingSandboxes)
22+
return <Padding>Loading sandboxes...</Padding>;
23+
24+
const currentShowcasedSandboxId = showcasedSandbox && showcasedSandbox.id;
25+
26+
return (
27+
<div>
28+
{userSandboxes
29+
.filter(x => x)
30+
.map(sandbox => (
31+
<Sandbox
32+
active={sandbox.id === currentShowcasedSandboxId}
33+
key={sandbox.id}
34+
sandbox={sandbox}
35+
setShowcasedSandbox={id => newSandboxShowcaseSelected({ id })}
36+
/>
37+
))}
38+
</div>
39+
);
40+
};

0 commit comments

Comments
 (0)