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
1 change: 1 addition & 0 deletions Freire-labe-food3
Submodule Freire-labe-food3 added at 03cfca
13,112 changes: 8,142 additions & 4,970 deletions package-lock.json

Large diffs are not rendered by default.

21 changes: 8 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
{
"name": "fourFoodA",
"name": "projeto-4food3a",
"version": "0.1.0",
"private": true,
"dependencies": {
"@chakra-ui/alert": "^2.0.6",
"@chakra-ui/icons": "^2.0.6",
"@chakra-ui/react": "^2.2.6",
"@chakra-ui/alert": "^2.0.4",
"@chakra-ui/icons": "^2.0.4",
"@chakra-ui/react": "^2.2.4",
"@emotion/react": "^11.10.0",
"@emotion/styled": "^11.10.0",
"@mui/material": "^5.8.0",
"@mui/styled-engine-sc": "^5.8.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.2.0",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^0.27.2",
"formik": "^2.2.9",
"framer-motion": "^6.5.1",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-icons": "^4.4.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-imask": "^6.4.2",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"styled-components": "^5.3.5",
"web-vitals": "^2.1.4",
"yup": "^0.32.11"
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
Expand Down
4 changes: 2 additions & 2 deletions src/Components/CardRestaurante/CardRestaurante.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { React, useContext } from "react";
import { useNavigate } from "react-router-dom";
import { Box, VStack } from "@chakra-ui/react";

import GlobalContext from "../../Global/GlobalContext";

import { goToRestaurantDetailPage } from "../../Routes/Coordinator";

const CardRestaurante = (props) => {
const navigate = useNavigate();
Expand Down Expand Up @@ -35,6 +34,7 @@ const CardRestaurante = (props) => {
border="1px solid #262626"
borderRadius="5px"
key={restaurante.id}
onClick={()=>goToRestaurantDetailPage(navigate,restaurante.id)}

>
<Box
Expand Down
4 changes: 2 additions & 2 deletions src/Global/GlobalState.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ const GlobalState = (props) => {


const states = {restaurantes}
const setters = {setRestaurantes}
const setTers = {setRestaurantes}
const requests = {pegarRestaurantes, pegarDetalhes}


return (
<GlobalContext.Provider value={{states, setters, requests}}>
<GlobalContext.Provider value={{states, setTers, requests}}>
{props.children}
</GlobalContext.Provider>
)
Expand Down
49 changes: 33 additions & 16 deletions src/Pages/HomePage/HomePage.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
import React from "react";
import { goToLoginPage } from "../../Routes/Coordinator";
import { goToCartPage,goToProfilePage } from "../../Routes/Coordinator";
import { goToCartPage, goToProfilePage } from "../../Routes/Coordinator";
import { Button } from "@chakra-ui/react";
import {useNavigate} from "react-router-dom"
import { useNavigate } from "react-router-dom";
import RestaurantDetailPage from "../RestaurantDetailPage/RestaurantDetailPage";
import { goToHome } from "../../Routes/Coordinator";

const HomePage =()=> {
const navigate = useNavigate()
const HomePage = () => {
const navigate = useNavigate();

return (
<div>
<h1>HOME PAGE</h1>
<Button colorScheme='teal' variant='solid' onClick={()=> goToLoginPage(navigate)}>Login</Button>
<Button colorScheme='teal' variant='outline' onClick={()=> goToCartPage(navigate)}>Carrinho</Button>
<Button colorScheme='teal' variant='outline' onClick={()=> goToProfilePage(navigate)}>perfil</Button>
<Button colorScheme='teal' variant='outline' onClick={()=> goToHome(navigate)}>feed</Button>
return (
<div>
<h1>HOME PAGE</h1>
<Button
colorScheme="teal"
variant="solid"
onClick={() => goToLoginPage(navigate)}
>
Login
</Button>
<Button
colorScheme="teal"
variant="outline"
onClick={() => goToCartPage(navigate)}
>
Carrinho
</Button>
<Button
colorScheme="teal"
variant="outline"
onClick={() => goToProfilePage(navigate)}
>
perfil
</Button>

</div>
);
};

</div>
)
}

export default HomePage
export default HomePage;
3 changes: 1 addition & 2 deletions src/Pages/Loginpage/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const LoginForm = () => {
login(form, clear, navigate)
}


return (
<LoginStyled>
<form onSubmit={onSubmitForm}>
Expand Down Expand Up @@ -50,4 +49,4 @@ const LoginForm = () => {
)
};

export default LoginForm;
export default LoginForm;
6 changes: 5 additions & 1 deletion src/Pages/Loginpage/LoginPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import RedLogo from "../../assets/RedLogo.png"
import { PageContainer } from "./LoginStyles"
import SplashScreen from "../../Components/SplashScreen/SplashScreen";


function LoginPage() {
const navigate = useNavigate();
const [loading, setLoading] = useState(true);
Expand All @@ -21,6 +20,10 @@ function LoginPage() {
<img src={RedLogo} alt='logomarca - ifuture vermelha'/>
<h3>Entrar</h3>
<LoginForm />
<button
onClick={() => goToSignUpPage(navigate)}
>Não possui conta? Cadastre-se
</button>
</>
)}
<Button colorScheme='black' variant='ghost'
Expand All @@ -29,6 +32,7 @@ function LoginPage() {
</Button>
</Stack>
</PageContainer>

);
}

Expand Down
44 changes: 21 additions & 23 deletions src/Pages/MyProfilePage/MyProfilePage.jsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,33 @@
import { BASE_URL } from "../../constants/url";
import CardHistoric from "../../Components/CardHistoric";

import { useNavigate } from "react-router-dom";

import { Flex, Text, Image } from "@chakra-ui/react";
import { goToEditPage,goToSignAddress } from "../../Routes/Coordinator";
import { Flex, Text, Image } from "@chakra-ui/react";
import { goToEditPage, goToSignAddress } from "../../Routes/Coordinator";
import edit from "../../assets/edit.png";
import useRequestData from "../../hooks/useRequestData";
import useProtectedPage from "../../hooks/useRequestData";
import BarraNavegacao from "../../Components/SearchBar/SearchBar";


export default function MyProfilePage() {
useProtectedPage();
const navigate = useNavigate();
const getProfile = useRequestData([], `${BASE_URL}/profile`);
const UserData = getProfile.user && getProfile.user;

const getHistory = useRequestData([], `${BASE_URL}/orders/history`);

const History = getHistory.orders && getHistory.orders;

const CardHistory =
History &&
History.map((compra, i) => {

return <CardHistoric
key={i}
name={compra.restaurantName}
price={compra.totalPrice.toLocaleString('pt-br',{style: 'currency', currency: 'BRL'})}
/>
key={i}
name={compra.restaurantName}
price={compra.totalPrice.toLocaleString('pt-br', { style: 'currency', currency: 'BRL' })}
/>
}
);
console.log(CardHistory)

return (
<Flex p="6" flexDirection={"column"} >
<br />
Expand Down Expand Up @@ -66,7 +61,7 @@ export default function MyProfilePage() {
p="1"
align="start"
flexDirection="column"

>
<Text mb={2} color="#B8B8B8">
Endereço Cadastrado
Expand All @@ -86,15 +81,18 @@ export default function MyProfilePage() {
flexDirection="column"
display="flex"
/>

<Flex flexWrap="wrap" justifyContent={"center"} >
{CardHistory}

</Flex>


<Flex flexWrap="wrap" justifyContent={"center"} >
{CardHistory}
</Flex>
<Flex flexWrap="wrap" justifyContent={"center"} >
{CardHistory}

</Flex>

{/* {(CardHistory && CardHistory !==0 ) || ((CardHistory && CardHistory === 0 && CardHistory === null )) ?CardHistory:<Text mt="3" ml="3">Você não realizou nenhum pedido</Text>} */}
{BarraNavegacao()}
{BarraNavegacao()}
</Flex>

);
}
3 changes: 2 additions & 1 deletion src/Pages/PageHome/PageHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const Home = () => {
maxW='328px'
gap='8px'
>
<CardRestaurante categoria={categoria} />
<CardRestaurante categoria={categoria}
/>
</Flex>
</Flex>
<SearchBar />
Expand Down
Loading