refactor: remove unnecessay WordCloud abstraction

This commit is contained in:
2026-01-29 15:02:24 +00:00
parent 64c3422395
commit 5332af57e8
2 changed files with 39 additions and 61 deletions

View File

@@ -1,41 +0,0 @@
import { ReactWordcloud } from '@cp949/react-wordcloud';
import { useEffect, useState } from 'react';
import axios from "axios";
type BackendWord = {
word: string;
count: number;
}
const WordCloud = () => {
const [words, setWords] = useState<{ text: string; value: number }[]>([]);
const [error, setError] = useState<string>('');
useEffect(() => {
axios
.get("http://localhost:5000/stats/word_frequencies")
.then(res => {
const mapped = res.data.map((d: BackendWord) => (
{text: d.word, value: d.count}
));
setWords(mapped);
})
.catch(err => {
setError(err);
});
}, [])
return (
<div>
<ReactWordcloud
words={words}
/>
<p>{error}</p>
</div>
);
};
export default WordCloud;