import { Card } from "flowbite-react"; import Link from "next/link"; import ApexCharts from "apexcharts"; import { useEffect } from "react"; import { minutesToTime } from "#/api/utils"; export const ProfileStats = (props: { lists: Array; watched_count: number; watched_time: number; profile_id: number }) => { const getChartOptions = () => { return { series: props.lists, colors: ["#66bb6c", "#b566bb", "#5c6cc0", "#ffca28", "#ef5450"], chart: { height: 240, width: "100%", type: "donut", }, stroke: { colors: ["transparent"], lineCap: "", }, dataLabels: { enabled: false, }, labels: [`Смотрю`, `В планах`, `Просмотрено`, `Отложено`, `Брошено`], legend: { show: false, }, responsive: [ { breakpoint: 400, options: { chart: { height: 170, width: 170, type: "donut", }, }, }, { breakpoint: 640, options: { chart: { height: 200, width: 200, type: "donut", }, }, }, ], }; }; useEffect(() => { if ( document.getElementById("donut-chart") && typeof ApexCharts !== "undefined" ) { const chart = new ApexCharts( document.getElementById("donut-chart"), getChartOptions() ); chart.render(); } }, []); return (

Статистика

Показать все

{" "} Смотрю {props.lists[0]}

{" "} В планах {props.lists[1]}

{" "} Просмотрено {props.lists[2]}

{" "} Отложено {props.lists[3]}

{" "} Брошено {props.lists[4]}

Просмотрено серий:{" "} {props.watched_count}

Время просмотра:{" "} ~{minutesToTime(props.watched_time, "daysHours")}

); };