import React from 'react' import {Separator} from "@/components/ui/separator" import {Link} from '@mui/material'; import {useSelector} from "react-redux"; import {Card, CardContent, CardFooter, CardHeader, CardTitle} from "@/components/ui/card.tsx"; import {ScrollArea} from "@/components/ui/scroll-area.tsx"; import {makeSelectQuestionsByIds, setNextQuestion, setQuestions} from "@/models/questionSlice.ts" import {CheckIcon, MessageCircleQuestionIcon, XIcon} from "lucide-react" import { BodyOfferwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost, OfferwallApi, SoftPairBucket, UserQuestionAnswerIn } from "@/api" import {useAppDispatch, useAppSelector} from '@/hooks' import {Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger,} from "@/components/ui/sheet" import {ProfileQuestionFull} from "@/pages/Questions.tsx" import {Answer, saveAnswer, selectAnswerForQuestion, submitAnswer} from "@/models/answerSlice.ts"; import {assert} from "@/lib/utils.ts"; import {setAvailabilityCount, setOfferwallId} from "@/models/appSlice.ts"; import {setBuckets} from "@/models/bucketSlice.ts"; const BucketStatus: React.FC = ({bucket}) => { switch (bucket.eligibility) { case "eligible": return ; case "conditional": return ; case "ineligible": return ; } } const ConditionalQuestions: React.FC = ({bucket}) => { const dispatch = useAppDispatch() const questions = useSelector(makeSelectQuestionsByIds(bucket.missing_questions)) const question = questions[0] const answer: Answer | undefined = useSelector(selectAnswerForQuestion(question)); const app = useAppSelector(state => state.app) console.log("Conditional bucket:", questions, question, answer) const submitEvt = () => { dispatch(submitAnswer({question: question})) assert(!answer?.complete, "Can't submit completed Answer") assert(!answer?.processing, "Can't submit processing Answer") assert(answer?.error_msg.length == 0, "Can't submit Answer with error message") let body: BodyOfferwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost = { 'answers': [{ "question_id": question.question_id, "answer": answer.values } as UserQuestionAnswerIn ] } new OfferwallApi().offerwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost(app.bpid, app.offerwall_id, app.bpuid, body) .then(res => { if (res.status == 200) { dispatch(setAvailabilityCount(res.data.offerwall.availability_count)) dispatch(setOfferwallId(res.data.offerwall.id)) dispatch(setBuckets(res.data.offerwall.buckets)) } else { // let error_msg = res.data.msg } }) .catch(err => console.log(err)); } return ( Open Bucket Questions This survey has some unanswered questions. Answer these to determine if you're eligible for the Survey Bucket { questions.map(q => { return }) } ) } const CallToAction: React.FC = ({bucket}) => { switch (bucket.eligibility) { case "eligible": return ; case "conditional": return case "ineligible": return ; } } 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}