diff --git a/nest_frontend/components/interactive/BoxWordcloud.js b/nest_frontend/components/interactive/BoxWordcloud.js index 191844c..d8e5177 100644 --- a/nest_frontend/components/interactive/BoxWordcloud.js +++ b/nest_frontend/components/interactive/BoxWordcloud.js @@ -24,7 +24,7 @@ export default function BoxWordcloud({ words, props }) { "var(--fg-primary)", ], fontFamily: "Bree Serif", - fontSizes: [12, 128], + fontSizes: [16, 48], size: undefined, deterministic: true, }} diff --git a/nest_frontend/routes/PageRepository.js b/nest_frontend/routes/PageRepository.js index f48501d..792f8dd 100644 --- a/nest_frontend/routes/PageRepository.js +++ b/nest_frontend/routes/PageRepository.js @@ -2,24 +2,50 @@ import React from "react" import Style from "./PageRepository.module.css" import classNames from "classnames" import BoxRepositoryTweets from "../components/interactive/BoxRepositoryTweets" +import BoxWordcloud from "../components/interactive/BoxWordcloud" export default function PageRepository({ className, ...props }) { + const tweets = [ + { + "conditions": [], + "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec posuere lacinia eleifend. Maecenas a neque augue. Nulla dapibus lobortis gravida. Quisque quis ultricies elit. Donec in tortor augue. Cras eget aliquam felis. Nunc tempor, ipsum in lobortis tristique, nunc ante velit.", + "insert_time": "2021-05-18T18:56Z", + "location": null, + "place": "Casa mia", + "poster": "USteffo", + "snowflake": "1394698342282809344", + }, + ] + + let preprocessedWords = {} + for(const tweet of tweets) { + if(!tweet.content) { + continue + } + for(const word of tweet.content.toLowerCase().split(/\s+/)) { + if(!preprocessedWords.hasOwnProperty(word)) { + preprocessedWords[word] = 0 + } + preprocessedWords[word] += 1 + } + } + + let processedWords = [] + for(const word in preprocessedWords) { + if(!preprocessedWords.hasOwnProperty(word)) { + continue + } + processedWords.push({ + text: word, + value: preprocessedWords[word] + }) + } + return (