Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
651 additions
and
300 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,3 +1,6 @@ | ||
[build-system] | ||
requires = ["setuptools", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.black] | ||
line-length = 120 |
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
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,24 @@ | ||
import ChangeDirectionBadge from 'img/1_change_direction.svg' | ||
import RandomDirectionsBadge from 'img/1_random_directions.svg' | ||
import InvestigateBadge from 'img/1_investigate.svg' | ||
|
||
export const badgeInfo = { | ||
'1:1': { | ||
title: 'Congratulations!', | ||
message: 'You have earned your first badge! See how many more badges you can get.', | ||
img: ChangeDirectionBadge, | ||
name: 'Change direction', | ||
}, | ||
'1:2': { | ||
title: 'Well done!', | ||
message: 'You just earned the second badge by going in random directions!', | ||
img: RandomDirectionsBadge, | ||
name: 'Random directions', | ||
}, | ||
'1:3': { | ||
title: 'Congratulations!', | ||
message: 'You have earned the final badge in this era by investigating a location!', | ||
img: InvestigateBadge, | ||
name: 'Investigate location', | ||
}, | ||
} |
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,73 @@ | ||
import React, { Component } from 'react' | ||
import styled from 'styled-components' | ||
import PropTypes from 'prop-types' | ||
|
||
import Box from '@material-ui/core/Box' | ||
import Modal from '@material-ui/core/Modal' | ||
import Typography from '@material-ui/core/Typography' | ||
|
||
import { badgeInfo } from './badges' | ||
|
||
const BadgeModalBox = styled(Box)` | ||
position: absolute; | ||
top: 15%; | ||
left: 65%; | ||
width: 400px; | ||
background-color: #fff; | ||
border-radius: 10px; | ||
padding: 25px; | ||
opacity: 0.8; | ||
` | ||
|
||
const BadgeModalImg = styled(Box)` | ||
height: 55px; | ||
position: absolute; | ||
top: 35px; | ||
right: 25px; | ||
` | ||
|
||
export default class BadgeModal extends Component { | ||
static propTypes = { | ||
modalOpen: PropTypes.bool, | ||
taskId: PropTypes.string, | ||
} | ||
|
||
render() { | ||
if (!this.props.modalOpen) { | ||
return null | ||
} | ||
|
||
const taskId = this.props.taskId | ||
const info = badgeInfo[taskId] | ||
|
||
return ( | ||
<Modal | ||
open | ||
hideBackdrop | ||
aria-labelledby="modal-modal-title" | ||
aria-describedby="modal-modal-description" | ||
> | ||
<BadgeModalBox> | ||
<Box style={{ width: 330 }}> | ||
<Typography variant="h6">{info.title}</Typography> | ||
<Typography variant="subtitle1">{info.message}</Typography> | ||
</Box> | ||
<BadgeModalImg component="img" alt={info.name} src={info.img} /> | ||
</BadgeModalBox> | ||
</Modal> | ||
) | ||
} | ||
} | ||
|
||
export function getBadges(tasks) { | ||
return tasks.map((task) => ( | ||
<Box | ||
component="img" | ||
style={{ height: 45, marginRight: 15 }} | ||
alt={badgeInfo[task].name} | ||
title={badgeInfo[task].name} | ||
src={badgeInfo[task].img} | ||
key={task} | ||
/> | ||
)) | ||
} |
Oops, something went wrong.