diff --git a/src/app/(pages)/(protected)/profile/public/page.tsx b/src/app/(pages)/(protected)/profile/public/page.tsx index 9a553bc..f538927 100644 --- a/src/app/(pages)/(protected)/profile/public/page.tsx +++ b/src/app/(pages)/(protected)/profile/public/page.tsx @@ -11,7 +11,6 @@ import { Heading, Icon, Image, - Select, Button, Spacer, FormControl, @@ -28,6 +27,7 @@ import { Text, Box, Skeleton, + IconButton, } from "@chakra-ui/react"; import { FiArrowRight, FiCamera, FiInstagram } from "react-icons/fi"; import z from "zod"; @@ -37,13 +37,33 @@ import axios from "axios"; import { useState, useCallback, useEffect } from "react"; import { useDropzone, FileRejection } from "react-dropzone"; import { getClientSession } from "@utils"; -import { UseFormSetValue, useForm } from "react-hook-form"; +import { Controller, UseFormSetValue, useForm } from "react-hook-form"; +import { AtSignIcon } from "@chakra-ui/icons"; +import { FormatOptionLabelMeta, Select } from "chakra-react-select"; +import { CloseIcon } from "@chakra-ui/icons"; +import { useSearchParams } from "next/navigation"; + +const skillOptions = [ + { value: 1, label: "I've never played before" }, + { value: 2, label: "I'm a beginner player" }, + { value: 3, label: "I'm an intermediate player" }, + { value: 4, label: "I'm an advanced player" }, +]; const schema = z.object({ first_name: z.string().min(1, ZOD_ERR.REQ_FIELD), last_name: z.string().min(1, ZOD_ERR.REQ_FIELD), - skill: z.string().min(1, ZOD_ERR.REQ_FIELD), - instagram: z.string().min(1, ZOD_ERR.REQ_FIELD), + skill: z.number(), + instagram: z + .literal("") + .or( + z + .string() + .regex( + /^([A-Za-z0-9_](?:(?:[A-Za-z0-9_]|(?:\.(?!\.))){0,28}(?:[A-Za-z0-9_]))?)$/, + "Invalid Instagram Username", + ), + ), profile: z.string().min(1), }); @@ -56,12 +76,16 @@ const initialFormUpdate = async (setValue: UseFormSetValue