diff options
| author | Max Nanis | 2025-06-07 04:17:19 +0700 |
|---|---|---|
| committer | Max Nanis | 2025-06-07 04:17:19 +0700 |
| commit | 51b1003d1e0ce43aa6c30f461d710cb09cdfc29f (patch) | |
| tree | 85a33808ae2e01a3a46ffbbf4e0255b0c27caa7e /src/Widget.tsx | |
| parent | 257bc2f85b71a8564e95a8e6ba39ab0b00e022df (diff) | |
| download | panel-ui-51b1003d1e0ce43aa6c30f461d710cb09cdfc29f.tar.gz panel-ui-51b1003d1e0ce43aa6c30f461d710cb09cdfc29f.zip | |
Passing in onClick for FullProfileQuestion so that Profile Question and SoftPair are different. Using API models to POST to Softpair submission (with offerwall_id saved). Updating from Conditional to Ineligible buckets. Availability Count to app state. Using / exploring sidebar to show filtered questions for specific Bucket.
Diffstat (limited to 'src/Widget.tsx')
| -rw-r--r-- | src/Widget.tsx | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/Widget.tsx b/src/Widget.tsx index c28b55d..3f7902c 100644 --- a/src/Widget.tsx +++ b/src/Widget.tsx @@ -7,9 +7,10 @@ import {QuestionsPage} from "@/pages/Questions.tsx"; import {useAppDispatch, useAppSelector} from "@/hooks.ts"; import {OfferwallApi, ProfilingQuestionsApi} from "@/api"; +import {ProfileQuestion, setQuestions} from "@/models/questionSlice.ts"; import {setBuckets} from "@/models/bucketSlice.ts"; -import {setQuestions} from "@/models/questionSlice.ts" import {CashoutMethodsPage} from "@/pages/CashoutMethods.tsx"; +import {setAvailabilityCount, setOfferwallId} from "@/models/appSlice.ts" import './index.css'; @@ -23,13 +24,21 @@ const Widget = () => { // https://fsb.generalresearch.com/{product_id}/offerwall/37d1da64/?country new OfferwallApi().offerwallSoftpairProductIdOfferwall37d1da64Get(app.bpid, app.bpuid, "104.9.125.144") .then(res => { + + // We want to set these questions first, because the Bucket Component views may do + // some redux lookups + const objects: ProfileQuestion[] = Object.values(res.data.offerwall.question_info) as ProfileQuestion[] + dispatch(setQuestions(objects)) + + dispatch(setAvailabilityCount(res.data.offerwall.availability_count)) + dispatch(setOfferwallId(res.data.offerwall.id)) dispatch(setBuckets(res.data.offerwall.buckets)) }) .catch(err => console.log(err)); - new ProfilingQuestionsApi().getProfilingQuestionsProductIdProfilingQuestionsGet(app.bpid, app.bpuid, "104.9.125.144", undefined, undefined, 2500 ) + new ProfilingQuestionsApi().getProfilingQuestionsProductIdProfilingQuestionsGet(app.bpid, app.bpuid, "104.9.125.144", undefined, undefined, 2500) .then(res => { - dispatch(setQuestions(res.data.questions)) + dispatch(setQuestions(res.data.questions as ProfileQuestion[])) }) .catch(err => console.log(err)); }, []); // ← empty array means "run once" @@ -37,7 +46,7 @@ const Widget = () => { return ( <SidebarProvider> - <AppSidebar variant="floating" /> + <AppSidebar variant="floating"/> <SidebarInset> <SiteHeader/> @@ -45,9 +54,9 @@ const Widget = () => { <div className="@container/main flex flex-1 flex-col gap-2"> <div className="flex flex-col gap-4 py-4 md:gap-6 md:py-6"> <div className="px-4 lg:px-6"> - {app.currentPage === 'offerwall' && <Offerwall />} - {app.currentPage === 'questions' && <QuestionsPage />} - {app.currentPage === 'cashouts' && <CashoutMethodsPage />} + {app.currentPage === 'offerwall' && <Offerwall/>} + {app.currentPage === 'questions' && <QuestionsPage/>} + {app.currentPage === 'cashouts' && <CashoutMethodsPage/>} </div> </div> </div> |
