import * as React from 'react'; import {Box,Stepper,Step,StepLabel,StepContent,Button,Paper,Typography,Grid,TextField} from "@mui/material" import ArtistDashboardRequest from './artistRequest'; import EditableArtistPortfolio from './artist/editablePortfolio'; import { useEffect, useState } from "react"; import CurrencyTextField from '@lupus-ai/mui-currency-textfield'; import {Card, CardContent, CardHeader, Divider } from '@mui/material'; const steps = [ { label: 'Request Access As Artist', description: `In order to start selling your art on our platform, you need to request access. Please include links to your social media and tag or DM us on the platform (@RequestDotBox). We may reach out for further verification and examples of your work.`, }, { label: 'Onboard On Stripe', description: 'Our platform uses Stripe as a payment processor. You will be required to onboard with them with all of your payout information and business information.', }, { label: 'Setup Your Portfolio', description: `This is where you can setup your initial portfolio. You can upload any image format file to your portfolio. It will be automatically displayed on your artist page. You can add and remove from this later.`, }, ]; export default function Onboarding() { const [activeStep, setActiveStep] = React.useState(0); const [sellerRequestData, setArtistRequestData] = React.useState(null); const [profileData, setArtistData] = React.useState(null); const [isStripeOnboarded, setIsStripeOnboarded] = React.useState(false); const [onBoardUrl, setOnBoardUrl] = React.useState(""); const [requestMessage, setRequestMessage] = React.useState(""); const handleNext = () => { setActiveStep((prevActiveStep) => prevActiveStep + 1); }; const handleBack = () => { setActiveStep((prevActiveStep) => prevActiveStep - 1); }; const handleReset = () => { setActiveStep(0); }; const handleRequestMessage = (event) => { setRequestMessage(event.target.value); } const getData = async () => { const onboardCheckRequest = await fetch('/api/artist/onboarded', { method: "GET" }); const onboardCheckResponse = await onboardCheckRequest.json(); setIsStripeOnboarded(onboardCheckResponse["onboarded"]); const onboardUrlRequest = await fetch('/api/artist/onboardurl', { method: "GET" }); const onboardUrlResponse = await onboardUrlRequest.json(); setOnBoardUrl(onboardUrlResponse["onboardUrl"]); const response = await fetch('/api/artist/request'); const sellerRequest = await response.json(); setArtistRequestData(sellerRequest); const profileResponse = await fetch('/api/artist/profile'); const sellerProfile = await profileResponse.json(); setArtistData(sellerProfile); // Poll every 5 seconds (adjust as needed) } React.useEffect(() => { getData(); setTimeout(getData, 30000); }, []); const requestButton = () => { fetch('/api/artist/artistAccessRequest', {headers:{ "Content-Header":"application/json"},method:"POST",body:JSON.stringify(requestMessage)}).then((response) => { if (response.ok) { fetch('/api/artist/request').then((requestResponse) => { requestResponse.json().then((sellerRequest) => { setArtistRequestData(sellerRequest); }); }); } }); } let formattedTime = "" if (sellerRequestData) { const date = new Date(sellerRequestData["requestDate"]); formattedTime = date.toLocaleTimeString('en-US', { month: 'long', day: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit' }); // Example format } return ( {steps.map((step, index) => ( Last step ) : null } > {step.label} {(index==0) ? ( {step.description} {(sellerRequestData && Object.keys(sellerRequestData).length>0) ? ( ):( )}
{(sellerRequestData && Object.keys(sellerRequestData).length>0) ? ( (sellerRequestData["accepted"]) ? ( ) : ( ) ): ( )}
): null} {(index==1) ? ( {step.description}
{isStripeOnboarded==true ? ( ):( )}
): null} {(index==2) ? ( {step.description}
): null}
))}
{activeStep === steps.length && ( We are setting up your account please wait. )}
); }