Update components to latest database changes
This commit is contained in:
parent
1e85a8423d
commit
545a265a27
10
src/App.js
10
src/App.js
@ -21,7 +21,7 @@ const existingUser = JSON.parse(localStorage.getItem('user'));
|
||||
export default function App() {
|
||||
const [isAuthenticated, setIsAuthenticated] = useState(!!existingToken);
|
||||
const [currentUser, setCurrentUser] = useState(existingUser || '');
|
||||
|
||||
const [participant, setParticipant] = useState();
|
||||
const [possibleDates, setPossibleDates] = useState();
|
||||
const [currentMeeting, setCurrentMeeting] = useState({
|
||||
title: '',
|
||||
@ -76,6 +76,7 @@ export default function App() {
|
||||
currentMeeting={currentMeeting}
|
||||
setCurrentMeeting={setCurrentMeeting}
|
||||
currentUser={currentUser}
|
||||
setParticipant={setParticipant}
|
||||
/>
|
||||
<PrivateRoute
|
||||
path='/availability'
|
||||
@ -83,8 +84,13 @@ export default function App() {
|
||||
possibleDates={possibleDates}
|
||||
currentUser={currentUser}
|
||||
currentMeeting={currentMeeting}
|
||||
participant={participant}
|
||||
/>
|
||||
<PrivateRoute
|
||||
path='/invite'
|
||||
component={Invite}
|
||||
currentMeeting={currentMeeting}
|
||||
/>
|
||||
<PrivateRoute path='/invite' component={Invite} />
|
||||
</Switch>
|
||||
</Router>
|
||||
</AuthContext.Provider>
|
||||
|
@ -20,19 +20,6 @@ import dtToUTC from '../helpers/datetimeToUTC';
|
||||
import { backend } from '../helpers/http-common';
|
||||
import './styles/Availability.less';
|
||||
import './styles/layout.less';
|
||||
// // DEV possibleDates
|
||||
// const possibleDates = [
|
||||
// {
|
||||
// id: 63,
|
||||
// start: '2020-08-01',
|
||||
// display: 'background',
|
||||
// },
|
||||
// {
|
||||
// id: 64,
|
||||
// start: '2020-08-02',
|
||||
// display: 'background',
|
||||
// },
|
||||
// ];
|
||||
|
||||
// NOTES:
|
||||
// Even though Fullcalendar is supposed to work with timezone,
|
||||
@ -42,8 +29,8 @@ import './styles/layout.less';
|
||||
|
||||
export default function Availability({
|
||||
currentUser,
|
||||
currentMeeting,
|
||||
possibleDates,
|
||||
participant,
|
||||
}) {
|
||||
const [availability, setAvailability] = useState([]);
|
||||
const [timezone, setTimezone] = useState(currentUser.timezone);
|
||||
@ -84,8 +71,7 @@ export default function Availability({
|
||||
);
|
||||
|
||||
return {
|
||||
meeting_id: currentMeeting.id,
|
||||
account_id: currentUser.id,
|
||||
participant_id: participant.id,
|
||||
possible_date_id: date.id,
|
||||
preference: false, // set to 'true" when implementing preference
|
||||
start_time: dtToUTC(event.start, timezone),
|
||||
@ -205,7 +191,9 @@ export default function Availability({
|
||||
appearance='ghost'
|
||||
size='lg'
|
||||
block
|
||||
onClick={() => history.push('dashboard')}
|
||||
onClick={() =>
|
||||
history.push('dashboard')
|
||||
}
|
||||
>
|
||||
Go to dashboard
|
||||
</Button>
|
||||
|
@ -56,6 +56,49 @@ export default function Invite() {
|
||||
setParticipants([]);
|
||||
};
|
||||
|
||||
// const handleSubmit = () => {
|
||||
// // Create a list of participants to post
|
||||
// const participantsList = participants.map((participant) => {
|
||||
// //
|
||||
|
||||
// return {
|
||||
// account_id: '',
|
||||
// meeting_id: currentMeeting.id,
|
||||
// quorum: 0, // update when implementing functionality
|
||||
// mandatory: false, // update when implementing functionality
|
||||
// host: 0, // update when implementing functionality
|
||||
// answered: 0,
|
||||
// };
|
||||
// });
|
||||
|
||||
// // Create participants post request
|
||||
// const postAvailability = (data) => {
|
||||
// return backend.post('/participants', data);
|
||||
// };
|
||||
|
||||
// const requests = participantsList.map((event) =>
|
||||
// postAvailability(event),
|
||||
// );
|
||||
|
||||
// Promise.all(requests)
|
||||
// .then(function (results) {
|
||||
// // Add confirmation message
|
||||
// setStatus({
|
||||
// success: true,
|
||||
// error: false,
|
||||
// message: 'Your availability has been added to the meeting.',
|
||||
// });
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// setStatus({
|
||||
// error: true,
|
||||
// success: false,
|
||||
// message:
|
||||
// "Your availability couldn't be added to the meeting.",
|
||||
// });
|
||||
// });
|
||||
// };
|
||||
|
||||
return (
|
||||
<>
|
||||
<NavBar title='Invite participants' />
|
||||
@ -85,7 +128,7 @@ export default function Invite() {
|
||||
>
|
||||
Clear selection
|
||||
</Button>
|
||||
<Button appearance='primary' size='lg' block>
|
||||
<Button appearance='primary' size='lg' block onClick={() => console.log("boo")}>
|
||||
Send invites
|
||||
</Button>
|
||||
</ButtonGroup>
|
||||
|
@ -29,6 +29,7 @@ export default function Schedule({
|
||||
currentMeeting,
|
||||
setCurrentMeeting,
|
||||
currentUser,
|
||||
setParticipant,
|
||||
}) {
|
||||
const [eventsList, setEventsList] = useState([]);
|
||||
const [datesList, setDatesList] = useState(eventsToDates(eventsList));
|
||||
@ -147,6 +148,7 @@ export default function Schedule({
|
||||
|
||||
addParticipant({
|
||||
account_id: currentUser.id,
|
||||
email: currentUser.email,
|
||||
meeting_id: response.data.id,
|
||||
quorum: 0, // 'false' while functionality not implemented
|
||||
mandatory: 0, // 'false' while functionality not implemented
|
||||
@ -163,6 +165,7 @@ export default function Schedule({
|
||||
backend
|
||||
.post('/participants', data)
|
||||
.then((response) => {
|
||||
setParticipant(response.data);
|
||||
addPossibleDates({ meeting_id: response.data.meeting_id });
|
||||
})
|
||||
.catch((error) => {
|
||||
|
Loading…
Reference in New Issue
Block a user