add sign in with ion button

This commit is contained in:
Michael Fatemi 2021-04-10 13:20:31 -04:00
parent 7b544abb07
commit 1d20268443
3 changed files with 61 additions and 68 deletions

View File

@ -20,7 +20,6 @@ function App() {
<BrowserRouter>
<Nav />
<Switch>
<Route component={Home} path="/" />
<Route component={Signup} path="/register" />
<Route component={Signin} path="/login" />
<Route component={Main} path="/about" />
@ -29,6 +28,7 @@ function App() {
<Route component={Pools} path="/pools" />
<Route component={Pool} path="/pool/:id" />
<Route component={Profile} path="/profile" />
<Route component={Home} path="/" />
</Switch>
</BrowserRouter>
</div>

View File

@ -9,12 +9,7 @@ export default function Home() {
>
<h1>Home</h1>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<a href="/signin" className="mx-2">
Sign In
</a>
<a href="/signup" className="mx-2">
Sign Up
</a>
<a href="/">Log In with Ion</a>
</div>
</div>
);

View File

@ -1,8 +1,7 @@
import React, { useState, useEffect } from 'react';
const Pools = (props) => {
const [state, setState] = useState({
Pools: [
const [pools, setPools] = useState([
{
id: 1,
pool_title: 'TJ Carpool',
@ -51,15 +50,14 @@ const Pools = (props) => {
'What is the covid vaccination status of all the participants?',
],
},
],
});
]);
const callAPI = () => {
fetch(`${process.env.REACT_APP_API_ENDPOINT}/pools/`)
.then((response) => response.json())
.then((data) => {
if (data !== undefined) {
setState(data);
setPools(data.Pools);
}
});
};
@ -86,9 +84,9 @@ const Pools = (props) => {
</a>
<div className="container" style={{ fontFamily: 'Courier New' }}>
<br></br>
{state.Pools.map((Pool, el) => {
{pools.map((pool, index) => {
let background;
if (el % 2 === 0) {
if (index % 2 === 0) {
background = '#F1EAE8';
} else {
background = '#FFFFFF';
@ -98,16 +96,16 @@ const Pools = (props) => {
className="card card-body text-left"
style={{ backgroundColor: background }}
>
<a href={'/Pool/' + Pool.id} className="card-title">
{Pool.pool_title}
<a href={'/Pool/' + pool.id} className="card-title">
{pool.pool_title}
</a>
<p className="text-left">
Capacity: {Pool.participants.length} / {Pool.capacity}
Capacity: {pool.participants.length} / {pool.capacity}
</p>
<p className="text-left">Start Time: {Pool.start_time}</p>
<p className="text-left">End Time: {Pool.end_time}</p>
<p className="text-left">Start Time: {pool.start_time}</p>
<p className="text-left">End Time: {pool.end_time}</p>
<p className="text-warning">
{maybePluralize(Pool.comments.length, 'comment')}
{maybePluralize(pool.comments.length, 'comment')}
</p>
</div>
);