mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
remove unused
This commit is contained in:
parent
80a762ebf0
commit
e31d43274b
@ -1,55 +1,8 @@
|
||||
import React from "react"
|
||||
import * as antd from "antd"
|
||||
import { AppSearcher } from "components"
|
||||
import * as charts from "react-chartjs-2"
|
||||
|
||||
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 {
|
||||
componentWillUnmount() {
|
||||
if (!window.app?.HeaderController?.isVisible()) {
|
||||
@ -77,8 +30,6 @@ export default class Main extends React.Component {
|
||||
</div>
|
||||
</div>
|
||||
<div className="content">
|
||||
<h2>Statistics</h2>
|
||||
<div><ChartGenerator type="line" /></div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user