mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-04-21 11:20:17 -04:00
Merge branch 'main' of https://github.com/myfatemi04/wheelshare-frontend into main
This commit is contained in:
commit
8e7b00c69f
|
@ -1,16 +1,54 @@
|
||||||
import { lazy, Suspense, useContext } from 'react';
|
import { lazy, Suspense, useContext, useState, useEffect } from 'react';
|
||||||
import { BrowserRouter, Route, Switch } from 'react-router-dom';
|
import { BrowserRouter, Route, Switch } from 'react-router-dom';
|
||||||
import AuthenticationContext from './Authentication/AuthenticationContext';
|
import AuthenticationContext from './Authentication/AuthenticationContext';
|
||||||
import WheelShare from './WheelShare';
|
import WheelShare from './WheelShare';
|
||||||
import WheelShareLoggedOut from './WheelShareLoggedOut';
|
import WheelShareLoggedOut from './WheelShareLoggedOut';
|
||||||
|
import { INotification } from './Notifications';
|
||||||
|
import Notifications from './Notifications';
|
||||||
|
|
||||||
const Authenticator = lazy(() => import('./Authentication/Authenticator'));
|
const Authenticator = lazy(() => import('./Authentication/Authenticator'));
|
||||||
const Group = lazy(() => import('./Group'));
|
const Group = lazy(() => import('./Group'));
|
||||||
|
|
||||||
|
const dummyNotificationData: INotification[] = ([] = [
|
||||||
|
{
|
||||||
|
user: {
|
||||||
|
id: 0,
|
||||||
|
name: 'Michael Fatemi',
|
||||||
|
},
|
||||||
|
carpool: {
|
||||||
|
id: 0,
|
||||||
|
name: 'Cross Country',
|
||||||
|
},
|
||||||
|
isRequest: true,
|
||||||
|
sentTime: new Date(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
user: {
|
||||||
|
id: 1,
|
||||||
|
name: 'Joshua Hsueh',
|
||||||
|
},
|
||||||
|
carpool: {
|
||||||
|
id: 0,
|
||||||
|
name: 'TJ Lax',
|
||||||
|
},
|
||||||
|
isRequest: false,
|
||||||
|
sentTime: new Date(),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const { user } = useContext(AuthenticationContext);
|
const { user } = useContext(AuthenticationContext);
|
||||||
|
const [notifications, setNotifications] = useState(dummyNotificationData);
|
||||||
|
useEffect(() => {
|
||||||
|
//getNotifications().then(setNotifications);
|
||||||
|
}, []);
|
||||||
return (
|
return (
|
||||||
<div style={{ padding: '1rem' }}>
|
<div style={{ padding: '1rem' }}>
|
||||||
|
{notifications.length > 0 ? (
|
||||||
|
<Notifications notifications={notifications} />
|
||||||
|
) : (
|
||||||
|
<span>No notifications </span>
|
||||||
|
)}
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route
|
<Route
|
||||||
|
|
|
@ -4,51 +4,16 @@ import { IGroup } from './Group';
|
||||||
import GroupCreatorLink from './GroupCreatorLink';
|
import GroupCreatorLink from './GroupCreatorLink';
|
||||||
import GroupJoinerLink from './GroupJoinerLink';
|
import GroupJoinerLink from './GroupJoinerLink';
|
||||||
import GroupList from './GroupList';
|
import GroupList from './GroupList';
|
||||||
import Notifications, { INotification } from './Notifications';
|
|
||||||
|
|
||||||
const dummyNotificationData: INotification[] = [
|
|
||||||
{
|
|
||||||
user: {
|
|
||||||
id: 0,
|
|
||||||
name: 'Michael Fatemi',
|
|
||||||
},
|
|
||||||
carpool: {
|
|
||||||
id: 0,
|
|
||||||
name: 'Cross Country',
|
|
||||||
},
|
|
||||||
isRequest: true,
|
|
||||||
sentTime: new Date(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
user: {
|
|
||||||
id: 1,
|
|
||||||
name: 'Joshua Hsueh',
|
|
||||||
},
|
|
||||||
carpool: {
|
|
||||||
id: 0,
|
|
||||||
name: 'TJ Lax',
|
|
||||||
},
|
|
||||||
isRequest: false,
|
|
||||||
sentTime: new Date(),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
export default function Groups() {
|
export default function Groups() {
|
||||||
const [groups, setGroups] = useState<IGroup[]>([]);
|
const [groups, setGroups] = useState<IGroup[]>([]);
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
const [notifications, setNotifications] = useState(dummyNotificationData);
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getGroups().then(setGroups);
|
getGroups().then(setGroups);
|
||||||
//getNotifications().then(setNotifications);
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{notifications.length > 0 ? (
|
|
||||||
<Notifications notifications={notifications} />
|
|
||||||
) : (
|
|
||||||
<span>No notifications </span>
|
|
||||||
)}
|
|
||||||
<h1>Groups</h1>
|
<h1>Groups</h1>
|
||||||
<GroupJoinerLink />
|
<GroupJoinerLink />
|
||||||
<br />
|
<br />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user