Skip to content

Commit 6d33856

Browse files
committed
refactor NetlifyLogs
1 parent 0e9c0cf commit 6d33856

File tree

5 files changed

+62
-54
lines changed

5 files changed

+62
-54
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,15 @@
14311431
"contributions": [
14321432
"code"
14331433
]
1434+
},
1435+
{
1436+
"login": "NileshPatel17",
1437+
"name": "Nilesh Patel",
1438+
"avatar_url": "https://avatars2.githubusercontent.com/u/27020381?v=4",
1439+
"profile": "https://github.com/NileshPatel17",
1440+
"contributions": [
1441+
"code"
1442+
]
14341443
}
14351444
],
14361445
"contributorsPerLine": 7,

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [CodeSandbox](https://codesandbox.io) [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/codesandbox) [![All Contributors](https://img.shields.io/badge/all_contributors-149-orange.svg?style=flat-square)](#contributors-) [![CircleCI](https://circleci.com/gh/codesandbox/codesandbox-client.svg?style=svg)](https://circleci.com/gh/codesandbox/codesandbox-client) [![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=cVJuczlJWUtqWXhIbFN1ZjVQekF4NzNsd3phNEZRaGlWU0pHYVVkdGRFWT0tLXFtTVhaOWRySmN0ZG5QVDNDQ0g5Z0E9PQ==--79fe3eae4f149a400d396c9b12d3988f685785cf)](https://www.browserstack.com/automate/public-build/cVJuczlJWUtqWXhIbFN1ZjVQekF4NzNsd3phNEZRaGlWU0pHYVVkdGRFWT0tLXFtTVhaOWRySmN0ZG5QVDNDQ0g5Z0E9PQ==--79fe3eae4f149a400d396c9b12d3988f685785cf) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![first-timers-only Friendly](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](http://www.firsttimersonly.com/) [![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)
1+
# [CodeSandbox](https://codesandbox.io) [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/codesandbox) [![All Contributors](https://img.shields.io/badge/all_contributors-153-orange.svg?style=flat-square)](#contributors-) [![CircleCI](https://circleci.com/gh/codesandbox/codesandbox-client.svg?style=svg)](https://circleci.com/gh/codesandbox/codesandbox-client) [![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=cVJuczlJWUtqWXhIbFN1ZjVQekF4NzNsd3phNEZRaGlWU0pHYVVkdGRFWT0tLXFtTVhaOWRySmN0ZG5QVDNDQ0g5Z0E9PQ==--79fe3eae4f149a400d396c9b12d3988f685785cf)](https://www.browserstack.com/automate/public-build/cVJuczlJWUtqWXhIbFN1ZjVQekF4NzNsd3phNEZRaGlWU0pHYVVkdGRFWT0tLXFtTVhaOWRySmN0ZG5QVDNDQ0g5Z0E9PQ==--79fe3eae4f149a400d396c9b12d3988f685785cf) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![first-timers-only Friendly](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](http://www.firsttimersonly.com/) [![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)
22

33
[![Backers on Open Collective](https://opencollective.com/codesandbox/backers/badge.svg)](#backers)
44
[![Sponsors on Open Collective](https://opencollective.com/codesandbox/sponsors/badge.svg)](#sponsors)
@@ -239,11 +239,13 @@ Thanks goes to these wonderful people
239239
<td align="center"><a href="https://armujahid.me"><img src="https://avatars1.githubusercontent.com/u/3725386?v=4" width="100px;" alt="Abdul Rauf"/><br /><sub><b>Abdul Rauf</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=armujahid" title="Code">💻</a> <a href="https://github.com/codesandbox/codesandbox-client/commits?author=armujahid" title="Documentation">📖</a></td>
240240
<td align="center"><a href="https://github.com/milap1296"><img src="https://avatars2.githubusercontent.com/u/19545730?v=4" width="100px;" alt="milap1296"/><br /><sub><b>milap1296</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=milap1296" title="Code">💻</a></td>
241241
<td align="center"><a href="http://yevhenorlov.com"><img src="https://avatars2.githubusercontent.com/u/17388747?v=4" width="100px;" alt="yevhen orlov"/><br /><sub><b>yevhen orlov</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=yevhenorlov" title="Code">💻</a></td>
242+
<td align="center"><a href="https://github.com/NileshPatel17"><img src="https://avatars2.githubusercontent.com/u/27020381?v=4" width="100px;" alt="Nilesh Patel"/><br /><sub><b>Nilesh Patel</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=NileshPatel17" title="Code">💻</a></td>
242243
</tr>
243244
</table>
244245

245246
<!-- markdownlint-enable -->
246247
<!-- prettier-ignore-end -->
248+
247249
<!-- ALL-CONTRIBUTORS-LIST:END -->
248250

249251
## Backers

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

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import React, { FunctionComponent, useState, useEffect } from 'react';
2+
import { useOvermind } from 'app/overmind';
3+
4+
import { Button } from '@codesandbox/common/lib/components/Button';
5+
import { Container } from '../LiveSessionEnded/elements';
6+
import { Heading, Explanation } from '../elements';
7+
8+
import { List, Item } from './elements';
9+
10+
const NetlifyLogs: FunctionComponent = () => {
11+
const [logs, setLogs] = useState(['Contacting Netlify']);
12+
const {
13+
state: {
14+
deployment: { netlifyLogs: url },
15+
},
16+
actions: { modalClosed },
17+
} = useOvermind();
18+
19+
useEffect(() => {
20+
const getLogs = async apiUrl => {
21+
const data = await fetch(apiUrl);
22+
const { logs: newLogs } = await data.json();
23+
setLogs(newLogs);
24+
};
25+
const interval = setInterval(() => getLogs(url), 2000);
26+
return () => {
27+
clearInterval(interval);
28+
};
29+
}, [url]);
30+
31+
return (
32+
<Container>
33+
<Heading>Sandbox Site Logs</Heading>
34+
<Explanation>
35+
Builds typically take a minute or two to complete
36+
</Explanation>
37+
<List>
38+
{logs.map((log, i) => (
39+
// eslint-disable-next-line react/no-array-index-key
40+
<Item key={i}>{log}</Item>
41+
))}
42+
</List>
43+
<Button small onClick={() => modalClosed()}>
44+
Close
45+
</Button>
46+
</Container>
47+
);
48+
};
49+
50+
export default NetlifyLogs;

0 commit comments

Comments
 (0)