Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
<title>Driven.t</title>
</head>
<body>
Expand Down
8 changes: 4 additions & 4 deletions src/components/Dashboard/NavigationBar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@ export default function NavigationBar() {
</Link>

<Link to="/dashboard/payment">
<NavigationButton active={isActive('/dashboard/paymen')}>
<NavigationButton active={isActive('/dashboard/payment')}>
<FaMoneyBill />
<span>Pagamento</span>
</NavigationButton>
</Link>

<Link to="/dashboard/hotel">
<NavigationButton active={isActive('/dashboard/hote')}>
<NavigationButton active={isActive('/dashboard/hotel')}>
<FaBed />
<span>Hotel</span>
</NavigationButton>
</Link>

<Link to="/dashboard/activities">
<NavigationButton active={isActive('/dashboard/activitie')}>
<NavigationButton active={isActive('/dashboard/activities')}>
<FaCalendarWeek />
<span>Atividades</span>
</NavigationButton>
</Link>

<Link to="/dashboard/certificate">
<NavigationButton active={isActive('/dashboard/certificat')}>
<NavigationButton active={isActive('/dashboard/certificate')}>
<FaCertificate />
<span>Certificado</span>
</NavigationButton>
Expand Down
27 changes: 27 additions & 0 deletions src/components/Message.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import styled from 'styled-components';

export default function Message({ text }) {
return (
<Container>
<Text>{text}</Text>
</Container>
);
}

const Container = styled.div`
height: 85%;
width: 100%;

display: flex;
align-items: center;
justify-content: center;
`;

const Text = styled.p`
font-family: 'Roboto', sans-serif;
max-width: 388px;
text-align: center;
font-size: 20px;
font-weight: 400;
color: #8E8E8E;
`;
5 changes: 4 additions & 1 deletion src/components/PersonalInformationForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { InputWrapper } from './InputWrapper';
import { ErrorMsg } from './ErrorMsg';
import { ufList } from './ufList';
import FormValidations from './FormValidations';
import { useNavigate } from 'react-router';

dayjs.extend(CustomParseFormat);

Expand All @@ -30,6 +31,7 @@ export default function PersonalInformationForm() {
const { getCep } = useCep();
const { enrollment } = useEnrollment();
const { saveEnrollmentLoading, saveEnrollment } = useSaveEnrollment();
const navigate = useNavigate();

const {
handleSubmit,
Expand All @@ -45,7 +47,7 @@ export default function PersonalInformationForm() {
const newData = {
name: data.name,
cpf: data.cpf.replaceAll('.', '').replaceAll('-', ''),
birthday: dayjs(data.birthday).toISOString(),
birthday: await dayjs(data.birthday).toISOString(),
address: {
cep: data.cep,
street: data.street,
Expand All @@ -60,6 +62,7 @@ export default function PersonalInformationForm() {

try {
await saveEnrollment(newData);
navigate('/dashboard/payment');
toast('Informações salvas com sucesso!');
} catch (err) {
toast('Não foi possível salvar suas informações!');
Expand Down
47 changes: 47 additions & 0 deletions src/components/TicketAndPaymentForm/ButtonOption.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import styled from 'styled-components';

export default function ButtonOption({ size, height, text, value, selected, setSelected, type }) {
return (
<ClickButton size={size} height={height} text={text} selected={selected} type={type}
onClick={() => {
selected[type] = text;
setSelected({ ...selected });
}
}
>
<span>{text}</span>
<p>{value}</p>
</ClickButton>
);
}

const ClickButton = styled.div`
width: ${({ size }) => size}px;
height: ${({ size, height }) => (height)? height : size}px;

border-radius: 20px;
${({ text, selected, type }) => (selected[type] === text)?
'background-color: #FFEED2;':
'border: 1px solid #CECECE;'
}
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
gap: 3px;

font-family: 'Roboto', sans-serif;
font-size: 14px;
font-weight: 400;
color: #8E8E8E;

span {
font-size: 16px;
color: #454545;
}

&:hover{
cursor: pointer;
}
`;

88 changes: 88 additions & 0 deletions src/components/TicketAndPaymentForm/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import styled from 'styled-components';
import Typography from '@material-ui/core/Typography';
import Message from '../Message';
import useEnrollment from '../../hooks/api/useEnrollment';
import ButtonOption from './ButtonOption';
import { useState } from 'react';

export default function TicketAndPaymentForm() {
const { enrollment } = useEnrollment();

const [selected, setSelected] = useState({
modality: '',
hotel: ''
});

return (
<Container>
<StyledTypography variant="h4">Ingresso e pagamento</StyledTypography>
{(enrollment)?
<TicketForm>
<StyleLabel>Primeiro, escolha sua modalidade de ingresso</StyleLabel>
<Options>
<ButtonOption
size={145}
text='Presencial'
value='R$ 250'
selected={selected}
setSelected={setSelected}
type={'modality'}
/>
<ButtonOption
size={145}
text='Online'
value='R$ 100'
selected={selected}
setSelected={setSelected}
type={'modality'}
/>
</Options>
<StyleLabel>Ótimo! Agora escolha sua modalidade de hospedagem</StyleLabel>
</TicketForm>
:<Message
text='Você precisa completar sua inscrição antes de prosseguir pra escolha de ingresso'
/>
}
</Container>
);
}

const Container = styled.div`
width: 100%;
height: 100%;

display: flex;
flex-direction: column;
align-items: start;
gap: 37px;
`;

const TicketForm = styled.div`
width: 100%;

display: flex;
flex-direction: column;
align-items: start;
gap:17px;
`;

const Options = styled.div`
width: 100%;

display: flex;
justify-content: flex-start;
gap: 24px;

margin-bottom: 45px;
`;

const StyledTypography = styled(Typography)`
margin-bottom: 20px!important;
`;

const StyleLabel = styled.p`
font-family: 'Roboto', sans-serif;
font-size: 20px;
font-weight: 400;
color: #8E8E8E;
`;
1 change: 1 addition & 0 deletions src/hooks/useForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const useForm = (options) => {

const customHandleChange = (key, sanitizeFn) => (inputValue) => {
const value = sanitizeFn ? sanitizeFn(inputValue) : inputValue;

setData({
...data,
[key]: value,
Expand Down
7 changes: 6 additions & 1 deletion src/pages/Dashboard/Payment/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import TicketAndPaymentForm from '../../../components/TicketAndPaymentForm';

export default function Payment() {
return 'Pagamento: Em breve!';
return (
<TicketAndPaymentForm/>
);
}

3 changes: 1 addition & 2 deletions src/pages/Dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import DashboardLayout from '../../layouts/Dashboard';

export default function Dashboard() {
const { eventInfo } = useContext(EventInfoContext);

return (
<DashboardLayout background={eventInfo.backgroundImageUrl}>
<NavigationBar />

<Container>
<Outlet />
</Container>
Expand Down