mirror of
https://github.com/lemeow125/Ivy-Frontend.git
synced 2025-05-14 10:31:07 +08:00
Made current session stats widget in dashboard functional
This commit is contained in:
parent
fd7891359c
commit
6619163abe
5 changed files with 60 additions and 3 deletions
|
@ -15,7 +15,8 @@ import {
|
|||
GetLowestStockedProduct,
|
||||
GetProducts,
|
||||
} from "../../Components/Api/Api";
|
||||
import { ProductLog } from "../../Interfaces/Interfaces";
|
||||
import { ProductLog, SessionTransactions } from "../../Interfaces/Interfaces";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
export default function Dashboard() {
|
||||
const logs = useQuery("logs", GetLogs, { retry: 0 });
|
||||
|
@ -27,6 +28,12 @@ export default function Dashboard() {
|
|||
retry: 0,
|
||||
}
|
||||
);
|
||||
const session_added = useSelector(
|
||||
(state: SessionTransactions) => state.session_transactions.added
|
||||
);
|
||||
const session_removed = useSelector(
|
||||
(state: SessionTransactions) => state.session_transactions.removed
|
||||
);
|
||||
if (logs.isLoading || products.isLoading || lowest_stock_product.isLoading) {
|
||||
return (
|
||||
<div>
|
||||
|
@ -110,14 +117,18 @@ export default function Dashboard() {
|
|||
Added
|
||||
</p>
|
||||
</div>
|
||||
<p style={{ ...styles.text_white, ...styles.text_L }}>254</p>
|
||||
<p style={{ ...styles.text_white, ...styles.text_L }}>
|
||||
{session_added}
|
||||
</p>
|
||||
<div style={styles.content_row}>
|
||||
<ColoredCube size={32} color="#a44141" />
|
||||
<p style={{ ...styles.text_white, ...styles.text_L }}>
|
||||
Removed
|
||||
</p>
|
||||
</div>
|
||||
<p style={{ ...styles.text_white, ...styles.text_XL }}>118</p>
|
||||
<p style={{ ...styles.text_white, ...styles.text_XL }}>
|
||||
{session_removed}
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue