From b464e311b44a5f3baeb1568ba55b6322a1a11638 Mon Sep 17 00:00:00 2001 From: Max Nanis Date: Sun, 13 Sep 2026 11:43:52 -0700 Subject: Fix pnpm build error requirements --- jb-ui/src/AuthContext.tsx | 28 ---------------------------- jb-ui/src/JBApp.tsx | 8 +------- jb-ui/src/components/Footer.tsx | 2 +- jb-ui/src/components/Profiling.tsx | 10 +++++----- jb-ui/src/components/Redemption.tsx | 14 ++++---------- jb-ui/src/components/Wallet.tsx | 4 ++-- jb-ui/src/pages/Preview.tsx | 9 ++++++--- jb-ui/src/pages/Transfer.tsx | 11 +++++++---- jb-ui/src/pages/Work.tsx | 12 ++++++------ 9 files changed, 32 insertions(+), 66 deletions(-) delete mode 100644 jb-ui/src/AuthContext.tsx diff --git a/jb-ui/src/AuthContext.tsx b/jb-ui/src/AuthContext.tsx deleted file mode 100644 index 85bcdb0..0000000 --- a/jb-ui/src/AuthContext.tsx +++ /dev/null @@ -1,28 +0,0 @@ -// AuthContext.jsx -import { createContext, useContext, useEffect, useState } from "react"; - -const AuthContext = createContext(null); - -export function AuthProvider({ children }) { - const [user, setUser] = useState(null); - const [loading, setLoading] = useState(true); - - useEffect(() => { - fetch("/api/me", { credentials: "include" }) - .then((res) => (res.ok ? res.json() : null)) - .then(setUser) - .finally(() => setLoading(false)); - }, []); - - return ( - - {children} - - ); -} - -export function useAuth() { - return useContext(AuthContext); -} diff --git a/jb-ui/src/JBApp.tsx b/jb-ui/src/JBApp.tsx index 4870e9b..c55cd73 100644 --- a/jb-ui/src/JBApp.tsx +++ b/jb-ui/src/JBApp.tsx @@ -13,7 +13,6 @@ import { UserWalletBalanceResponse, UserLedgerWallets, UserLedgerWalletAccountTypeEnum, - UserDisplayedWalletBalance, WalletApi, CashoutMethodsResponse, } from "@/api_fsb"; @@ -33,9 +32,7 @@ import { addCashoutMethods } from "@/models/cashoutMethodsSlice"; 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 clsx from "clsx"; @@ -44,7 +41,6 @@ import Transfer from "@/pages/Transfer"; import { BrowserRouter, Outlet, - useLocation, useMatch, Route, Routes, @@ -83,7 +79,7 @@ function isPingMessage(msg: Message): msg is PingMessage { function QueryParamProcessor() { const dispatch = useAppDispatch(); const [searchParams] = useSearchParams(); - const { data: user, isLoading, isError } = useGetMeQuery(); + const { data: user } = useGetMeQuery(); useEffect(() => { if (user?.product_user_id) { @@ -169,8 +165,6 @@ function QueryParamProcessor() { } const Layout = () => { - const location = useLocation(); - const isWork = useMatch("/work/*"); const isPreview = useMatch("/preview/*"); const isSpecialSubview = Boolean(isWork || isPreview); diff --git a/jb-ui/src/components/Footer.tsx b/jb-ui/src/components/Footer.tsx index ec458f2..e65255f 100644 --- a/jb-ui/src/components/Footer.tsx +++ b/jb-ui/src/components/Footer.tsx @@ -1,7 +1,7 @@ import { useGetMeQuery } from "@/models/authAPI"; const Footer = () => { - const { data: user, isLoading, isError } = useGetMeQuery(); + const { data: user } = useGetMeQuery(); return (
{ // const selectAnswer = useSelector(selectAnswerForQuestion(question)); const metadata = activeQuestion?._metadata; const validation = activeQuestion?._validation; - const { data: user, isLoading, isError } = useGetMeQuery(); + const { data: user } = useGetMeQuery(); if (!metadata) return null; if (!validation) return null; @@ -113,7 +113,7 @@ export default function useKeyboardMode(rowModel: RowModel) { const dispatch = useAppDispatch(); const activeQuestion = useSelector(selectActiveQuestion); - const { data: user, isLoading, isError } = useGetMeQuery(); + const { data: user } = useGetMeQuery(); const keyboardSelectionIdxRef = useRef(0); @@ -514,7 +514,7 @@ const ProfilingQuestionSubmitButton = () => { const activeQuestion = useSelector(selectActiveQuestion); const activeQuestionValidation = useSelector(selectActiveQuestionValidation); - const { data: user, isLoading, isError } = useGetMeQuery(); + const { data: user } = useGetMeQuery(); const handleOnClick = () => { if (!activeQuestion) return; @@ -759,7 +759,7 @@ const Profiling = () => { const [showProfiling, setShowProfiling] = useState(false); const dispatch = useAppDispatch(); - const { data: user, isLoading, isError } = useGetMeQuery(); + const { data: user } = useGetMeQuery(); useEffect(() => { if (!user?.product_user_id) return; diff --git a/jb-ui/src/components/Redemption.tsx b/jb-ui/src/components/Redemption.tsx index 0a91ab3..1d76f17 100644 --- a/jb-ui/src/components/Redemption.tsx +++ b/jb-ui/src/components/Redemption.tsx @@ -1,14 +1,10 @@ import { clsx } from "clsx"; -import { useAppDispatch, useAppSelector } from "@/hooks"; -import { UpkQuestionChoice } from "@/api_fsb"; -import { useGetMeQuery } from "@/models/authAPI"; -import { ChevronRightIcon } from "lucide-react"; -import { KeyboardEvent, MouseEvent, useEffect, useRef, useState } from "react"; -import { useSelector } from "react-redux"; -import { cashoutMethodsSelectors } from "@/models/cashoutMethodsSlice"; +import { useState } from "react"; +// import { useSelector } from "react-redux"; +// import { cashoutMethodsSelectors } from "@/models/cashoutMethodsSlice"; const RedemptionHeader = () => { - const cashout_methods = useSelector(cashoutMethodsSelectors.selectAll); + // const cashout_methods = useSelector(cashoutMethodsSelectors.selectAll); return ( <> @@ -32,8 +28,6 @@ const RedemptionModalBody = () => { }; const Redemption = () => { - const dispatch = useAppDispatch(); - const { data: user, isLoading, isError } = useGetMeQuery(); const [showRedemption, setShowRedemption] = useState(false); return ( diff --git a/jb-ui/src/components/Wallet.tsx b/jb-ui/src/components/Wallet.tsx index 3bb23a9..819eff7 100644 --- a/jb-ui/src/components/Wallet.tsx +++ b/jb-ui/src/components/Wallet.tsx @@ -194,7 +194,7 @@ const WalletTransactionsHeader = () => { const WalletTransactions = () => { const dispatch = useAppDispatch(); - const { data: user, isLoading, isError } = useGetMeQuery(); + const { data: user } = useGetMeQuery(); const userLedgerTxs = useAppSelector((state) => state.app.userLedgerTxs); const txPagination = useAppSelector((state) => state.app.txPagination); @@ -446,7 +446,7 @@ const WalletTransactions = () => { const Wallet = () => { const dispatch = useAppDispatch(); const pagination = useAppSelector((state) => state.app.txPagination); - const { data: user, isLoading, isError } = useGetMeQuery(); + const { data: user } = useGetMeQuery(); useEffect(() => { if (!user?.product_user_id) return; diff --git a/jb-ui/src/pages/Preview.tsx b/jb-ui/src/pages/Preview.tsx index 900621e..c58a85e 100644 --- a/jb-ui/src/pages/Preview.tsx +++ b/jb-ui/src/pages/Preview.tsx @@ -5,13 +5,12 @@ import { LeaderboardFrequency, LeaderboardRow, } from "@/api_fsb"; -import { Button } from "@/components/ui/button"; 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"; +import { FormEvent, useEffect, useState } from "react"; const showSmartRank = ( item: LeaderboardRow, @@ -247,7 +246,11 @@ export const Leaderboards = () => { type RequestState = "idle" | "working" | "failed"; -const LoginForm = function ({ onSubmitSuccess }) { +interface LoginFormProps { + onSubmitSuccess: () => void; +} + +const LoginForm = function ({ onSubmitSuccess }: LoginFormProps) { const [email, setEmail] = useState(""); const [state, setState] = useState("idle"); diff --git a/jb-ui/src/pages/Transfer.tsx b/jb-ui/src/pages/Transfer.tsx index 0d174c1..8079da2 100644 --- a/jb-ui/src/pages/Transfer.tsx +++ b/jb-ui/src/pages/Transfer.tsx @@ -1,5 +1,5 @@ import { type FormEvent, useState } from "react"; -import { useAppDispatch, useAppSelector } from "@/hooks"; +import { useAppSelector } from "@/hooks"; import { useGetMeQuery } from "@/models/authAPI"; import { Button } from "@/components/ui/button"; import max_lulu from "./max-and-lulu.jpg"; @@ -41,10 +41,14 @@ const TransferComplete = function () { type RequestState = "idle" | "working" | "sent" | "failed"; -const TransferSubmit = function ({ onSubmitSuccess }) { +interface TransferSubmitProps { + onSubmitSuccess: () => void; +} + +const TransferSubmit = function ({ onSubmitSuccess }: TransferSubmitProps) { const [email, setEmail] = useState(""); const [state, setState] = useState("idle"); - const { data: user, isLoading, isError } = useGetMeQuery(); + const { data: user } = useGetMeQuery(); const submit = async (event: FormEvent) => { event.preventDefault(); @@ -133,7 +137,6 @@ const TransferSubmit = function ({ onSubmitSuccess }) { const Transfer = function () { const bpuid = useAppSelector((state) => state.app.bpuid); - const { data: user, isLoading, isError } = useGetMeQuery(); const [submitted, setSubmitted] = useState(false); if (!bpuid) { diff --git a/jb-ui/src/pages/Work.tsx b/jb-ui/src/pages/Work.tsx index 50ed930..6d0b1c1 100644 --- a/jb-ui/src/pages/Work.tsx +++ b/jb-ui/src/pages/Work.tsx @@ -47,13 +47,13 @@ import { } from "@tanstack/react-table"; import { XIcon } from "lucide-react"; import moment from "moment/moment"; -import { useEffect, useRef, useState } from "react"; +import { useEffect, useState } from "react"; import Markdown from "react-markdown"; const Report = ({ onClose }: { onClose: () => void }) => { - const [showComplete, setShowComplete] = useState(false); + const [, setShowComplete] = useState(false); const [selectedValues, setSelectedValues] = useState([]); - const { data: user, isLoading, isError } = useGetMeQuery(); + const { data: user } = useGetMeQuery(); const ts = useAppSelector((state) => state.app.taskStatus); const handleCheckboxChange = (value: ReportValue, checked: boolean) => { @@ -197,10 +197,10 @@ const SurveyMonitor = () => { const [isPolling, setIsPolling] = useState(true); // const [timeAgo, setTimeAgo] = useState(""); - const [showComplete, setShowComplete] = useState(false); + const [, setShowComplete] = useState(false); const [showReport, setShowReport] = useState(false); - const { data: user, isLoading, isError } = useGetMeQuery(); + const { data: user } = useGetMeQuery(); const entered = useAppSelector((state) => state.app.currentBucketEntered); const isLow = useAppSelector((state) => isLowBalance(state)); @@ -691,7 +691,7 @@ const BucketDetails = () => { const SurveyEnter = () => { const dispatch = useAppDispatch(); const loi = useAppSelector((state) => state.app.loi); - const { data: user, isLoading, isError } = useGetMeQuery(); + const { data: user } = useGetMeQuery(); const available_cnt = useAppSelector((state) => getAvailabilityCount(state)); const buckets = useAppSelector((state) => state.app.currentBuckets); -- cgit v1.2.3