From 3eaa56f0306ead818f64c3d99fc6d230d9b970a4 Mon Sep 17 00:00:00 2001 From: Max Nanis Date: Wed, 18 Feb 2026 20:42:03 -0500 Subject: HERE WE GO, HERE WE GO, HERE WE GO --- jb-ui/src/pages/Preview.tsx | 288 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 jb-ui/src/pages/Preview.tsx (limited to 'jb-ui/src/pages/Preview.tsx') diff --git a/jb-ui/src/pages/Preview.tsx b/jb-ui/src/pages/Preview.tsx new file mode 100644 index 0000000..9506664 --- /dev/null +++ b/jb-ui/src/pages/Preview.tsx @@ -0,0 +1,288 @@ +import { + Leaderboard, + LeaderboardApi, + LeaderboardCode, + LeaderboardFrequency, + LeaderboardRow, +} from "@/api_fsb"; +import { useAppSelector } from "@/hooks"; +import { bpid, formatCentsToUSD, truncate, } from "@/lib/utils"; +import { activeSurveys, activeUsers, maxPayout } from "@/models/grlStatsSlice"; +import { clsx } from "clsx"; +import moment from 'moment'; +import { useEffect, useState } from 'react'; + +const showSmartRank = ( + item: LeaderboardRow, + index: number, + items: LeaderboardRow[] | undefined +): boolean => { + /** + * Smart rank calculation - this determines if we should show the rank + * value. It's confusing to show people that multiple individuals ranked + * in the same place, so this will only display the next ranked value, eg: + * + * - 1st + * - ___ + * - 3rd + * - ___ + * - ___ + * - 6th + * + * @returns number + */ + if (!items) return false; + + const thisRank = item.rank; + if (index >= 1) { + const prevRank = items[index - 1].rank; + if (thisRank === prevRank) { + return false; + } + } + return true; +}; + +interface FrequencyButtonsProps { + selected: LeaderboardFrequency; + onChange: (frequency: LeaderboardFrequency) => void; +} + + +const ThreeButtonToggle = ({ selected, onChange }: FrequencyButtonsProps) => { + const buttons = [ + { label: 'Day', value: LeaderboardFrequency.Daily }, + { label: 'Week', value: LeaderboardFrequency.Weekly }, + { label: 'Month', value: LeaderboardFrequency.Monthly }, + ]; + + // rounded-l + + return ( +
+ {dateRange} +
+| Rank | +Bonus | +User | +
|---|---|---|
| + {dataItem.rank} + | ++ {formatCentsToUSD(dataItem.value)} + | ++ {truncate(dataItem.bpuid, 6, "*****").toUpperCase()} + | +
| Rank | +Completes | +User | +
|---|---|---|
| + {dataItem.rank ?? showSmartRank(dataItem, index, completes?.rows)} + | ++ {dataItem.value} + | ++ {truncate(dataItem.bpuid, 6, "*****").toUpperCase()} + | +
+ {users_f} people are actively attempting {surveys_f} available surveys right now. +
++ Get paid to take surveys. Our algorithm attempts to pair you with the + highest paying survey available at the moment (right now, the highest + paying survey is {survey_max_cpi_f}) that you are eligible for, + each attempt is a valid HIT. Try as many as you can, our system will + self regulate you: we want to ensure you have a high chance of being + paired with a survey based on what surveys are available, as their + availability constantly changes.
++ Each HIT is paid when you attempt to take a survey and if you complete + the survey, you will be awarded a bonus equal to that in which the + survey pays out.
+