39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
import React, { useEffect } from "react";
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
|
|
import { Stat } from "./stat";
|
|
|
|
import { getStats } from "../../actions/admins";
|
|
|
|
export const Stats = () => {
|
|
const dispatch = useDispatch();
|
|
const stats = useSelector((state) => state.admin.stats);
|
|
|
|
useEffect(() => {
|
|
dispatch(getStats());
|
|
}, [dispatch]);
|
|
|
|
return (
|
|
<div className="row d-flex flex-wrap">
|
|
<Stat
|
|
name="Movies"
|
|
count={stats["movies_count"]}
|
|
torrentCount={stats["movies_torrents_count"]}
|
|
torrentCountById={stats["movies_torrents_count_by_id"]}
|
|
/>
|
|
<Stat
|
|
name="Shows"
|
|
count={stats["shows_count"]}
|
|
torrentCount={stats["episodes_torrents_count"]}
|
|
torrentCountById={stats["shows_torrents_count_by_id"]}
|
|
/>
|
|
<Stat
|
|
name="Episodes"
|
|
count={stats["episodes_count"]}
|
|
torrentCount={stats["episodes_torrents_count"]}
|
|
torrentCountById={stats["episodes_torrents_count_by_id"]}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|