Reorganize and cleanup
This commit is contained in:
parent
52e04006df
commit
672044e905
19
src/App.js
19
src/App.js
@ -3,16 +3,17 @@ import 'rsuite/lib/styles/index.less';
|
|||||||
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
|
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
|
||||||
|
|
||||||
import { AuthContext } from './helpers/authContext';
|
import { AuthContext } from './helpers/authContext';
|
||||||
|
import { PrivateRoute } from './components';
|
||||||
|
|
||||||
import PrivateRoute from './components/Routes/PrivateRoute';
|
import {
|
||||||
|
Home,
|
||||||
import Home from './screens/Home';
|
Login,
|
||||||
import Dashboard from './screens/Dashboard';
|
Register,
|
||||||
import Schedule from './screens/Schedule/Schedule';
|
Dashboard,
|
||||||
import Availability from './screens/Availability/Availability';
|
Invite,
|
||||||
import Invite from './screens/Invite/Invite';
|
Availability,
|
||||||
import Login from './screens/Login';
|
Schedule,
|
||||||
import Register from './screens/Register';
|
} from './screens';
|
||||||
|
|
||||||
const existingToken = localStorage.getItem('token');
|
const existingToken = localStorage.getItem('token');
|
||||||
// const existingUser = JSON.parse(localStorage.getItem('user'));
|
// const existingUser = JSON.parse(localStorage.getItem('user'));
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { DateTime } from 'luxon';
|
|
||||||
|
|
||||||
import { Icon, IconButton } from 'rsuite';
|
|
||||||
|
|
||||||
import FullCalendar from '@fullcalendar/react';
|
import FullCalendar from '@fullcalendar/react';
|
||||||
import dayGridPlugin from '@fullcalendar/daygrid';
|
import dayGridPlugin from '@fullcalendar/daygrid';
|
||||||
import timeGridPlugin from '@fullcalendar/timegrid';
|
import timeGridPlugin from '@fullcalendar/timegrid';
|
||||||
import interaction from '@fullcalendar/interaction';
|
import interaction from '@fullcalendar/interaction';
|
||||||
import scrollGrid from '@fullcalendar/scrollgrid';
|
import scrollGrid from '@fullcalendar/scrollgrid';
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
|
import { Icon, IconButton } from 'rsuite';
|
||||||
|
|
||||||
|
|
||||||
// FullCalendar props
|
// FullCalendar props
|
||||||
const dayMinWidth = 110;
|
const dayMinWidth = 110;
|
@ -1,8 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { Header, Navbar, Nav } from 'rsuite';
|
import { Header, Navbar, Nav } from 'rsuite';
|
||||||
|
|
||||||
import MenuDropdown from './MenuDropdown';
|
import MenuDropdown from './MenuDropdown';
|
||||||
import Title from './../General/Title';
|
import Title from '../Title';
|
||||||
|
|
||||||
export default function NavBar({ title }) {
|
export default function NavBar({ title }) {
|
||||||
return (
|
return (
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Redirect, Route } from 'react-router-dom';
|
import { Redirect, Route } from 'react-router-dom';
|
||||||
|
|
||||||
import { useAuth } from '../../helpers/authContext';
|
import { useAuth } from '../helpers/authContext';
|
||||||
|
|
||||||
const PrivateRoute = ({ component: Component, ...rest }) => {
|
const PrivateRoute = ({ component: Component, ...rest }) => {
|
||||||
const { authToken } = useAuth();
|
const { authToken } = useAuth();
|
@ -1,5 +1,6 @@
|
|||||||
import React, {useState} from 'react';
|
import React, {useState} from 'react';
|
||||||
import { InputGroup, Icon } from 'rsuite';
|
import { InputGroup, Icon } from 'rsuite';
|
||||||
|
|
||||||
import { durations } from '../../assets/data/durations';
|
import { durations } from '../../assets/data/durations';
|
||||||
|
|
||||||
export default function DurationSelector() {
|
export default function DurationSelector() {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { Divider, Icon, IconButton } from 'rsuite';
|
import { Divider, Icon, IconButton } from 'rsuite';
|
||||||
|
|
||||||
export default function SelectedDates({ datesList, handleDelete }) {
|
export default function SelectedDates({ datesList, handleDelete }) {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { timezones } from '../../assets/data/timezonesFlat';
|
|
||||||
import { InputPicker } from 'rsuite';
|
import { InputPicker } from 'rsuite';
|
||||||
|
|
||||||
|
import { timezones } from '../assets/data/timezonesFlat';
|
||||||
|
|
||||||
export default function TimezonePicker() {
|
export default function TimezonePicker() {
|
||||||
const [timezone, setTimezone] = useState('');
|
const [timezone, setTimezone] = useState('');
|
||||||
|
|
||||||
@ -9,7 +10,7 @@ export default function TimezonePicker() {
|
|||||||
<InputPicker
|
<InputPicker
|
||||||
data={timezones}
|
data={timezones}
|
||||||
// cleanable={false}
|
// cleanable={false}
|
||||||
style={{ width: "100%" }}
|
style={{ width: '100%' }}
|
||||||
labelKey='timezone'
|
labelKey='timezone'
|
||||||
groupBy='area'
|
groupBy='area'
|
||||||
placeholder='type to search your timezone'
|
placeholder='type to search your timezone'
|
8
src/components/index.js
Normal file
8
src/components/index.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export { default as PrivateRoute } from './PrivateRoute';
|
||||||
|
export { default as TimezonePicker } from './TimezonePicker';
|
||||||
|
export { default as IntervalSelector } from './IntervalSelector';
|
||||||
|
|
||||||
|
export { default as NavBar } from './Navbar/NavBar';
|
||||||
|
export { default as DaySelector } from './Schedule/DaySelector';
|
||||||
|
export { default as DurationSelector } from './Schedule/DurationSelector';
|
||||||
|
export { default as SelectedDates } from './Schedule/SelectedDates';
|
@ -1,5 +1,4 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Panel,
|
Panel,
|
||||||
Form,
|
Form,
|
||||||
@ -11,11 +10,9 @@ import {
|
|||||||
FormGroup,
|
FormGroup,
|
||||||
} from 'rsuite';
|
} from 'rsuite';
|
||||||
|
|
||||||
import NavBar from '../../components/Navbar/NavBar';
|
import { NavBar, TimezonePicker, IntervalSelector } from '../components';
|
||||||
import TimezonePicker from '../../components/General/TimezonePicker';
|
import './styles/Availability.less';
|
||||||
import IntervalSelector from '../../components/Interval/IntervalSelector';
|
import './styles/layout.less';
|
||||||
|
|
||||||
import './Availability.less';
|
|
||||||
|
|
||||||
export default function Availability() {
|
export default function Availability() {
|
||||||
const [availability, setAvailability] = useState([...availabilityList]);
|
const [availability, setAvailability] = useState([...availabilityList]);
|
||||||
@ -37,7 +34,7 @@ export default function Availability() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<NavBar title='Add your availability' />
|
<NavBar title='Add your availability' />
|
||||||
<Panel style={containerStyle}>
|
<Panel className={'app-container'}>
|
||||||
<Form className={'av-container'}>
|
<Form className={'av-container'}>
|
||||||
<div className={'av-details'}>
|
<div className={'av-details'}>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
@ -94,13 +91,6 @@ export default function Availability() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const containerStyle = {
|
|
||||||
// TODO Move to a .less file
|
|
||||||
maxWidth: '1200px',
|
|
||||||
margin: '30px auto',
|
|
||||||
backgroundColor: 'rgba(255,255,255,0.6)',
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO Remove fake data
|
// TODO Remove fake data
|
||||||
const eventsList = [
|
const eventsList = [
|
||||||
{
|
{
|
@ -2,11 +2,7 @@ import React from 'react';
|
|||||||
import { Panel } from 'rsuite';
|
import { Panel } from 'rsuite';
|
||||||
|
|
||||||
import { useAuth } from '../helpers/authContext';
|
import { useAuth } from '../helpers/authContext';
|
||||||
import NavBar from '../components/Navbar/NavBar';
|
import { NavBar } from '../components';
|
||||||
|
|
||||||
const boxStyle = {
|
|
||||||
margin: '50px 10px',
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function Dashboard() {
|
export default function Dashboard() {
|
||||||
const { authToken } = useAuth();
|
const { authToken } = useAuth();
|
||||||
@ -14,7 +10,7 @@ export default function Dashboard() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<NavBar title='Meeting Planner' />
|
<NavBar title='Meeting Planner' />
|
||||||
<Panel header={<h3>Dashboard</h3>} bordered style={boxStyle}>
|
<Panel header={<h3>Dashboard</h3>} bordered >
|
||||||
<p>This is just experimenting with stuff.</p>
|
<p>This is just experimenting with stuff.</p>
|
||||||
<p>{authToken}</p>
|
<p>{authToken}</p>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
@ -2,18 +2,14 @@ import React from 'react';
|
|||||||
import { Panel } from 'rsuite';
|
import { Panel } from 'rsuite';
|
||||||
|
|
||||||
import { useAuth } from '../helpers/authContext';
|
import { useAuth } from '../helpers/authContext';
|
||||||
import NavBar from '../components/Navbar/NavBar';
|
import { NavBar } from '../components';
|
||||||
|
|
||||||
const boxStyle = {
|
|
||||||
margin: '50px 10px',
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const { authToken } = useAuth();
|
const { authToken } = useAuth();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<NavBar title='Meeting Planner' />
|
<NavBar title='Meeting Planner' />
|
||||||
<Panel header={<h3>Home</h3>} bordered style={boxStyle}>
|
<Panel header={<h3>Home</h3>} bordered >
|
||||||
<p>This will be the home page</p>
|
<p>This will be the home page</p>
|
||||||
<p>{authToken}</p>
|
<p>{authToken}</p>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
import { Panel, Form, Button, ButtonGroup, Message, TagPicker } from 'rsuite';
|
import { Panel, Form, Button, ButtonGroup, Message, TagPicker } from 'rsuite';
|
||||||
|
|
||||||
import NavBar from '../../components/Navbar/NavBar';
|
import { NavBar } from '../components';
|
||||||
import './Invite.less';
|
import './styles/Invite.less';
|
||||||
|
import './styles/layout.less';
|
||||||
|
|
||||||
export default function Invite() {
|
export default function Invite() {
|
||||||
const [participants, setParticipants] = useState([]);
|
const [participants, setParticipants] = useState([]);
|
||||||
@ -12,11 +12,6 @@ export default function Invite() {
|
|||||||
|
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
console.log('useEffect participants: ', participants);
|
|
||||||
console.log('useEffect contactDropdown: ', contactDropdown);
|
|
||||||
}, [participants, contactDropdown]);
|
|
||||||
|
|
||||||
const handleSelect = (value) => {
|
const handleSelect = (value) => {
|
||||||
// TODO Verify if input contains an email
|
// TODO Verify if input contains an email
|
||||||
// Verify if email is already in the participants
|
// Verify if email is already in the participants
|
||||||
@ -64,7 +59,7 @@ export default function Invite() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<NavBar title='Invite participants' />
|
<NavBar title='Invite participants' />
|
||||||
<Panel style={containerStyle}>
|
<Panel className={'app-container'}>
|
||||||
<Form className={'av-container'}>
|
<Form className={'av-container'}>
|
||||||
<div className={'interval-selector'}>
|
<div className={'interval-selector'}>
|
||||||
<Message
|
<Message
|
||||||
@ -101,7 +96,9 @@ export default function Invite() {
|
|||||||
appearance='primary'
|
appearance='primary'
|
||||||
size='lg'
|
size='lg'
|
||||||
block
|
block
|
||||||
onClick={() => {history.push('availability');}}
|
onClick={() => {
|
||||||
|
history.push('availability');
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Add your availability
|
Add your availability
|
||||||
</Button>
|
</Button>
|
||||||
@ -112,30 +109,3 @@ export default function Invite() {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const containerStyle = {
|
|
||||||
// TODO Move to a .less file
|
|
||||||
maxWidth: '1200px',
|
|
||||||
margin: '30px auto',
|
|
||||||
backgroundColor: 'rgba(255,255,255,0.6)',
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO Remove fake data
|
|
||||||
// const contactsList = [
|
|
||||||
// {
|
|
||||||
// label: 'rui@protonmail.com',
|
|
||||||
// value: 'rui@protonmail.com',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// label: 'ln@armada.digital',
|
|
||||||
// value: 'ln@armada.digital',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// label: 'serge@goldwicht.be',
|
|
||||||
// value: 'serge@goldwicht.be',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// label: 'penkova@penkova.cc',
|
|
||||||
// value: 'penkova@penkova.cc',
|
|
||||||
// },
|
|
||||||
// ];
|
|
@ -10,9 +10,10 @@ import {
|
|||||||
Message,
|
Message,
|
||||||
} from 'rsuite';
|
} from 'rsuite';
|
||||||
|
|
||||||
import NavBar from './../components/Navbar/NavBar';
|
import { NavBar } from './../components';
|
||||||
import { backend } from '../helpers/http-common';
|
import { backend } from '../helpers/http-common';
|
||||||
import { useAuth } from '../helpers/authContext';
|
import { useAuth } from '../helpers/authContext';
|
||||||
|
import './styles/layout.less';
|
||||||
|
|
||||||
export default function Login() {
|
export default function Login() {
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
@ -51,7 +52,7 @@ export default function Login() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<NavBar title='Login' />
|
<NavBar title='Login' />
|
||||||
<Panel bordered style={boxStyle}>
|
<Panel bordered className={'form-container'}>
|
||||||
{error && <Message type='error' description={error} />}
|
{error && <Message type='error' description={error} />}
|
||||||
<Form>
|
<Form>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
@ -88,14 +89,3 @@ export default function Login() {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Move to a .less file
|
|
||||||
const boxStyle = {
|
|
||||||
maxWidth: 373,
|
|
||||||
margin: '0 auto',
|
|
||||||
borderRadius: 7,
|
|
||||||
background: 'white',
|
|
||||||
marginTop: '10vh',
|
|
||||||
marginBottom: '10vh',
|
|
||||||
padding: '1rem',
|
|
||||||
};
|
|
||||||
|
@ -1,40 +1,30 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import {
|
||||||
|
Form,
|
||||||
|
FormGroup,
|
||||||
|
FormControl,
|
||||||
|
ControlLabel,
|
||||||
|
HelpBlock,
|
||||||
|
Button,
|
||||||
|
Panel,
|
||||||
|
} from 'rsuite';
|
||||||
|
|
||||||
import { Form, FormGroup, FormControl, ControlLabel, HelpBlock, Button, Panel } from 'rsuite';
|
import { NavBar, TimezonePicker } from './../components';
|
||||||
|
import './styles/layout.less';
|
||||||
import NavBar from './../components/Navbar/NavBar';
|
|
||||||
import TimezonePicker from '../components/General/TimezonePicker';
|
|
||||||
|
|
||||||
// TODO Move to a .less file
|
|
||||||
const boxStyle = {
|
|
||||||
maxWidth: 373,
|
|
||||||
margin: '0 auto',
|
|
||||||
borderRadius: 7,
|
|
||||||
background: 'white',
|
|
||||||
marginTop: '10vh',
|
|
||||||
marginBottom: '10vh',
|
|
||||||
padding: '1rem',
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function Register() {
|
export default function Register() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<NavBar title='Register' />
|
<NavBar title='Register' />
|
||||||
<Panel bordered style={boxStyle}>
|
<Panel bordered className={'form-container'}>
|
||||||
<Form>
|
<Form>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<ControlLabel>Username</ControlLabel>
|
<ControlLabel>Username</ControlLabel>
|
||||||
<FormControl
|
<FormControl name='username' type='text' />
|
||||||
name='username'
|
|
||||||
type='text'
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<ControlLabel>Email</ControlLabel>
|
<ControlLabel>Email</ControlLabel>
|
||||||
<FormControl
|
<FormControl name='email' type='email' />
|
||||||
name='email'
|
|
||||||
type='email'
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<ControlLabel>Timezone</ControlLabel>
|
<ControlLabel>Timezone</ControlLabel>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
@ -42,16 +32,13 @@ export default function Register() {
|
|||||||
</FormGroup>
|
</FormGroup>
|
||||||
<ControlLabel>Password</ControlLabel>
|
<ControlLabel>Password</ControlLabel>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormControl
|
<FormControl name='password' type='password' />
|
||||||
name='password'
|
|
||||||
type='password'
|
|
||||||
/>
|
|
||||||
<HelpBlock>
|
<HelpBlock>
|
||||||
Minimum password length is 8 characters
|
Minimum password length is 8 characters
|
||||||
</HelpBlock>
|
</HelpBlock>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<Button appearance='primary' block size="lg">
|
<Button appearance='primary' block size='lg'>
|
||||||
Register
|
Register
|
||||||
</Button>
|
</Button>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
@ -13,13 +13,15 @@ import {
|
|||||||
} from 'rsuite';
|
} from 'rsuite';
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
import NavBar from '../../components/Navbar/NavBar';
|
import {
|
||||||
import TimezonePicker from '../../components/General/TimezonePicker';
|
NavBar,
|
||||||
import DaySelector from '../../components/Schedule/DaySelector';
|
TimezonePicker,
|
||||||
import DurationSelector from '../../components/Schedule/DurationSelector';
|
DaySelector,
|
||||||
import SelectedDates from '../../components/Schedule/SelectedDates';
|
DurationSelector,
|
||||||
|
SelectedDates,
|
||||||
|
} from '../components';
|
||||||
|
|
||||||
import './Schedule.less';
|
import './styles/Schedule.less';
|
||||||
|
|
||||||
export default function Schedule() {
|
export default function Schedule() {
|
||||||
const [eventsList, setEventsList] = useState([]);
|
const [eventsList, setEventsList] = useState([]);
|
||||||
@ -118,7 +120,7 @@ export default function Schedule() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<NavBar title='Schedule a meeting' />
|
<NavBar title='Schedule a meeting' />
|
||||||
<Panel style={containerStyle}>
|
<Panel className={'app-container'}>
|
||||||
<Form className={'meeting-container'}>
|
<Form className={'meeting-container'}>
|
||||||
<div className={'meeting-info'}>
|
<div className={'meeting-info'}>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
@ -201,10 +203,3 @@ const eventsToDates = (events) => {
|
|||||||
});
|
});
|
||||||
return dates;
|
return dates;
|
||||||
};
|
};
|
||||||
|
|
||||||
const containerStyle = {
|
|
||||||
// TODO Move to a .less file
|
|
||||||
maxWidth: '1200px',
|
|
||||||
margin: '30px auto',
|
|
||||||
backgroundColor: 'rgba(255,255,255,0.6)',
|
|
||||||
};
|
|
7
src/screens/index.js
Normal file
7
src/screens/index.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export { default as Home } from './Home';
|
||||||
|
export { default as Login } from './Login';
|
||||||
|
export { default as Register } from './Register';
|
||||||
|
export { default as Dashboard } from './Dashboard';
|
||||||
|
export { default as Invite } from './Invite';
|
||||||
|
export { default as Availability } from './Availability';
|
||||||
|
export { default as Schedule } from './Schedule';
|
15
src/screens/styles/layout.less
Normal file
15
src/screens/styles/layout.less
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
.app-container {
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 30px auto;
|
||||||
|
background-color: rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-container {
|
||||||
|
max-width: 373px;
|
||||||
|
margin: 0 auto;
|
||||||
|
border-radius: 7px;
|
||||||
|
background: white;
|
||||||
|
margin-top: 10vh;
|
||||||
|
margin-bottom: 10vh;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user