Skip to content

Commit de4fa91

Browse files
MichaelDeBoeySaraVieira
authored andcommitted
🔨 Switch SSEDownNotice to use useOvermind (codesandbox#2559)
1 parent 93690fb commit de4fa91

File tree

1 file changed

+51
-52
lines changed

1 file changed

+51
-52
lines changed
Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,58 @@
11
import getTemplate from '@codesandbox/common/lib/templates';
2-
import { inject, hooksObserver } from 'app/componentConnectors';
3-
import React from 'react';
2+
import React, { FunctionComponent } from 'react';
3+
4+
import { useOvermind } from 'app/overmind';
45

56
import { Container } from './elements';
67

7-
export const SSEDownNotice = inject('store')(
8-
hooksObserver(
9-
({
10-
store: {
11-
editor: {
12-
currentSandbox: { template },
13-
},
14-
server: { status },
8+
export const SSEDownNotice: FunctionComponent = () => {
9+
const {
10+
state: {
11+
editor: {
12+
currentSandbox: { template },
1513
},
16-
}) => {
17-
if (!getTemplate(template).isServer) {
18-
return null;
19-
}
14+
server: { status },
15+
},
16+
} = useOvermind();
17+
18+
if (!getTemplate(template).isServer) {
19+
return null;
20+
}
2021

21-
if (status !== 'disconnected') {
22-
return null;
23-
}
22+
if (status !== 'disconnected') {
23+
return null;
24+
}
2425

25-
return (
26-
<Container>
27-
<p
28-
style={{
29-
color: '#FFFFFF',
30-
fontSize: '.875rem',
31-
fontWeight: 700,
32-
marginTop: 0,
33-
}}
34-
>
35-
Server Connection Trouble
36-
</p>
37-
It seems like our Server Manager is either updating or experiencing
38-
some heavy load. Reconnecting in a couple seconds...
39-
<p style={{ marginBottom: 0 }}>
40-
We
41-
{"'"}
42-
re working on fixing this as soon as possible. If this isn
43-
{"'"}t resolved with in a minute it would greatly help us if you
44-
could let us know on{' '}
45-
<a
46-
href="https://spectrum.chat/codesandbox"
47-
rel="noopener noreferrer"
48-
style={{ color: '#FFFFFF' }}
49-
target="_blank"
50-
>
51-
Spectrum
52-
</a>
53-
.
54-
</p>
55-
</Container>
56-
);
57-
}
58-
)
59-
);
26+
return (
27+
<Container>
28+
<p
29+
style={{
30+
color: '#FFFFFF',
31+
fontSize: '.875rem',
32+
fontWeight: 700,
33+
marginTop: 0,
34+
}}
35+
>
36+
Server Connection Trouble
37+
</p>
38+
It seems like our Server Manager is either updating or experiencing some
39+
heavy load. Reconnecting in a couple seconds...
40+
<p style={{ marginBottom: 0 }}>
41+
We
42+
{"'"}
43+
re working on fixing this as soon as possible. If this isn
44+
{"'"}t resolved with in a minute it would greatly help us if you could
45+
let us know on{' '}
46+
<a
47+
href="https://spectrum.chat/codesandbox"
48+
rel="noopener noreferrer"
49+
style={{ color: '#FFFFFF' }}
50+
target="_blank"
51+
>
52+
Spectrum
53+
</a>
54+
.
55+
</p>
56+
</Container>
57+
);
58+
};

0 commit comments

Comments
 (0)