From a23bf282d942b6446ea641d1aab361f357af65f9 Mon Sep 17 00:00:00 2001 From: Aditya Veer Parmar Date: Wed, 29 Mar 2023 12:27:39 +0530 Subject: [PATCH] fix: multi page bug fixes --- app/modules/Collection/Form/Field/index.tsx | 8 +-- .../FormBuilder/ConnectPage/ProfileInfo.tsx | 1 - .../Form/FormBuilder/ConnectPage/index.tsx | 12 ++-- .../Form/FormBuilder/SubmittedPage/index.tsx | 13 ++-- .../Collection/Form/FormBuilder/index.tsx | 9 +-- app/modules/Plugins/guildxyz/index.tsx | 2 +- app/modules/PublicForm/FormFields.tsx | 69 +++++++++---------- app/modules/PublicForm/index.tsx | 1 - 8 files changed, 59 insertions(+), 56 deletions(-) diff --git a/app/modules/Collection/Form/Field/index.tsx b/app/modules/Collection/Form/Field/index.tsx index bd03cac9..85142fe2 100644 --- a/app/modules/Collection/Form/Field/index.tsx +++ b/app/modules/Collection/Form/Field/index.tsx @@ -280,7 +280,7 @@ function FieldComponent({ )} {collection.properties[id]?.type === "discord" && ( - + } @@ -291,7 +291,7 @@ function FieldComponent({ )} {collection.properties[id]?.type === "twitter" && ( - + } @@ -302,7 +302,7 @@ function FieldComponent({ )} {collection.properties[id]?.type === "telegram" && ( - + } @@ -313,7 +313,7 @@ function FieldComponent({ )} {collection.properties[id]?.type === "github" && ( - + } diff --git a/app/modules/Collection/Form/FormBuilder/ConnectPage/ProfileInfo.tsx b/app/modules/Collection/Form/FormBuilder/ConnectPage/ProfileInfo.tsx index dc2e5932..8df6b5f2 100644 --- a/app/modules/Collection/Form/FormBuilder/ConnectPage/ProfileInfo.tsx +++ b/app/modules/Collection/Form/FormBuilder/ConnectPage/ProfileInfo.tsx @@ -1,7 +1,6 @@ import { UserType } from "@/app/types"; import { GithubOutlined, TwitterOutlined } from "@ant-design/icons"; import { Avatar, Box, Button, Stack, Tag, Text } from "degen"; -import { motion } from "framer-motion"; import { Tooltip } from "react-tippy"; import DiscordIcon from "@/app/assets/icons/discordIcon.svg"; import { Globe } from "react-feather"; diff --git a/app/modules/Collection/Form/FormBuilder/ConnectPage/index.tsx b/app/modules/Collection/Form/FormBuilder/ConnectPage/index.tsx index 40685d0f..39fb0044 100644 --- a/app/modules/Collection/Form/FormBuilder/ConnectPage/index.tsx +++ b/app/modules/Collection/Form/FormBuilder/ConnectPage/index.tsx @@ -66,7 +66,6 @@ const ConnectPage = ({ form, setForm, currentPage, setCurrentPage }: Props) => { stampsWithScore.push(stampWithScore); } } - console.log({ stampsWithScore }); setStamps(stampsWithScore.sort((a, b) => b.score - a.score)); } }; @@ -133,7 +132,7 @@ const ConnectPage = ({ form, setForm, currentPage, setCurrentPage }: Props) => { return ( { md: "64", }} > - + {connectedUser && ( @@ -356,7 +360,7 @@ const ConnectPage = ({ form, setForm, currentPage, setCurrentPage }: Props) => { const StampScrollContainer = styled(Box)` overflow-y: auto; - height: calc(100vh - 35rem); + height: 20rem; ::-webkit-scrollbar { width: 5px; } diff --git a/app/modules/Collection/Form/FormBuilder/SubmittedPage/index.tsx b/app/modules/Collection/Form/FormBuilder/SubmittedPage/index.tsx index 3cae8eeb..1acdff04 100644 --- a/app/modules/Collection/Form/FormBuilder/SubmittedPage/index.tsx +++ b/app/modules/Collection/Form/FormBuilder/SubmittedPage/index.tsx @@ -27,21 +27,24 @@ const SubmittedPage = ({ return ( - {form.formMetadata.messageOnSubmission} - + + {form.formMetadata.messageOnSubmission} + + + {/* */} diff --git a/app/modules/Collection/Form/FormBuilder/index.tsx b/app/modules/Collection/Form/FormBuilder/index.tsx index 310b5381..09314945 100644 --- a/app/modules/Collection/Form/FormBuilder/index.tsx +++ b/app/modules/Collection/Form/FormBuilder/index.tsx @@ -414,9 +414,6 @@ function FormBuilder() { minHeight: "calc(100vh - 20rem)", }} > - - {FieldDraggableCallback} - + + + {FieldDraggableCallback} + @@ -474,7 +475,7 @@ const CoverImageButtonContainer = styled(Box)` `; const FormBuilderContainer = styled(Box)` - height: calc(100vh - 20rem); + min-height: calc(100vh - 20rem); display: flex; flex-direction: column; justify-content: space-between; diff --git a/app/modules/Plugins/guildxyz/index.tsx b/app/modules/Plugins/guildxyz/index.tsx index 84df03f4..607f7b5d 100644 --- a/app/modules/Plugins/guildxyz/index.tsx +++ b/app/modules/Plugins/guildxyz/index.tsx @@ -209,7 +209,7 @@ export default function RoleGate({ handleClose }: Props) { > Save - {collection.formMetadata?.formRoleGating?.length && ( + {(collection.formMetadata?.formRoleGating?.length || 0) > 0 && ( { if (form) { const tempData: any = {}; - console.log({ form: form.formMetadata, submitted }); if (form?.formMetadata.previousResponses?.length > 0 && submitted) { const lastResponse = form.formMetadata.previousResponses[ @@ -378,6 +377,37 @@ function FormFields({ form, setForm }: Props) { return ( + + {form && ( + { + if (submitted) { + setCurrentPage(form.formMetadata.pageOrder[step]); + } else if (updateResponse || !submitted) { + // can only go back + if ( + step < form.formMetadata.pageOrder.indexOf(currentPage || "") + ) { + setCurrentPage(form.formMetadata.pageOrder[step]); + } else { + if (currentPage === "start") { + toast.error( + "You can get started by clicking on the start button" + ); + } else { + toast.error("You can only go back"); + } + } + } else { + setCurrentPage(form.formMetadata.pageOrder[step]); + } + }} + /> + )} + + {emailModalOpen && ( - {form && ( - { - if (submitted) { - setCurrentPage(form.formMetadata.pageOrder[step]); - } else if (updateResponse || !submitted) { - // can only go back - if ( - step < form.formMetadata.pageOrder.indexOf(currentPage || "") - ) { - setCurrentPage(form.formMetadata.pageOrder[step]); - } else { - if (currentPage === "start") { - toast.error( - "You can get started by clicking on the start button" - ); - } else { - toast.error("You can only go back"); - } - } - } else { - setCurrentPage(form.formMetadata.pageOrder[step]); - } - }} - /> - )} - ); } @@ -634,7 +631,7 @@ const Container = styled(Box)` padding: 2rem; padding-bottom: 1rem; - height: calc(100vh - 15rem); + min-height: calc(100vh - 15rem); ::-webkit-scrollbar { width: 0.5rem; @@ -644,7 +641,7 @@ const Container = styled(Box)` `; const FormFieldContainer = styled(Box)` - height: calc(100vh - 15rem); + min-height: calc(100vh - 15rem); ::-webkit-scrollbar { width: 0.5rem; diff --git a/app/modules/PublicForm/index.tsx b/app/modules/PublicForm/index.tsx index 25dd0bdd..035ce54c 100644 --- a/app/modules/PublicForm/index.tsx +++ b/app/modules/PublicForm/index.tsx @@ -92,7 +92,6 @@ export const CoverImage = styled(Box)<{ src: string }>` background-image: url(${(props) => props.src}); background-size: cover; z-index: -1; - border-radius: 1rem; `; const FormContainer = styled(Box)`