aboutsummaryrefslogtreecommitdiff
path: root/src/Widget.tsx
diff options
context:
space:
mode:
authorMax Nanis2025-05-28 04:41:37 +0100
committerMax Nanis2025-05-28 04:41:37 +0100
commit8caa77413ea372e5cbd2980a9922d701af359c04 (patch)
tree9341e2f70fab6b2678fdff53c002954ef69c7b3e /src/Widget.tsx
downloadpanel-ui-8caa77413ea372e5cbd2980a9922d701af359c04.tar.gz
panel-ui-8caa77413ea372e5cbd2980a9922d701af359c04.zip
initial commit
Diffstat (limited to 'src/Widget.tsx')
-rw-r--r--src/Widget.tsx61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/Widget.tsx b/src/Widget.tsx
new file mode 100644
index 0000000..99c2a33
--- /dev/null
+++ b/src/Widget.tsx
@@ -0,0 +1,61 @@
+import React, {useEffect} from 'react'
+import {AppSidebar} from "@/components/app-sidebar"
+import {SiteHeader} from "@/components/site-header"
+import {SidebarInset, SidebarProvider} from "@/components/ui/sidebar"
+import {Offerwall} from "@/pages/Offerwall.tsx"
+import {QuestionsPage} from "@/pages/Questions.tsx";
+
+import {useAppDispatch, useAppSelector} from "@/hooks.ts";
+import {OfferwallApi, ProfilingQuestionsApi} from "@/api";
+import {setBuckets} from "@/models/bucketSlice.ts";
+import {setQuestions} from "@/models/questionSlice.ts"
+import {CashoutMethodsPage} from "@/pages/CashoutMethods.tsx";
+
+import './index.css';
+
+
+const Widget = () => {
+
+ const dispatch = useAppDispatch()
+ const app = useAppSelector(state => state.app)
+
+ useEffect(() => {
+ // https://fsb.generalresearch.com/{product_id}/offerwall/37d1da64/?country
+ new OfferwallApi().offerwallSoftpairProductIdOfferwall37d1da64Get(app.bpid, app.bpuid, "104.9.125.144")
+ .then(res => {
+ dispatch(setBuckets(res.data.offerwall.buckets))
+ })
+ .catch(err => console.log(err));
+
+ new ProfilingQuestionsApi().getProfilingQuestionsProductIdProfilingQuestionsGet(app.bpid, app.bpuid, "104.9.125.144")
+ .then(res => {
+ dispatch(setQuestions(res.data.questions))
+ })
+ .catch(err => console.log(err));
+ }, []); // ← empty array means "run once"
+
+
+ return (
+ <SidebarProvider>
+ <AppSidebar variant="floating" />
+ <SidebarInset>
+ <SiteHeader/>
+
+ <div className="flex flex-1 flex-col">
+ <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/>}
+ </div>
+ </div>
+ </div>
+ </div>
+
+ </SidebarInset>
+ </SidebarProvider>
+ )
+}
+
+export {Widget}