mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-25 06:24:19 +00:00
34 lines
992 B
JavaScript
34 lines
992 B
JavaScript
import React, { useContext } from "react"
|
|
import BoxWordcloud from "../base/BoxWordcloud"
|
|
import ContextLanguage from "../../contexts/ContextLanguage"
|
|
import BoxFull from "../base/BoxFull"
|
|
import Empty from "./Empty"
|
|
import ContextRepositoryViewer from "../../contexts/ContextRepositoryViewer"
|
|
import { ContainsFilter } from "../../utils/Filter"
|
|
|
|
|
|
export default function BoxVisualizationWordcloud({ ...props }) {
|
|
const { strings } = useContext(ContextLanguage)
|
|
const { words, appendFilter } = useContext(ContextRepositoryViewer)
|
|
|
|
if(words.length === 0) {
|
|
return (
|
|
<BoxFull header={strings.wordcloud} {...props}>
|
|
<Empty/>
|
|
</BoxFull>
|
|
)
|
|
}
|
|
|
|
const onWordClick = word => {
|
|
appendFilter(new ContainsFilter(false, word.text))
|
|
}
|
|
|
|
return (
|
|
<BoxWordcloud
|
|
header={strings.wordcloud}
|
|
words={words}
|
|
callbacks={{ onWordClick }}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|