diff --git a/src/App.tsx b/src/App.tsx index 2053a62..083c43a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,8 +12,9 @@ import { import { IonReactRouter } from '@ionic/react-router'; // importação das páginas -import Login from './pages/Login'; import Cadastro from './pages/Cadastro/Cadastro'; +import Login from './pages/Login'; +import Home from './pages/Home'; import CadastroVan from './pages/CadastroVan'; /* Core CSS required for Ionic components to work properly */ @@ -46,11 +47,13 @@ const routes = ( <> + + - + >) diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index 2169533..2028df5 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -1,56 +1,14 @@ import { IonItem, IonLabel, IonInput, IonButton, IonCardTitle, IonCol, IonContent, IonGrid, IonPage, IonRow } from '@ionic/react'; +import { useHistory } from 'react-router'; import { Action } from '../components/Action'; const Home: React.FC = () => { + const history = useHistory() + return ( - - - - - Como você deseja se cadastrar? - - - - - - - Nome - - - - Sobrenome - - - - - - E-mail - - - - - Data de nascimento - - - - - Senha - - - - Confirme a senha - - - - Cadastrar-se - - - - Ao se cadastrar, você aceita nossos Termos e Condições e nossa Política de Privacidade. - - - + + { history.push({ pathname: '/perfil/1' }); }}>Ir para o perfil de outra pessoa ); diff --git a/src/pages/Perfil.tsx b/src/pages/Perfil.tsx index fa137b9..8e86944 100644 --- a/src/pages/Perfil.tsx +++ b/src/pages/Perfil.tsx @@ -27,9 +27,19 @@ import sessionsService from '../services/functions/sessionsService' import usersService from '../services/functions/usersService' import { UserContext } from "../App"; -const Perfil: React.FC = () => { +interface ScanNewProps { + match: { + params: { + id: string; + } + } +} + +const Perfil: React.FC = (props) => { const user = useContext(UserContext); + const [isVisitor, setIsVisitor] = useState(true) + const [showToast, setShowToast] = useState(false); const [messageToast, setMessageToast] = useState(''); @@ -96,6 +106,10 @@ const Perfil: React.FC = () => { 'birth_date': userData.birth_date, 'bio': userData.bio }); + + if (!props.match.params.id) { + setIsVisitor(false) + } } } } @@ -155,39 +169,37 @@ const Perfil: React.FC = () => { - {/* - - - - */} + {/* // TODO, card de informações de contato */} - - Configurações - history.push({ pathname: '/perfil/editar', state: { userData: inputValues } })}> - - Editar perfil - - - - Completar perfil - - history.push({ pathname: '/cadastro-van'})}> - - Cadastrar Van - - - - Pagamentos - - - - Avaliações - - - - Sair da conta - - + { !isVisitor ? + + Configurações + history.push({ pathname: '/perfil/editar', state: { userData: inputValues } })}> + + Editar perfil + + + + Completar perfil + + history.push({ pathname: '/cadastro-van'})}> + + Cadastrar Van + + + + Pagamentos + + + + Avaliações + + + + Sair da conta + + : <>> + }