Skip to content

Commit d2298f4

Browse files
Hardik ModiCompuIves
authored andcommitted
refactor /app/pages/common/Modals/LiveSessionEnded/index.js to use OverMind and change it to tsx file (codesandbox#2807)
1 parent 6036095 commit d2298f4

File tree

1 file changed

+26
-16
lines changed
  • packages/app/src/app/pages/common/Modals/LiveSessionEnded

1 file changed

+26
-16
lines changed

packages/app/src/app/pages/common/Modals/LiveSessionEnded/index.js renamed to packages/app/src/app/pages/common/Modals/LiveSessionEnded/index.tsx

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,44 @@
1-
import React from 'react';
2-
import { inject, hooksObserver } from 'app/componentConnectors';
3-
41
import { Button } from '@codesandbox/common/lib/components/Button';
52
import Row from '@codesandbox/common/lib/components/flex/Row';
6-
3+
import { useOvermind } from 'app/overmind';
4+
import React, { FunctionComponent } from 'react';
5+
import { Explanation, Heading } from '../elements';
76
import { Container } from './elements';
8-
import { Heading, Explanation } from '../elements';
97

10-
function LiveModeEnded({ signals, store }) {
11-
const suggestion = store.editor.currentSandbox.owned
8+
const LiveModeEnded: FunctionComponent = () => {
9+
const {
10+
state: {
11+
editor: {
12+
currentSandbox: { owned },
13+
},
14+
currentModalMessage,
15+
},
16+
actions: {
17+
modalClosed,
18+
editor: { forkSandboxClicked },
19+
},
20+
} = useOvermind();
21+
const suggestion = owned
1222
? 'you can continue working on the current sandbox.'
1323
: 'you can continue working by forking the sandbox or by creating a new sandbox.';
1424
return (
1525
<Container>
1626
<Heading>The live session has ended</Heading>
17-
<Explanation css={{ marginBottom: '1rem' }}>
18-
{store.currentModalMessage || 'The session has ended due to inactivity'}
19-
, {suggestion}
27+
<Explanation style={{ marginBottom: '1rem' }}>
28+
{currentModalMessage || 'The session has ended due to inactivity'},{' '}
29+
{suggestion}
2030
</Explanation>
2131

2232
<Row justifyContent="space-around">
2333
<Button small href="/s">
2434
Create Sandbox
2535
</Button>
2636

27-
{store.editor.currentSandbox.owned ? (
37+
{owned ? (
2838
<Button
2939
small
3040
onClick={() => {
31-
signals.modalClosed();
41+
modalClosed();
3242
}}
3343
>
3444
Close Modal
@@ -37,8 +47,8 @@ function LiveModeEnded({ signals, store }) {
3747
<Button
3848
small
3949
onClick={() => {
40-
signals.editor.forkSandboxClicked();
41-
signals.modalClosed();
50+
forkSandboxClicked();
51+
modalClosed();
4252
}}
4353
>
4454
Fork Sandbox
@@ -47,6 +57,6 @@ function LiveModeEnded({ signals, store }) {
4757
</Row>
4858
</Container>
4959
);
50-
}
60+
};
5161

52-
export default inject('signals', 'store')(hooksObserver(LiveModeEnded));
62+
export default LiveModeEnded;

0 commit comments

Comments
 (0)