From a85e33fae6c57914fc99802c6ccce330bc052794 Mon Sep 17 00:00:00 2001 From: ialexanderbrito Date: Sun, 22 May 2022 22:18:05 -0300 Subject: [PATCH] fix: react fragments --- src/components/Agenda/index.tsx | 38 +-- src/components/CardBarbeiroSelect/index.tsx | 32 +- src/components/Dropzone/index.tsx | 12 +- src/components/Navbar/index.tsx | 46 ++- src/components/Overlay/index.tsx | 106 +++--- src/components/Ticket/index.tsx | 117 ++++--- src/pages/Admin/index.tsx | 182 +++++----- src/pages/Barbeiro/index.tsx | 356 ++++++++++---------- src/pages/ForgetPassword/index.tsx | 74 ++-- src/pages/Login/index.tsx | 112 +++--- src/pages/MyTicket/index.tsx | 80 +++-- src/pages/Profile/index.tsx | 182 +++++----- src/pages/Register/index.tsx | 160 +++++---- src/pages/ResetPassword/index.tsx | 82 +++-- 14 files changed, 771 insertions(+), 808 deletions(-) diff --git a/src/components/Agenda/index.tsx b/src/components/Agenda/index.tsx index fb854c6..1f9793a 100644 --- a/src/components/Agenda/index.tsx +++ b/src/components/Agenda/index.tsx @@ -8,28 +8,26 @@ import styles from './Agenda.module.scss'; export function Agenda() { const { handleGoogleCalendarCliente, enventSaveBarbeiro } = useAgenda(); return ( - <> -
-

Adicionar ao seu calendário

+
+

Adicionar ao seu calendário

-
- +
+ - -
+
- +
); } diff --git a/src/components/CardBarbeiroSelect/index.tsx b/src/components/CardBarbeiroSelect/index.tsx index aed9593..c4fc3d0 100644 --- a/src/components/CardBarbeiroSelect/index.tsx +++ b/src/components/CardBarbeiroSelect/index.tsx @@ -36,23 +36,21 @@ export function CardBarbeiroSelected(props: CardBarbeiroProps) { }, [props.barbeiro]); return ( - <> -
-
- {photo === '' && (props.barbeiro?.avatar_url === null || props.barbeiro?.avatar_url === undefined) ? ( - - ) : ( - {props.barbeiro?.nome} - )} -
-
-

{name || props.barbeiro?.nome}

-
+
+
+ {photo === '' && (props.barbeiro?.avatar_url === null || props.barbeiro?.avatar_url === undefined) ? ( + + ) : ( + {props.barbeiro?.nome} + )}
- +
+

{name || props.barbeiro?.nome}

+
+
); } diff --git a/src/components/Dropzone/index.tsx b/src/components/Dropzone/index.tsx index 9c34857..3729e4b 100644 --- a/src/components/Dropzone/index.tsx +++ b/src/components/Dropzone/index.tsx @@ -46,13 +46,11 @@ const Dropzone: React.FC = ({ onFileUploaded }) => {

{user?.user_metadata.picture || user?.user_metadata.avatar_url ? ( - <> - Perfil - + Perfil ) : ( )} diff --git a/src/components/Navbar/index.tsx b/src/components/Navbar/index.tsx index f69ec58..8bbe1f9 100644 --- a/src/components/Navbar/index.tsx +++ b/src/components/Navbar/index.tsx @@ -14,29 +14,27 @@ export function Navbar(props: NavBarProps) { const navigate = useNavigate(); return ( - <> -

- + ); } diff --git a/src/components/Overlay/index.tsx b/src/components/Overlay/index.tsx index f62cce2..a7f2c9e 100644 --- a/src/components/Overlay/index.tsx +++ b/src/components/Overlay/index.tsx @@ -14,67 +14,63 @@ export function Overlay(props: OverlayProps) { const { handleGoogleCalendar, eventSaveCliente } = useOverlay(); return ( - <> -
-
- {props.children} -

{props.title}

-

{props.description}

+
+
+ {props.children} +

{props.title}

+

{props.description}

- {props.calendar && ( - <> - {isAndroid && ( - <> - - - )} - {isIOS && ( + {props.calendar && ( + <> + {isAndroid && ( + + )} + {isIOS && ( + + )} + + {(isWindows || isMacOs) && ( + <> + - )} - - {(isWindows || isMacOs) && ( - <> - - - - )} - - )} + + )} + + )} - -
+
- +
); } diff --git a/src/components/Ticket/index.tsx b/src/components/Ticket/index.tsx index e434a03..0de65a0 100644 --- a/src/components/Ticket/index.tsx +++ b/src/components/Ticket/index.tsx @@ -46,72 +46,69 @@ export function Ticket(props: Props) { } return ( - <> - -
-
-
-
- {photo === '' && - (props.cliente?.client_avatar === null || props.cliente?.client_avatar === undefined) ? ( -
- -
- ) : ( - {name} - )} -
-
{props.cliente?.client_name}
- + +
+
+
+
+ {photo === '' && (props.cliente?.client_avatar === null || props.cliente?.client_avatar === undefined) ? ( +
+
-
-
-
-
- -
-
- Data e Hora -
- {props.cliente?.br_date} -
-
- Barbeiro -
- {props.cliente?.barber_name} -
+ ) : ( + {name} + )} +
+
{props.cliente?.client_name}
+
-
-
№ {get8caracters(props.cliente?.id || '')}
+
+
+
+ +
+
+ Data e Hora +
+ {props.cliente?.br_date} +
+
+ Barbeiro +
+ {props.cliente?.barber_name} +
+
+
+
№ {get8caracters(props.cliente?.id || '')}
+
- - +
+ ); } diff --git a/src/pages/Admin/index.tsx b/src/pages/Admin/index.tsx index 63b1a2c..53dec61 100644 --- a/src/pages/Admin/index.tsx +++ b/src/pages/Admin/index.tsx @@ -32,111 +32,109 @@ export function Admin() { const { ocupacao } = useAuth(); return ( - <> -
-
-
-
- -
+
+
+
+
+ +
+ + - + {ocupacao === 'cliente' && ( +
+ {loading ? ( + + ) : ( + <> + {clientesAprovados.length > 0 && + clientesAprovados.map((cliente: UserMetadata) => ( +
+ +
+ ))} + + )} +
+ )} - {ocupacao === 'cliente' && ( + {ocupacao === 'barbeiro' && ( + <> +
+ {barbeiros.length > 0 ? ( +

Barbeiros para serem aprovados

+ ) : ( +

Não há barbeiros para serem aprovados.

+ )} +
{loading ? ( ) : ( <> - {clientesAprovados.length > 0 && - clientesAprovados.map((cliente: UserMetadata) => ( -
- + {barbeiros.length > 0 && + barbeiros.map((barbeiro: UserMetadata) => ( +
+ +
))} )}
- )} - - {ocupacao === 'barbeiro' && ( - <> -
- {barbeiros.length > 0 ? ( -

Barbeiros para serem aprovados

- ) : ( -

Não há barbeiros para serem aprovados.

- )} -
-
- {loading ? ( - - ) : ( - <> - {barbeiros.length > 0 && - barbeiros.map((barbeiro: UserMetadata) => ( -
- - -
- ))} - - )} -
-
- {barbeirosAprovados.length > 0 ? ( -

Barbeiros para serem desativados

- ) : ( -

Não há barbeiros para serem desativados.

- )} -
+
+ {barbeirosAprovados.length > 0 ? ( +

Barbeiros para serem desativados

+ ) : ( +

Não há barbeiros para serem desativados.

+ )} +
-
- {loading ? ( - - ) : ( - <> - {barbeirosAprovados.length > 0 && - barbeirosAprovados.map((barbeiro: UserMetadata) => ( -
- - -
- ))} - - )} -
- - )} - {clienteQtd && ocupacao === 'cliente' && ( - - )} -
+
+ {loading ? ( + + ) : ( + <> + {barbeirosAprovados.length > 0 && + barbeirosAprovados.map((barbeiro: UserMetadata) => ( +
+ + +
+ ))} + + )} +
+ + )} + {clienteQtd && ocupacao === 'cliente' && ( + + )}
- +
); } diff --git a/src/pages/Barbeiro/index.tsx b/src/pages/Barbeiro/index.tsx index 470acd1..6731f8f 100644 --- a/src/pages/Barbeiro/index.tsx +++ b/src/pages/Barbeiro/index.tsx @@ -37,196 +37,190 @@ export function Barbeiro() { useBarbeiro(); return ( - <> -
- {isBarbeiroAprroved === false ? ( -
-

- Você ainda não foi aprovado para trabalhar como barbeiro. -
- Aguarde ser aprovado ou entre em contato com o administrador do sistema. -

-
- ) : ( - <> - {visible ? ( - <> -
-
- -
-
{date?.toLocaleTimeString()}
-
- { - setSelectDay(day); - }} - modifiers={{ - available: { dayOfWeek: [0, 1, 2, 3, 4, 5, 6] }, - }} - disabled={{ - before: new Date(), - }} - /> -
-
- - ) : ( - <> -
- -
- +
+ {isBarbeiroAprroved === false ? ( +
+

+ Você ainda não foi aprovado para trabalhar como barbeiro. +
+ Aguarde ser aprovado ou entre em contato com o administrador do sistema. +

+
+ ) : ( + <> + {visible ? ( +
+
+ +
+
{date?.toLocaleTimeString()}
+
+ { + setSelectDay(day); + }} + modifiers={{ + available: { dayOfWeek: [0, 1, 2, 3, 4, 5, 6] }, + }} + disabled={{ + before: new Date(), + }} + /> +
+
+ ) : ( +
+ +
+ )} +
+ + + + + {!verificaHorarioDeTrabalho() && ( +
+ { + navigate('/horarios'); + }} + /> +
)} -
- - - - {!verificaHorarioDeTrabalho() && ( -
- +

Horários agendados

+

+ Hoje | Dia {new Date().getDate()} | {getDiaSemana()} | Última atualização: {ultimaAtualizacao} +

+
+ + {getClientesMorning().length === 0 && + getClientesAfternoon().length === 0 && + getClientesNight().length === 0 && ( +

Você não tem horários agendados para hoje.

+ )} + + {selectDayFormatted >= atualDayFormatted ? ( + <> + {(getClientesMorning().length > 0 || + getClientesAfternoon().length > 0 || + getClientesNight().length > 0) &&

Atendimento a seguir

} + {getFirstCliente() && ( + { - navigate('/horarios'); + localStorage.setItem('cliente', JSON.stringify(getFirstCliente())); + openModal(); }} /> -
- )} - -
-

Horários agendados

-

- Hoje | Dia {new Date().getDate()} | {getDiaSemana()} | Última atualização: {ultimaAtualizacao} -

-
- - {getClientesMorning().length === 0 && - getClientesAfternoon().length === 0 && - getClientesNight().length === 0 && ( -

Você não tem horários agendados para hoje.

)} - {selectDayFormatted >= atualDayFormatted ? ( - <> - {(getClientesMorning().length > 0 || - getClientesAfternoon().length > 0 || - getClientesNight().length > 0) &&

Atendimento a seguir

} - {getFirstCliente() && ( - { - localStorage.setItem('cliente', JSON.stringify(getFirstCliente())); - openModal(); - }} - /> +
+ {getClientesMorning().length > 1 && ( + <> +

+ Manhã +
+

+ {getClientesMorning().map((cliente: ClienteMetadata) => ( + <> + {getFirstCliente().id !== cliente.id && ( + { + localStorage.setItem('cliente', JSON.stringify(cliente)); + openModal(); + }} + /> + )} + + ))} + )} -
- {getClientesMorning().length > 1 && ( - <> -

- Manhã -
-

- {getClientesMorning().map((cliente: ClienteMetadata) => ( - <> - {getFirstCliente().id !== cliente.id && ( - { - localStorage.setItem('cliente', JSON.stringify(cliente)); - openModal(); - }} - /> - )} - - ))} - - )} - - {getClientesAfternoon().length >= 1 && ( - <> -

- Tarde -
-

- {getClientesAfternoon().map((cliente: ClienteMetadata) => ( - <> - {getFirstCliente().id !== cliente.id && ( - { - localStorage.setItem('cliente', JSON.stringify(cliente)); - openModal(); - }} - /> - )} - - ))} - - )} + {getClientesAfternoon().length >= 1 && ( + <> +

+ Tarde +
+

+ {getClientesAfternoon().map((cliente: ClienteMetadata) => ( + <> + {getFirstCliente().id !== cliente.id && ( + { + localStorage.setItem('cliente', JSON.stringify(cliente)); + openModal(); + }} + /> + )} + + ))} + + )} - {getClientesNight().length >= 1 && ( - <> -

- Noite -
-

- {getClientesNight().map((cliente: ClienteMetadata) => ( - <> - {getFirstCliente().id !== cliente.id && ( - { - localStorage.setItem('cliente', JSON.stringify(cliente)); - openModal(); - }} - /> - )} - - ))} - - )} -
- - ) : ( - <> - {clientes.map((cliente: ClienteMetadata) => ( - - ))} - - )} -
- - )} -
- + {getClientesNight().length >= 1 && ( + <> +

+ Noite +
+

+ {getClientesNight().map((cliente: ClienteMetadata) => ( + <> + {getFirstCliente().id !== cliente.id && ( + { + localStorage.setItem('cliente', JSON.stringify(cliente)); + openModal(); + }} + /> + )} + + ))} + + )} +
+ + ) : ( + <> + {clientes.map((cliente: ClienteMetadata) => ( + + ))} + + )} +
+ + )} +
); } diff --git a/src/pages/ForgetPassword/index.tsx b/src/pages/ForgetPassword/index.tsx index d21043d..952a84f 100644 --- a/src/pages/ForgetPassword/index.tsx +++ b/src/pages/ForgetPassword/index.tsx @@ -19,44 +19,42 @@ export function ForgetPassword() { const { formikForgetPassword } = useForgetPassword(); return ( - <> -
-
-
{ - e.preventDefault(); - formikForgetPassword.handleSubmit(e); - }} - > -
- Logo -

Recuperar senha

- - } - /> - {formikForgetPassword.errors.email && formikForgetPassword.touched.email && ( - {formikForgetPassword.errors.email} - )} - - -
-
- -

- - Voltar ao login - -

-
- baberiro +
+
+
{ + e.preventDefault(); + formikForgetPassword.handleSubmit(e); + }} + > +
+ Logo +

Recuperar senha

+ + } + /> + {formikForgetPassword.errors.email && formikForgetPassword.touched.email && ( + {formikForgetPassword.errors.email} + )} + + +
+
+ +

+ + Voltar ao login + +

- + baberiro +
); } diff --git a/src/pages/Login/index.tsx b/src/pages/Login/index.tsx index 0505b8a..75ec057 100644 --- a/src/pages/Login/index.tsx +++ b/src/pages/Login/index.tsx @@ -21,69 +21,67 @@ export function Login() { const { formikLogin, handleLoginGoogle, loading } = useAuth(); return ( - <> -
-
-
{ - e.preventDefault(); - formikLogin.handleSubmit(e); - }} - > -
- Logo -

Faça seu Login

- { - handleLoginGoogle(); - }} - /> +
+
+ { + e.preventDefault(); + formikLogin.handleSubmit(e); + }} + > +
+ Logo +

Faça seu Login

+ { + handleLoginGoogle(); + }} + /> -
ou
+
ou
- } - /> - {formikLogin.errors.email && {formikLogin.errors.email}} + } + /> + {formikLogin.errors.email && {formikLogin.errors.email}} - } - /> + } + /> - -
- + +
+ -

- - Esqueci minha senha - -

+

+ + Esqueci minha senha + +

-

- Não tem uma conta?{' '} - - Cadastre-se - -

-
- baberiro +

+ Não tem uma conta?{' '} + + Cadastre-se + +

- + baberiro +
); } diff --git a/src/pages/MyTicket/index.tsx b/src/pages/MyTicket/index.tsx index b2205e1..f4bae3b 100644 --- a/src/pages/MyTicket/index.tsx +++ b/src/pages/MyTicket/index.tsx @@ -19,51 +19,47 @@ export function MyTicket() { useTicket(); return ( - <> -
-
+
+
-
- {verificaHorarioCancelamento(cliente as ClienteMetadata) && ( -
- -
- )} -

Apresente esse ticket para o seu barbeiro

- {loading ? ( - - ) : ( - <> - - - - - )} -
- - +
+ {verificaHorarioCancelamento(cliente as ClienteMetadata) && ( +
+
+ )} +

Apresente esse ticket para o seu barbeiro

+ {loading ? ( + + ) : ( + + + + )} +
+ +
- +
); } diff --git a/src/pages/Profile/index.tsx b/src/pages/Profile/index.tsx index edddad9..326c679 100644 --- a/src/pages/Profile/index.tsx +++ b/src/pages/Profile/index.tsx @@ -21,103 +21,101 @@ export function Profile() { const { formikProfile, loading, isGoogle } = useProfile(); return ( - <> -
-
+
+
-
-
{ - e.preventDefault(); - formikProfile.handleSubmit(e); +
+ { + e.preventDefault(); + formikProfile.handleSubmit(e); + }} + > + { + convertImageToBase64(file).then((base64) => { + formikProfile.setFieldValue('avatar', base64); + }); }} - > - { - convertImageToBase64(file).then((base64) => { - formikProfile.setFieldValue('avatar', base64); - }); - }} - /> + /> -

Meu Perfil

-
- } - disabled={isGoogle()} - /> - {formikProfile.errors.nome && formikProfile.touched.nome && ( - {formikProfile.errors.nome} - )} - } - disabled={isGoogle()} - /> - {formikProfile.errors.email && formikProfile.touched.email && ( - {formikProfile.errors.email} - )} -
+

Meu Perfil

+
+ } + disabled={isGoogle()} + /> + {formikProfile.errors.nome && formikProfile.touched.nome && ( + {formikProfile.errors.nome} + )} + } + disabled={isGoogle()} + /> + {formikProfile.errors.email && formikProfile.touched.email && ( + {formikProfile.errors.email} + )} +
-
- } - /> - {formikProfile.errors.password && formikProfile.touched.password && ( - {formikProfile.errors.password} - )} - } - /> - {formikProfile.errors.newPassword && formikProfile.touched.newPassword && ( - {formikProfile.errors.newPassword} - )} - } - /> - {formikProfile.errors.confirmPassword && formikProfile.touched.confirmPassword && ( - {formikProfile.errors.confirmPassword} - )} -
+
+ } + /> + {formikProfile.errors.password && formikProfile.touched.password && ( + {formikProfile.errors.password} + )} + } + /> + {formikProfile.errors.newPassword && formikProfile.touched.newPassword && ( + {formikProfile.errors.newPassword} + )} + } + /> + {formikProfile.errors.confirmPassword && formikProfile.touched.confirmPassword && ( + {formikProfile.errors.confirmPassword} + )} +
-
- -
- -
+
+ +
+
- +
); } diff --git a/src/pages/Register/index.tsx b/src/pages/Register/index.tsx index 3f9b938..a915b2f 100644 --- a/src/pages/Register/index.tsx +++ b/src/pages/Register/index.tsx @@ -22,93 +22,91 @@ export function Register() { const { formikRegister, loading, status } = useRegister(); return ( - <> -
- {status === 'success' && ( - - - - )} +
+ {status === 'success' && ( + + + + )} - baberiro + baberiro -
-
{ - e.preventDefault(); - formikRegister.handleSubmit(e); - }} - > -
- Logo -

Faça seu cadastro

- +
+ { + e.preventDefault(); + formikRegister.handleSubmit(e); + }} + > +
+ Logo +

Faça seu cadastro

+ - } - /> - {formikRegister.errors.nome && formikRegister.touched.nome && ( - {formikRegister.errors.nome} - )} - } - /> - {formikRegister.errors.email && formikRegister.touched.email && ( - {formikRegister.errors.email} - )} - } - /> - {formikRegister.errors.senha && formikRegister.touched.senha && ( - {formikRegister.errors.senha} - )} + } + /> + {formikRegister.errors.nome && formikRegister.touched.nome && ( + {formikRegister.errors.nome} + )} + } + /> + {formikRegister.errors.email && formikRegister.touched.email && ( + {formikRegister.errors.email} + )} + } + /> + {formikRegister.errors.senha && formikRegister.touched.senha && ( + {formikRegister.errors.senha} + )} - } - /> - {formikRegister.errors.confirmarSenha && formikRegister.touched.confirmarSenha && ( - {formikRegister.errors.confirmarSenha} - )} + } + /> + {formikRegister.errors.confirmarSenha && formikRegister.touched.confirmarSenha && ( + {formikRegister.errors.confirmarSenha} + )} - -
- + +
+ -

- Já tem uma conta?{' '} - - Faça seu login - -

-
+

+ Já tem uma conta?{' '} + + Faça seu login + +

- +
); } diff --git a/src/pages/ResetPassword/index.tsx b/src/pages/ResetPassword/index.tsx index e8baf6d..d25af65 100644 --- a/src/pages/ResetPassword/index.tsx +++ b/src/pages/ResetPassword/index.tsx @@ -18,52 +18,50 @@ export function ResetPassword() { const { formikResetPassword } = useForgetPassword(); return ( - <> -
- baberiro +
+ baberiro -
-
{ - e.preventDefault(); - formikResetPassword.handleSubmit(e); - }} - > -
- Logo -

Redefinir senha

+
+ { + e.preventDefault(); + formikResetPassword.handleSubmit(e); + }} + > +
+ Logo +

Redefinir senha

- } - /> - {formikResetPassword.errors.senha && formikResetPassword.touched.senha && ( - {formikResetPassword.errors.senha} - )} + } + /> + {formikResetPassword.errors.senha && formikResetPassword.touched.senha && ( + {formikResetPassword.errors.senha} + )} - } - /> - {formikResetPassword.errors.confirmarSenha && formikResetPassword.touched.confirmarSenha && ( - {formikResetPassword.errors.confirmarSenha} - )} + } + /> + {formikResetPassword.errors.confirmarSenha && formikResetPassword.touched.confirmarSenha && ( + {formikResetPassword.errors.confirmarSenha} + )} - -
- -
+ +
+
- +
); }