-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Information Overlay Added): Retrieves latest release information…
… from GitHub, e2e tests added.
- Loading branch information
1 parent
edfbd14
commit 7ea610a
Showing
6 changed files
with
348 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface GitHubLatestReleaseAPIResponse { | ||
name: string; | ||
body: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,41 @@ | ||
import { Box, Typography } from '@material-ui/core'; | ||
import React from 'react'; | ||
import { Card, makeStyles } from '@material-ui/core'; | ||
import axios from 'axios'; | ||
import React, { useEffect, useState } from 'react'; | ||
import ReactMarkdown from 'react-markdown'; | ||
import { config } from '../../../env/config'; | ||
import { GitHubLatestReleaseAPIResponse } from '../../../store/information/types'; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
InformationOverlay: { | ||
width: '50%', | ||
padding: theme.spacing(2), | ||
}, | ||
})); | ||
|
||
export function InformationOverlay() { | ||
const classes = useStyles(); | ||
const [info, setInfo] = useState('Retriving release information...'); | ||
|
||
useEffect(() => { | ||
const fetchData = async () => { | ||
const result = await axios( | ||
config.information.gitHubAPILatestReleaseEndPoint | ||
); | ||
if (result.status === 200) { | ||
const releaseResponse = result.data as GitHubLatestReleaseAPIResponse; | ||
setInfo(releaseResponse.body); | ||
} else { | ||
setInfo( | ||
`Unabled to get release information :( (status: ${result.status})` | ||
); | ||
} | ||
}; | ||
fetchData(); | ||
}, []); | ||
|
||
export function InformationOverlay(): JSX.Element { | ||
return ( | ||
<Box> | ||
<Typography>Markdown Formatted Release Information</Typography> | ||
</Box> | ||
<Card id="InformationOverlay" className={classes.InformationOverlay}> | ||
<ReactMarkdown source={info} /> | ||
</Card> | ||
); | ||
} |
Oops, something went wrong.