-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Dantaro/v1.3.0
v1.3.0
- Loading branch information
Showing
6 changed files
with
73 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
REACT_APP_CURRENT_VERSION=v1.2.0 | ||
REACT_APP_CURRENT_VERSION=v1.3.0 |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import React from 'react' | ||
import React, { useEffect, useRef } from 'react' | ||
import Typography from '@material-ui/core/Typography' | ||
import Paper from '@material-ui/core/Paper' | ||
import { useSelector } from 'react-redux' | ||
|
@@ -8,6 +8,8 @@ import { | |
findLongestNote, | ||
} from 'util/notelist' | ||
import { makeStyles } from '@material-ui/core/styles' | ||
import WordCloud from 'wordcloud' | ||
import { findWordCounts } from 'util/notelist/NoteListUtil' | ||
|
||
const useStyles = makeStyles({ | ||
paper: { | ||
|
@@ -21,6 +23,25 @@ const useStyles = makeStyles({ | |
}, | ||
}) | ||
|
||
const NotelistWordMap = ({id, noteList}) => { | ||
const canvasRef = useRef(null) | ||
useEffect(() => { | ||
WordCloud(document.getElementById(id), { | ||
list: findWordCounts(noteList), | ||
rotateRatio: 0, | ||
weightFactor: 10, | ||
color: () => '#1261A0' | ||
}) | ||
}, [id, noteList]); | ||
|
||
return (<> | ||
<Typography variant="body1"> | ||
Your Word Cloud | ||
</Typography> | ||
<canvas ref={canvasRef} id={id} /> | ||
</>) | ||
} | ||
|
||
export const Statistics = () => { | ||
const classes = useStyles() | ||
const noteList = useSelector((state) => state.noteList) | ||
|
@@ -55,6 +76,7 @@ export const Statistics = () => { | |
Longest Note:{' '} | ||
{`${longestNote} ${longestNote === 1 ? 'word' : 'words'}`} | ||
</Typography> | ||
<NotelistWordMap id="notelistWordCount" noteList={noteList} /> | ||
<br/> | ||
<Typography variant="body2"> | ||
Have an idea for other statistics? <a href="mailto:[email protected]">Shoot over an email</a> with your suggestions! | ||
|
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