mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-12 12:04:16 +00:00
remove unused
This commit is contained in:
parent
815d591b83
commit
1e49c9bd84
@ -1,55 +1,8 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import * as antd from "antd"
|
|
||||||
import { AppSearcher } from "components"
|
import { AppSearcher } from "components"
|
||||||
import * as charts from "react-chartjs-2"
|
|
||||||
|
|
||||||
import "./index.less"
|
import "./index.less"
|
||||||
|
|
||||||
const data = {
|
|
||||||
labels: ["Red", "Orange", "Blue"],
|
|
||||||
datasets: [
|
|
||||||
{
|
|
||||||
label: "Popularity of colours",
|
|
||||||
data: [55, 23, 96],
|
|
||||||
borderWidth: 5,
|
|
||||||
fill: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
const chartKeys = Object.fromEntries(Object.keys(charts).map((key) => {
|
|
||||||
return [String(key).toLowerCase(), key]
|
|
||||||
}))
|
|
||||||
|
|
||||||
class ChartGenerator extends React.Component {
|
|
||||||
constructor(payload) {
|
|
||||||
super(payload)
|
|
||||||
this.payload = payload
|
|
||||||
|
|
||||||
this.type = this.payload.type
|
|
||||||
this.Chart = charts[this.type] ?? charts[chartKeys[this.type]]
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
labels: [],
|
|
||||||
datasets: [],
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.Chart) {
|
|
||||||
console.error("Chart type is not valid")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const { Chart } = this
|
|
||||||
|
|
||||||
if (React.isValidElement(Chart)) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
return <Chart data={this.state} />
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class Main extends React.Component {
|
export default class Main extends React.Component {
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
if (!window.app?.HeaderController?.isVisible()) {
|
if (!window.app?.HeaderController?.isVisible()) {
|
||||||
@ -77,8 +30,6 @@ export default class Main extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="content">
|
<div className="content">
|
||||||
<h2>Statistics</h2>
|
|
||||||
<div><ChartGenerator type="line" /></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user