Skip to content

Commit

Permalink
Merge pull request #19 from ifspcbt-devspace/develop
Browse files Browse the repository at this point in the history
fix: mobile
  • Loading branch information
oproprioleonardo authored Sep 25, 2024
2 parents dd4013d + 83433bc commit e607952
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
9 changes: 9 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
--soft-grey: #cbd5df;
}

body {
position: relative;
padding-right: 0 !important;
}

html {
padding-right: 0 !important;
}

@media screen and (max-width: 320px) {
#__next {
display: flex
Expand Down
7 changes: 5 additions & 2 deletions src/components/events/single/EventView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import React, {Suspense, useEffect, useState} from "react";
import React, {Dispatch, SetStateAction, Suspense, useEffect, useState} from "react";
import {Event} from "@/models";
import {usePathname, useRouter, useSearchParams} from "next/navigation";
import {getEvent} from "@/server-actions/event.action";
Expand Down Expand Up @@ -53,7 +53,7 @@ export function EventView({params}: { params: { id: string } }) {
onOpen();
}

const handleAction = async () => {
const handleAction = async (open: () => void, setTicketID: Dispatch<SetStateAction<string>>) => {
if (event) {
if (!isAuth) {
router.push(`/auth/log-in?redir=${pathname + `?open=true`}`);
Expand All @@ -64,6 +64,8 @@ export function EventView({params}: { params: { id: string } }) {
toast.error(resp.error, toastConfig);
} else {
toast.success("Inscrição foi realizada com sucesso", toastConfig);
setTicketID(resp);
open();
}
}
}
Expand All @@ -74,6 +76,7 @@ export function EventView({params}: { params: { id: string } }) {
<>
<div className={"relative"}>
<ConfirmSubscription action={handleAction} isOpenConfirmModal={isOpen} onOpenChangeConfirmModal={onOpenChange}/>

</div>

<DarkPageHeader title={`${event?.name} - ${event?.init_date.toLocaleString([], {dateStyle: "short"})}`}
Expand Down
16 changes: 11 additions & 5 deletions src/components/events/subscription/ConfirmSubscription.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import {Button, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader} from "@nextui-org/react";
import {Button, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, useDisclosure} from "@nextui-org/react";
import {BsClipboard2Check} from "react-icons/bs";
import QrCodeModal from "@/components/events/subscription/qrcode/QrCodeModal";
import {Dispatch, SetStateAction, useState} from "react";

export default function ConfirmSubscription(
export default (
{
action, isOpenConfirmModal, onOpenChangeConfirmModal
}: {
action?: () => void,
action?: (open: () => void, setTicketID: Dispatch<SetStateAction<string>>) => void,
isOpenConfirmModal: boolean,
onOpenChangeConfirmModal: () => void
}) {
}) => {
const [ticketID, setTicketID] = useState('')
const {isOpen, onOpen, onOpenChange} = useDisclosure();


return (
<>
<QrCodeModal ticketId={ticketID} isOpen={isOpen} onOpenChange={onOpenChange}/>
<Modal isOpen={isOpenConfirmModal} onOpenChange={onOpenChangeConfirmModal} placement="center" size="xs">
<ModalContent>
{(onClose) => (
Expand All @@ -33,7 +39,7 @@ export default function ConfirmSubscription(
color="primary"
onClick={() => {
onClose();
if (action) action();
if (action) action(onOpen, setTicketID);
}}
>
Confirmar
Expand Down

0 comments on commit e607952

Please sign in to comment.