aboutsummaryrefslogtreecommitdiff
path: root/jb-ui/src/models/grlStatsSlice.ts
diff options
context:
space:
mode:
authorMax Nanis2026-09-10 17:46:41 -0700
committerMax Nanis2026-09-10 17:46:41 -0700
commited201936813d9a720b51e6cb40a05267b94e7314 (patch)
treef675f6a0d91ed1d17f654e40936e8c1ca9ccf141 /jb-ui/src/models/grlStatsSlice.ts
parent0ac38066402762dc5fa24f2ffa2170681a6eddb1 (diff)
downloadamt-jb-ed201936813d9a720b51e6cb40a05267b94e7314.tar.gz
amt-jb-ed201936813d9a720b51e6cb40a05267b94e7314.zip
Typescript prettier
Committing seperate so it's easier to see actual changes.
Diffstat (limited to 'jb-ui/src/models/grlStatsSlice.ts')
-rw-r--r--jb-ui/src/models/grlStatsSlice.ts67
1 files changed, 30 insertions, 37 deletions
diff --git a/jb-ui/src/models/grlStatsSlice.ts b/jb-ui/src/models/grlStatsSlice.ts
index 9385256..004d321 100644
--- a/jb-ui/src/models/grlStatsSlice.ts
+++ b/jb-ui/src/models/grlStatsSlice.ts
@@ -1,54 +1,47 @@
import { StatsSnapshot } from "@/api_fsb";
import { RootState } from "@/store";
-import { createSelector, createSlice, PayloadAction } from '@reduxjs/toolkit';
+import { createSelector, createSlice, PayloadAction } from "@reduxjs/toolkit";
-
-const initialState: StatsSnapshot[] = []
+const initialState: StatsSnapshot[] = [];
const grlStatsSlice = createSlice({
- name: 'grlStats',
- initialState,
- reducers: {
-
- addStatsData(state, action: PayloadAction<StatsSnapshot>) {
- state.push(action.payload);
- }
- }
-})
-
-export const {
- addStatsData
-} = grlStatsSlice.actions;
-export default grlStatsSlice.reducer
-
+ name: "grlStats",
+ initialState,
+ reducers: {
+ addStatsData(state, action: PayloadAction<StatsSnapshot>) {
+ state.push(action.payload);
+ },
+ },
+});
+
+export const { addStatsData } = grlStatsSlice.actions;
+export default grlStatsSlice.reducer;
export const selectRecentStats = createSelector(
- [
- (state: RootState) => state.stats,
- ],
- (stats): StatsSnapshot | null => {
- const lastStat = stats[stats.length - 1];
- return lastStat ?? null;
- }
+ [(state: RootState) => state.stats],
+ (stats): StatsSnapshot | null => {
+ const lastStat = stats[stats.length - 1];
+ return lastStat ?? null;
+ },
);
export const activeUsers = createSelector(
- [selectRecentStats],
- (recentStats): number | null => {
- return recentStats?.active_users_last_24h ?? null;
- }
+ [selectRecentStats],
+ (recentStats): number | null => {
+ return recentStats?.active_users_last_24h ?? null;
+ },
);
export const activeSurveys = createSelector(
- [selectRecentStats],
- (recentStats): number | null => {
- return recentStats?.live_task_count?.total ?? null;
- }
+ [selectRecentStats],
+ (recentStats): number | null => {
+ return recentStats?.live_task_count?.total ?? null;
+ },
);
export const maxPayout = createSelector(
- [selectRecentStats],
- (recentStats): number | null => {
- return recentStats?.live_tasks_max_payout?.value ?? null;
- }
+ [selectRecentStats],
+ (recentStats): number | null => {
+ return recentStats?.live_tasks_max_payout?.value ?? null;
+ },
);