diff --git a/staff/mateo-gomez/project/api/logic/logoutUser.js b/staff/mateo-gomez/project/api/logic/logoutUser.js new file mode 100644 index 000000000..e69de29bb diff --git a/staff/mateo-gomez/project/app/components/core/Button.css b/staff/mateo-gomez/project/app/components/core/Button.css index 079c02e6a..4a75c9367 100644 --- a/staff/mateo-gomez/project/app/components/core/Button.css +++ b/staff/mateo-gomez/project/app/components/core/Button.css @@ -25,4 +25,10 @@ display: flex; align-items: center; cursor: pointer; +} + +.PostType { + height: 6rem; + font-size: xx-large; + color: white; } \ No newline at end of file diff --git a/staff/mateo-gomez/project/app/components/core/Heading.css b/staff/mateo-gomez/project/app/components/core/Heading.css index 4245c92f5..a32ba54d0 100644 --- a/staff/mateo-gomez/project/app/components/core/Heading.css +++ b/staff/mateo-gomez/project/app/components/core/Heading.css @@ -15,4 +15,10 @@ flex-direction: column; position: absolute; padding: 2rem; +} + +.CreatePostFormHeading { + color: white; + font-family: "Langar", system-ui; + } \ No newline at end of file diff --git a/staff/mateo-gomez/project/app/src/components/view/Home.jsx b/staff/mateo-gomez/project/app/src/components/view/Home.jsx index 535d3e335..5ba94c55b 100644 --- a/staff/mateo-gomez/project/app/src/components/view/Home.jsx +++ b/staff/mateo-gomez/project/app/src/components/view/Home.jsx @@ -1,10 +1,13 @@ import { useEffect, useState } from "react" + import View from "../../../components/library/View" import Heading from "../../../components/core/Heading" import Header from "./components/Header" import logic from "../../logic/index" import Button from "../../../components/core/Button" import Footer from "./components/Footer" +import CreatePostForm from "./components/CreatePostForm" +import PostTypeSelection from "./components/PostTypeSelection" function Home({ onUserLoggedOut }) { @@ -12,6 +15,7 @@ function Home({ onUserLoggedOut }) { const [name, setName] = useState('') const [view, setView] = useState('') + const [postType, setPostType] = useState(null) const handleLogout = () => { @@ -22,9 +26,20 @@ function Home({ onUserLoggedOut }) { const handleCreatePostClick = () => { + setView('postTypeSelection') + } + + const handlePostTypeSelection = (type) => { + console.log('Post Type Selected', type) + setPostType(type) + setView('createPost') } + const handleCancelCreatePost = () => { + setView('') + } + const handlePostCreated = () => { setView('') } @@ -63,6 +78,17 @@ function Home({ onUserLoggedOut }) { + {view === 'postTypeSelection' && ( + + )} + {view === 'createPost' && postType && ( + + )} diff --git a/staff/mateo-gomez/project/app/src/components/view/components/CreatePostForm.css b/staff/mateo-gomez/project/app/src/components/view/components/CreatePostForm.css new file mode 100644 index 000000000..4f1c79d3d --- /dev/null +++ b/staff/mateo-gomez/project/app/src/components/view/components/CreatePostForm.css @@ -0,0 +1,13 @@ +@import url('https://fonts.googleapis.com/css2?family=Langar&display=swap'); + + +.CreatePostFormHeading { + color: white; + font-family: "Langar", system-ui; + +} + +.CreateCancelButtons { + display: flex; + justify-content: center; +} \ No newline at end of file diff --git a/staff/mateo-gomez/project/app/src/components/view/components/CreatePostForm.jsx b/staff/mateo-gomez/project/app/src/components/view/components/CreatePostForm.jsx index 3f5f7b9d9..0d3aa68bf 100644 --- a/staff/mateo-gomez/project/app/src/components/view/components/CreatePostForm.jsx +++ b/staff/mateo-gomez/project/app/src/components/view/components/CreatePostForm.jsx @@ -6,27 +6,25 @@ import FormWithFeedback from "../../../../components/library/FormWithFeedBack"; import Field from "../../../../components/core/Field" import Heading from "../../../../components/core/Heading"; import Button from "../../../../components/core/Button"; -import PostTypeSelection from "./PostTypeSelection"; +import './CreatePostForm.css' -function CreatePostForm({ onCancelCreatePostClick, onHostPostCreated, onGuestPostCreated }) { +function CreatePostForm({ postType, onCancelCreatePostClick, onHostPostCreated, onGuestPostCreated }) { console.log('CreatePostForm -> render') const [message, setMessage] = useState('') - const [postType, setPostType] = useState(null) - const handlePostTypeSelection = (type) => { - setPostType(type) - } + const handleCreatePostSubmit = (event) => { event.preventDefault() - const form = event.target - const image = form.image.value - const description = form.description.value if (postType === 'HostPost') { + const form = event.target + + const image = form.image.value + const description = form.description.value const city = form.city.value const age = form.age.value const offer = form.offer.value @@ -36,6 +34,7 @@ function CreatePostForm({ onCancelCreatePostClick, onHostPostCreated, onGuestPos .then(() => onHostPostCreated()) .catch((error) => { console.error(error) + setMessage(error.message) }) } catch (error) { @@ -43,6 +42,10 @@ function CreatePostForm({ onCancelCreatePostClick, onHostPostCreated, onGuestPos setMessage(error.message) } } else if (postType === 'GuestPost') { + const form = event.target + + const image = form.image.value + const description = form.description.value const date = form.date.value const fromLocation = form.fromLocation.value const toLocation = form.toLocation.value @@ -53,10 +56,12 @@ function CreatePostForm({ onCancelCreatePostClick, onHostPostCreated, onGuestPos .then(() => onGuestPostCreated()) .catch((error) => { console.error(error) + setMessage(error.message) }) } catch (error) { console.error(error) + setMessage(error.message) } } @@ -64,38 +69,35 @@ function CreatePostForm({ onCancelCreatePostClick, onHostPostCreated, onGuestPos return ( - Create your post - {!postType && ( - )} - {!postType && ( -
- - -
- )} - {postType && ( - - - - {postType === 'HostPost' && ( - <> - - - - - )} - {postType === 'GuestPost' && ( - <> - - - - - - )} + Create your post + + + + {postType === 'HostPost' && ( + <> + Image + Description + City + Age + Offer + + )} + {postType === 'GuestPost' && ( + <> + Image + Description + Date + Age + From Location + To Location + + )} +
- - )} +
+
+
) } diff --git a/staff/mateo-gomez/project/app/src/components/view/components/PostTypeSelection.css b/staff/mateo-gomez/project/app/src/components/view/components/PostTypeSelection.css new file mode 100644 index 000000000..3b3ebc174 --- /dev/null +++ b/staff/mateo-gomez/project/app/src/components/view/components/PostTypeSelection.css @@ -0,0 +1,17 @@ +@import url('https://fonts.googleapis.com/css2?family=Langar&display=swap'); + + +.PostTypeSelection { + display: flex; + flex-direction: column; + align-items: center; + position: fixed; + width: 100%; + top: 10rem; +} + +.PostTypeSelectionHeading { + color: white; + font-family: "Langar", system-ui; + +} \ No newline at end of file diff --git a/staff/mateo-gomez/project/app/src/components/view/components/PostTypeSelection.jsx b/staff/mateo-gomez/project/app/src/components/view/components/PostTypeSelection.jsx index 6b752b20e..16d2502a4 100644 --- a/staff/mateo-gomez/project/app/src/components/view/components/PostTypeSelection.jsx +++ b/staff/mateo-gomez/project/app/src/components/view/components/PostTypeSelection.jsx @@ -1,9 +1,10 @@ import { useState } from "react"; import Heading from "../../../../components/core/Heading"; import Button from "../../../../components/core/Button"; +import './PostTypeSelection.css' function PostTypeSelection({ onSelectType }) { - return
+ return
What do you want to be?