Skip to content

Commit

Permalink
Merge pull request #577 from WycliffeAssociates/mm_progress_identicon
Browse files Browse the repository at this point in the history
Updated jdenticon lib, fixed identicons on progress page
  • Loading branch information
mXaln authored Oct 7, 2019
2 parents 23ae29e + 591a8cc commit b4a1bd4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"font-awesome": "~4.7.0",
"howler": "~2.0.4",
"immutability-helper": "~2.7.0",
"jdenticon": "~1.8.0",
"jdenticon": "~2.2.0",
"js-base64": "~2.1.9",
"json-schema-traverse": "~0.3.1",
"lodash": "latest",
Expand Down
27 changes: 18 additions & 9 deletions src/js/pages/tasks/components/TaskIdenticon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import jdenticon from 'jdenticon';
import ReactPlayer from 'react-player';
import config from '../../../../config/config';

jdenticon.config = {
replaceMode: "observe"
};

class TaskIdenticon extends React.Component {

constructor(props) {
Expand All @@ -24,19 +28,16 @@ class TaskIdenticon extends React.Component {
this.setState({playing: false});
}

componentDidMount() {
jdenticon.update(`#user${this.props.task.id.slice(0, 8)}`, this.props.task.details.user_icon_hash?
this.props.task.details.user_icon_hash: 'null user');
}

render() {

const { task } = this.props;

return (
<Container>
<Identicon onClick={()=>this.play()} id={`#user${task.id.slice(0, 8)}`}
data-jdenticon-hash={task.details.user_icon_hash ? task.details.user_icon_hash: 'null user'} />
<IconBox>
<Identicon onClick={()=>this.play()} id={`#user${task.id.slice(0, 8)}`}
data-jdenticon-hash={task.details.user_icon_hash ? task.details.user_icon_hash: 'null user'} />
</IconBox>
<ReactPlayer
url={`${config.streamingUrl}${task.details.user_name_audio ? task.details.user_name_audio : ''}`}
playing={this.state.playing}
Expand All @@ -53,9 +54,17 @@ const Container = styled.div`
`;
Container.displayName = 'Container';

const IconBox = styled.div`
width: 3.5vw;
height: 3.5vw;
background-color: white;
border-top-right-radius: 1vw;
`;
IconBox.displayName = 'IconBox';

const Identicon = styled.svg`
height: 4vw;
width: 4vw;
width: 3.5vw;
height: 3.5vw;
cursor: pointer;
`;
Identicon.displayName = 'Identicon';
Expand Down

0 comments on commit b4a1bd4

Please sign in to comment.