From 8caa77413ea372e5cbd2980a9922d701af359c04 Mon Sep 17 00:00:00 2001 From: Max Nanis Date: Wed, 28 May 2025 04:41:37 +0100 Subject: initial commit --- src/pages/CashoutMethods.tsx | 48 ++++++++++++++++++++ src/pages/Community.tsx | 50 +++++++++++++++++++++ src/pages/Offerwall.tsx | 101 +++++++++++++++++++++++++++++++++++++++++ src/pages/Questions.tsx | 105 +++++++++++++++++++++++++++++++++++++++++++ src/pages/Support.tsx | 38 ++++++++++++++++ 5 files changed, 342 insertions(+) create mode 100644 src/pages/CashoutMethods.tsx create mode 100644 src/pages/Community.tsx create mode 100644 src/pages/Offerwall.tsx create mode 100644 src/pages/Questions.tsx create mode 100644 src/pages/Support.tsx (limited to 'src/pages') diff --git a/src/pages/CashoutMethods.tsx b/src/pages/CashoutMethods.tsx new file mode 100644 index 0000000..86727ee --- /dev/null +++ b/src/pages/CashoutMethods.tsx @@ -0,0 +1,48 @@ +import React, {useEffect, useState} from 'react' + +import {Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle} from "@/components/ui/card.tsx"; +import {GRLWidgetSettings} from "@/Widget.tsx" +import {CashoutMethodsResponse, WalletApi} from "@/api" +import {CashoutMethod} from "@/models/CashoutMethod.ts"; + +const CashoutMethodPreview: React.FC<{ cashout_method: CashoutMethod }> = ({cashout_method}) => { + + return ( + + + {cashout_method.name} + + + + + + + ) +} + +const CashoutMethodsPage: React.FC = ({settings}) => { + const [cashoutMethods, setCashoutMethods] = useState([]); + + useEffect(() => { + const x = new WalletApi(); + x.getCashoutMethodsProductIdCashoutMethodsGet(settings.bpid, settings.bpuid) + .then(res => { + const data: CashoutMethodsResponse = res.data; + setCashoutMethods(data.cashout_methods); + }) + .catch(err => console.log(err)); + }, []); // ← empty array means "run once" + + return ( + + { + cashoutMethods.map((m, index) => { + const cm = new CashoutMethod(m); + return ; + }) + } + + ); +} + +export {CashoutMethodsPage} \ No newline at end of file diff --git a/src/pages/Community.tsx b/src/pages/Community.tsx new file mode 100644 index 0000000..88cb74d --- /dev/null +++ b/src/pages/Community.tsx @@ -0,0 +1,50 @@ +import React, {useEffect, useState} from 'react' + +import {Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle} from "@/components/ui/card.tsx"; +import {GRLWidgetSettings} from "@/Widget.tsx" +import {CashoutMethodsResponse, WalletApi} from "@/api" +import {CashoutMethod} from "@/models/CashoutMethod.ts"; + +const CashoutMethodPreview: React.FC<{ cashout_method: CashoutMethod }> = ({cashout_method}) => { + + console.log("CashoutMethodPreview", cashout_method) + + return ( + + + {cashout_method.name} + + + + + + + ) +} + +const CommunityPage: React.FC = ({settings}) => { + const [cashoutMethods, setCashoutMethods] = useState([]); + + useEffect(() => { + const x = new WalletApi(); + x.getCashoutMethodsProductIdCashoutMethodsGet(settings.bpid, settings.bpuid) + .then(res => { + const data: CashoutMethodsResponse = res.data; + setCashoutMethods(data.cashout_methods); + }) + .catch(err => console.log(err)); + }, []); // ← empty array means "run once" + + return ( + + { + cashoutMethods.map((m, index) => { + const cm = new CashoutMethod(m); + return ; + }) + } + + ); +} + +export {CommunityPage} \ No newline at end of file diff --git a/src/pages/Offerwall.tsx b/src/pages/Offerwall.tsx new file mode 100644 index 0000000..acce696 --- /dev/null +++ b/src/pages/Offerwall.tsx @@ -0,0 +1,101 @@ +import React from 'react' +import {Separator} from "@/components/ui/separator" +import {Link} from '@mui/material'; + +import {Card, CardContent, CardFooter, CardHeader, CardTitle} from "@/components/ui/card.tsx"; +import {ScrollArea} from "@/components/ui/scroll-area.tsx"; +import {CheckIcon, MessageCircleQuestionIcon, XIcon} from "lucide-react" +import {SoftPairBucket} from "@/api/models/soft-pair-bucket.ts" +import {useAppSelector} from '@/hooks' + +const BucketStatus: React.FC = ({bucket}) => { + switch (bucket.eligibility) { + case "eligible": + return ; + case "conditional": + return ; + case "ineligible": + return ; + } +} + +const CallToAction: React.FC = ({bucket}) => { + switch (bucket.eligibility) { + case "eligible": + return + + Start Survey + + ; + case "conditional": + return + Unlock Survey + ; + + case "ineligible": + return + Ineligible Survey + ; + } +} + +const Offerwall = () => { + const buckets = useAppSelector(state => state.buckets) + + return ( + + + + {buckets.map((bucket) => ( + + + + Card 1 + + + + {/**/} + {/*4.5*/} + + + + + {/**/} + {/* */} + {/**/} + + + + Tags + {bucket.contents.map((survey) => ( + <> + + {survey.id_code} - {survey.loi} seconds - {survey.payout} cents + + + > + ))} + + + + + + + ))} + + + + ) +} + +export {Offerwall} \ No newline at end of file diff --git a/src/pages/Questions.tsx b/src/pages/Questions.tsx new file mode 100644 index 0000000..13d31c4 --- /dev/null +++ b/src/pages/Questions.tsx @@ -0,0 +1,105 @@ +import React, {useEffect, useState} from 'react' + +import {ProfilingQuestionsApi, UpkQuestionResponse} from "@/api" +import {ProfilingQuestion} from "@/models/question.ts"; +import {setAnswer} from "@/models/questionSlice.ts" +import {UpkQuestion} from "@/api/models/upk-question.ts" +import {Card, CardContent, CardHeader} from "@/components/ui/card.tsx"; +import {useAppDispatch, useAppSelector} from "@/hooks.ts"; + + +const TextEntry: React.FC<{ question: UpkQuestion }> = ({question}) => { + const dispatch = useAppDispatch() + // const buckets = useAppSelector(state => state.buckets) + + const handleInputChange = (event: React.ChangeEvent) => { + // Don't allow any input changes after they triggered submission... + if (question._complete || question._processing) { + return + } + + // Assign the input value as an answer to the question + const newValue = event.target.value; + dispatch(setAnswer({questionId: question.questionId, val: newValue})) + }; + + return ( + + + {question.questionText} + + + + + {question.error_msg} + + + ) +} + +const MultipleChoice: React.FC<{ question: UpkQuestion }> = ({question}) => { + + return ( + + + {question.questionText} + + + + MultipleChoice ... + + + ) +} + + +const ProfileQuestionFull: React.FC<{ question: UpkQuestion }> = ({question}) => { + console.log("ProfileQuestionFull", question, question) + + switch (question.questionType) { + case "TE": + return + + case "MC": + return + + default: + throw new Error("Incorrect Question Type provided"); + } +} + +const ProfileQuestionPreview: React.FC<{ question: UpkQuestion }> = ({question}) => { + + return ( + + {question.questionText} + + ) +}; + +const QuestionsPage = () => { + const questions = useAppSelector(state => state.questions) + + return ( + + + A total of {questions.length} questions are available. + + + { + questions.forEach(q => { + return ; + }) + } + + ); +} + +export { + QuestionsPage +} \ No newline at end of file diff --git a/src/pages/Support.tsx b/src/pages/Support.tsx new file mode 100644 index 0000000..4746b77 --- /dev/null +++ b/src/pages/Support.tsx @@ -0,0 +1,38 @@ +import React, { useEffect } from 'react'; + +const ChatwootLoader = () => { + useEffect(() => { + const loadChatwoot = () => { + const BASE_URL = "https://chat.g-r-l.com"; + const script = document.createElement('script'); + script.src = `${BASE_URL}/packs/js/sdk.js`; + script.defer = true; + script.async = true; + + script.onload = () => { + if (window.chatwootSDK) { + window.chatwootSDK.run({ + websiteToken: 'dEEw3fcexQvnQ5tesJPKFjSb', + baseUrl: BASE_URL, + }); + } + }; + + document.body.appendChild(script); + }; + + loadChatwoot(); + + // Clean up script when the component unmounts + return () => { + const existingScript = document.querySelector(`script[src="https://app.chatwoot.com/packs/js/sdk.js"]`); + if (existingScript) { + document.body.removeChild(existingScript); + } + }; + }, []); + + return null; +}; + +export {ChatwootLoader}; \ No newline at end of file -- cgit v1.2.3
MultipleChoice ...
+ A total of {questions.length} questions are available. +