Skip to content

Commit 43453f2

Browse files
MihirGHCompuIves
authored andcommitted
Refactor, Overmind: Refactor SelectSandboxModal which now uses useOvermind (codesandbox#2743)
1 parent 9937d18 commit 43453f2

File tree

2 files changed

+36
-31
lines changed

2 files changed

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

0 commit comments

Comments
 (0)