Skip to content
Open
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
106 changes: 70 additions & 36 deletions src/components/TitlePage.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,89 @@
import React, { useState } from "react";
import { useAuth0 } from "@auth0/auth0-react";
import { useQuery } from 'react-query'
import "./TitlePage.css"; // Import the CSS file for styling
import LoginButton from "./LoginButton"; // Import the LoginButton component
import Header from "./Header";
import LogoMain from "./LogoMain.png";
import { Button, Modal } from "react";
import RegisterBusinessForm from "./RegisterBusinessForm";
import Footer from "./Footer";
import getUserRequest from "../api/getUserRequest";

function TitlePage({ setShowPosts }) {
function TitlePage({ setShowPosts, username }) {
// State to track whether sign-up button is clicked
const [isButtonsClicked, setIsButtonsClicked] = useState(false);
const { isLoading, data: user} = useQuery(['user', username], (username) => getUserRequest(username))
if (!isLoading){
console.log(user)
}
const handleSignUpClick = () => {
setIsButtonsClicked(true);
};

const handleSignUpClick = () => {
setIsButtonsClicked(true);
};

return (
<div className="title-container">
<Header />
<div className="title-container">
<button>
<img src={LogoMain} alt="logo" className="logo img"/>
</button>
<h1 className="title">FreshSave</h1>
<p className="catchphrase">Where Every Bite Gets a Second Chance to Make a First Impression.</p>
<div className="description">
<p>FreshSave is a platform dedicated to providing affordable grocery items to non-profit organizations. Our mission is to empower non-profits with cost-effective solutions, enabling them to create nutritious meals for individuals and families in need.</p>
<p>At FreshSave, we understand the importance of accessibility to fresh and wholesome ingredients, especially for organizations dedicated to serving communities facing food insecurity. Through our platform, non-profits gain access to a wide range of grocery items at discounted rates, making it easier for them to procure essential ingredients for their meal programs and initiatives.</p>
<p>We believe that every individual deserves access to nourishing food, and we are committed to supporting non-profits in their efforts to alleviate hunger and food insecurity. By offering affordable grocery items, FreshSave enables non-profit organizations to stretch their budgets further, maximizing their impact and reach within their communities.</p>
<p>Our platform fosters collaboration and partnership between non-profits, suppliers, and donors, creating a network of support dedicated to addressing food insecurity at its core. Together, we can make a meaningful difference in the lives of those facing hunger and food insecurity, one meal at a time.</p>
<p>Join us in our mission to create a world where no one goes hungry, where every bite has the power to nourish, uplift, and inspire hope. Together, let's make a positive impact and build a brighter future for individuals and families in need. Welcome to FreshSave, where every meal begins with compassion and ends with hope.</p>
</div>
{/* Add buttons section */}
{/* Conditionally render the LoginButton component */}
{!isButtonsClicked && (
<div>
<LoginButton />
</div>
)}
<div className="green-bar">
<RegisterBusinessForm />
</div>
</div>
return (
<div className="title-container">
<Header />
<div className="title-container">
<button>
<img src={LogoMain} alt="logo" className="logo img" />
</button>
<h1 className="title">FreshSave</h1>
<p className="catchphrase">
Where Every Bite Gets a Second Chance to Make a First Impression.
</p>
<div className="description">
<p>
FreshSave is a platform dedicated to providing affordable grocery
items to non-profit organizations. Our mission is to empower
non-profits with cost-effective solutions, enabling them to create
nutritious meals for individuals and families in need.
</p>
<p>
At FreshSave, we understand the importance of accessibility to fresh
and wholesome ingredients, especially for organizations dedicated to
serving communities facing food insecurity. Through our platform,
non-profits gain access to a wide range of grocery items at
discounted rates, making it easier for them to procure essential
ingredients for their meal programs and initiatives.
</p>
<p>
We believe that every individual deserves access to nourishing food,
and we are committed to supporting non-profits in their efforts to
alleviate hunger and food insecurity. By offering affordable grocery
items, FreshSave enables non-profit organizations to stretch their
budgets further, maximizing their impact and reach within their
communities.
</p>
<p>
Our platform fosters collaboration and partnership between
non-profits, suppliers, and donors, creating a network of support
dedicated to addressing food insecurity at its core. Together, we
can make a meaningful difference in the lives of those facing hunger
and food insecurity, one meal at a time.
</p>
<p>
Join us in our mission to create a world where no one goes hungry,
where every bite has the power to nourish, uplift, and inspire hope.
Together, let's make a positive impact and build a brighter future
for individuals and families in need. Welcome to FreshSave, where
every meal begins with compassion and ends with hope.
</p>
</div>
{/* Add buttons section */}
{/* Conditionally render the LoginButton component */}
{!isButtonsClicked && (
<div>
<LoginButton />
</div>
)}
<div className="green-bar">
<RegisterBusinessForm />
</div>
</div>
{/* {username && } */}
<div className="green-bar">
<RegisterBusinessForm />
</div>
</div>
);
}

export default TitlePage;