import { Component } from "react";
import DonutChart from "./DonutChart";

const donutData = [
    { value: 100, name: "a" },
]

export class Donut extends Component {
    render() {
        let teamColors = undefined
        let data = []

        if (this.props.data.length > 0 && this.props.data[0].team) {
            for (const p of this.props.data) {
                data.push({
                    value: p.count,
                    name: p.name,
                    color: p.team == "A" ? "#3b3bd4" : "#d43b3b"
                })
            }
        } else {
            for (const p of this.props.data) {
                data.push({
                    value: p.count,
                    name: p.name
                })
            }
        }

        console.log("palu")
        console.log(this.props)
        console.log(data)

        return (
            <div className="App">
                <DonutChart data={data} />
            </div>
        )
    }
}