39 lines
1.1 KiB
JavaScript
39 lines
1.1 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.adminStore.get("stats"));
|
|
|
|
useEffect(() => {
|
|
dispatch(getStats());
|
|
}, [dispatch]);
|
|
|
|
return (
|
|
<div className="row d-flex flex-wrap">
|
|
<Stat
|
|
name="Movies"
|
|
count={stats.get("movies_count")}
|
|
torrentCount={stats.get("movies_torrents_count")}
|
|
torrentCountById={stats.get("movies_torrents_count_by_id")}
|
|
/>
|
|
<Stat
|
|
name="Shows"
|
|
count={stats.get("shows_count")}
|
|
torrentCount={stats.get("episodes_torrents_count")}
|
|
torrentCountById={stats.get("shows_torrents_count_by_id")}
|
|
/>
|
|
<Stat
|
|
name="Episodes"
|
|
count={stats.get("episodes_count")}
|
|
torrentCount={stats.get("episodes_torrents_count")}
|
|
torrentCountById={stats.get("episodes_torrents_count_by_id")}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|