From 3f8d178d38686c1a5d71d94ebccdb61701469e95 Mon Sep 17 00:00:00 2001 From: stuppie Date: Mon, 31 Aug 2026 16:52:15 -0600 Subject: working on magic token and session token auth --- jb-ui/src/JBApp.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'jb-ui/src/JBApp.tsx') diff --git a/jb-ui/src/JBApp.tsx b/jb-ui/src/JBApp.tsx index 76e3f29..ef23b3b 100644 --- a/jb-ui/src/JBApp.tsx +++ b/jb-ui/src/JBApp.tsx @@ -19,6 +19,7 @@ import { setAssignmentID, setProductUserID, setTurkSubmitTo } from "@/models/app import { addEvent } from "@/models/grlEventsSlice"; import { addStatsData } from "@/models/grlStatsSlice"; import Home from "@/pages/Home"; +import MagicLink from "@/pages/MagicLink"; import Preview from "@/pages/Preview"; import Result from "@/pages/Result"; import Work from "@/pages/Work"; @@ -193,6 +194,7 @@ function JBApp() { return ( + } /> }> }> } /> @@ -206,4 +208,4 @@ function JBApp() { ) } -export default JBApp; \ No newline at end of file +export default JBApp; -- cgit v1.2.3 From ed201936813d9a720b51e6cb40a05267b94e7314 Mon Sep 17 00:00:00 2001 From: Max Nanis Date: Thu, 10 Sep 2026 17:46:41 -0700 Subject: Typescript prettier Committing seperate so it's easier to see actual changes. --- jb-ui/.vscode/settings.json | 14 +- jb-ui/src/JBApp.tsx | 343 ++++--- jb-ui/src/components/EventMarquee.tsx | 428 ++++---- jb-ui/src/components/Footer.tsx | 76 +- jb-ui/src/components/Profiling.tsx | 1297 ++++++++++++------------ jb-ui/src/components/Wallet.tsx | 859 ++++++++-------- jb-ui/src/components/ui/button.tsx | 20 +- jb-ui/src/components/ui/checkbox.tsx | 14 +- jb-ui/src/components/ui/confetti.tsx | 98 +- jb-ui/src/components/ui/dot-pattern.tsx | 60 +- jb-ui/src/components/ui/field.tsx | 72 +- jb-ui/src/components/ui/label.tsx | 12 +- jb-ui/src/components/ui/magic-card.tsx | 70 +- jb-ui/src/components/ui/pagination.tsx | 30 +- jb-ui/src/components/ui/separator.tsx | 14 +- jb-ui/src/components/ui/skeleton.tsx | 6 +- jb-ui/src/hooks.ts | 10 +- jb-ui/src/index.css | 1 - jb-ui/src/lib/utils.ts | 164 +-- jb-ui/src/main.tsx | 24 +- jb-ui/src/models/app.ts | 58 +- jb-ui/src/models/appSlice.ts | 323 +++--- jb-ui/src/models/grlEventsSlice.ts | 74 +- jb-ui/src/models/grlStatsSlice.ts | 67 +- jb-ui/src/models/profilingQuestionsSlice.ts | 672 +++++++------ jb-ui/src/models/profilingUtils.ts | 309 +++--- jb-ui/src/pages/Home.tsx | 12 +- jb-ui/src/pages/LinkAmtAccount.tsx | 131 +-- jb-ui/src/pages/MagicLink.tsx | 72 +- jb-ui/src/pages/Preview.tsx | 523 +++++----- jb-ui/src/pages/Result.tsx | 206 ++-- jb-ui/src/pages/Transfer.tsx | 50 + jb-ui/src/pages/Work.tsx | 1452 ++++++++++++++------------- jb-ui/src/store.ts | 43 +- jb-ui/src/vite-env.d.ts | 16 +- jb-ui/tests/base.test.ts | 6 +- jb-ui/tests/setupTests.ts | 2 +- 37 files changed, 3980 insertions(+), 3648 deletions(-) create mode 100644 jb-ui/src/pages/Transfer.tsx (limited to 'jb-ui/src/JBApp.tsx') diff --git a/jb-ui/.vscode/settings.json b/jb-ui/.vscode/settings.json index aef94ef..4257030 100644 --- a/jb-ui/.vscode/settings.json +++ b/jb-ui/.vscode/settings.json @@ -1,3 +1,15 @@ { - "editor.rulers": [80, 120] + "editor.rulers": [ + 80, + 120 + ], + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "[typescriptreact]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true + }, + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + } } \ No newline at end of file diff --git a/jb-ui/src/JBApp.tsx b/jb-ui/src/JBApp.tsx index ef23b3b..472b976 100644 --- a/jb-ui/src/JBApp.tsx +++ b/jb-ui/src/JBApp.tsx @@ -1,21 +1,26 @@ import { - EventMessage, - EventType, - PingMessage, - PongMessage, - PongMessageKindEnum, - StatsMessage, - StatusApi, - SubscribeMessage, SubscribeMessageKindEnum, - TaskStatusResponse, - UserWalletBalance, - UserWalletBalanceResponse, - WalletApi + EventMessage, + EventType, + PingMessage, + PongMessage, + PongMessageKindEnum, + StatsMessage, + StatusApi, + SubscribeMessage, + SubscribeMessageKindEnum, + TaskStatusResponse, + UserWalletBalance, + UserWalletBalanceResponse, + WalletApi, } from "@/api_fsb"; import Footer from "@/components/Footer"; import { useAppDispatch } from "@/hooks"; import { bpid, routeBasename, tagManager } from "@/lib/utils"; -import { setAssignmentID, setProductUserID, setTurkSubmitTo } from "@/models/appSlice"; +import { + setAssignmentID, + setProductUserID, + setTurkSubmitTo, +} from "@/models/appSlice"; import { addEvent } from "@/models/grlEventsSlice"; import { addStatsData } from "@/models/grlStatsSlice"; import Home from "@/pages/Home"; @@ -23,8 +28,15 @@ import MagicLink from "@/pages/MagicLink"; import Preview from "@/pages/Preview"; import Result from "@/pages/Result"; import Work from "@/pages/Work"; -import { BrowserRouter, Outlet, Route, Routes, useSearchParams } from "react-router-dom"; -import useWebSocket from 'react-use-websocket'; +import Transfer from "@/pages/Transfer"; +import { + BrowserRouter, + Outlet, + Route, + Routes, + useSearchParams, +} from "react-router-dom"; +import useWebSocket from "react-use-websocket"; import NewsTicker from "./components/EventMarquee"; import { useEffect } from "react"; @@ -34,178 +46,195 @@ import "@/index.css"; import { setTaskStatus, setUserWalletBalance } from "@/models/appSlice"; import { Profiling } from "./components/Profiling"; -type Message = PingMessage | PongMessage | SubscribeMessage | EventMessage | StatsMessage; +type Message = + | PingMessage + | PongMessage + | SubscribeMessage + | EventMessage + | StatsMessage; function isStatsMessage(msg: Message): msg is StatsMessage { - return msg.kind === 'stats'; + return msg.kind === "stats"; } function isEventMessage(msg: Message): msg is EventMessage { - return msg.kind === 'event'; + return msg.kind === "event"; } function isPingMessage(msg: Message): msg is PingMessage { - return msg.kind === 'ping'; + return msg.kind === "ping"; } function QueryParamProcessor() { - const dispatch = useAppDispatch() - const [searchParams] = useSearchParams(); + const dispatch = useAppDispatch(); + const [searchParams] = useSearchParams(); - useEffect(() => { - const worker_id = searchParams.get('workerId'); - const assignment_id = searchParams.get('assignmentId'); - const tsid = searchParams.get('tsid'); - const turkSubmitTo = searchParams.get('turkSubmitTo'); - - if (turkSubmitTo) { - dispatch(setTurkSubmitTo(turkSubmitTo)) - } + useEffect(() => { + const worker_id = searchParams.get("workerId"); + const assignment_id = searchParams.get("assignmentId"); + const tsid = searchParams.get("tsid"); + const turkSubmitTo = searchParams.get("turkSubmitTo"); - if (worker_id) { - dispatch(setProductUserID(worker_id)) - - new WalletApi().getUserWalletBalanceProductIdWalletGet( - bpid, // productId - worker_id, // bpuid - ).then(res => { - const response = res.data as UserWalletBalanceResponse; - const balance = response.wallet as UserWalletBalance; - dispatch(setUserWalletBalance(balance)); - }); - } + if (turkSubmitTo) { + dispatch(setTurkSubmitTo(turkSubmitTo)); + } - if (assignment_id) { - dispatch(setAssignmentID(assignment_id)) - } + if (worker_id) { + dispatch(setProductUserID(worker_id)); + + new WalletApi() + .getUserWalletBalanceProductIdWalletGet( + bpid, // productId + worker_id, // bpuid + ) + .then((res) => { + const response = res.data as UserWalletBalanceResponse; + const balance = response.wallet as UserWalletBalance; + dispatch(setUserWalletBalance(balance)); + }); + } - if (tsid) { - new StatusApi().getTaskStatusProductIdStatusTsidGet( - bpid, // productId - tsid).then(res => { - const response: TaskStatusResponse = res.data; - dispatch(setTaskStatus(response)) - }).catch((error) => { - console.error("Error fetching task status:", error); - }); - } + if (assignment_id) { + dispatch(setAssignmentID(assignment_id)); + } - }, [searchParams]); + if (tsid) { + new StatusApi() + .getTaskStatusProductIdStatusTsidGet( + bpid, // productId + tsid, + ) + .then((res) => { + const response: TaskStatusResponse = res.data; + dispatch(setTaskStatus(response)); + }) + .catch((error) => { + console.error("Error fetching task status:", error); + }); + } + }, [searchParams]); - return ; + return ; } const Layout = () => { - return ( - + + +