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() {
|
export default function App() {
|
||||||
const [isAuthenticated, setIsAuthenticated] = useState(!!existingToken);
|
const [isAuthenticated, setIsAuthenticated] = useState(!!existingToken);
|
||||||
const [currentUser, setCurrentUser] = useState(existingUser || '');
|
const [currentUser, setCurrentUser] = useState(existingUser || '');
|
||||||
|
const [participant, setParticipant] = useState();
|
||||||
const [possibleDates, setPossibleDates] = useState();
|
const [possibleDates, setPossibleDates] = useState();
|
||||||
const [currentMeeting, setCurrentMeeting] = useState({
|
const [currentMeeting, setCurrentMeeting] = useState({
|
||||||
title: '',
|
title: '',
|
||||||
@ -76,6 +76,7 @@ export default function App() {
|
|||||||
currentMeeting={currentMeeting}
|
currentMeeting={currentMeeting}
|
||||||
setCurrentMeeting={setCurrentMeeting}
|
setCurrentMeeting={setCurrentMeeting}
|
||||||
currentUser={currentUser}
|
currentUser={currentUser}
|
||||||
|
setParticipant={setParticipant}
|
||||||
/>
|
/>
|
||||||
<PrivateRoute
|
<PrivateRoute
|
||||||
path='/availability'
|
path='/availability'
|
||||||
@ -83,8 +84,13 @@ export default function App() {
|
|||||||
possibleDates={possibleDates}
|
possibleDates={possibleDates}
|
||||||
currentUser={currentUser}
|
currentUser={currentUser}
|
||||||
currentMeeting={currentMeeting}
|
currentMeeting={currentMeeting}
|
||||||
|
participant={participant}
|
||||||
|
/>
|
||||||
|
<PrivateRoute
|
||||||
|
path='/invite'
|
||||||
|
component={Invite}
|
||||||
|
currentMeeting={currentMeeting}
|
||||||
/>
|
/>
|
||||||
<PrivateRoute path='/invite' component={Invite} />
|
|
||||||
</Switch>
|
</Switch>
|
||||||
</Router>
|
</Router>
|
||||||
</AuthContext.Provider>
|
</AuthContext.Provider>
|
||||||
|
@ -20,19 +20,6 @@ import dtToUTC from '../helpers/datetimeToUTC';
|
|||||||
import { backend } from '../helpers/http-common';
|
import { backend } from '../helpers/http-common';
|
||||||
import './styles/Availability.less';
|
import './styles/Availability.less';
|
||||||
import './styles/layout.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:
|
// NOTES:
|
||||||
// Even though Fullcalendar is supposed to work with timezone,
|
// Even though Fullcalendar is supposed to work with timezone,
|
||||||
@ -42,8 +29,8 @@ import './styles/layout.less';
|
|||||||
|
|
||||||
export default function Availability({
|
export default function Availability({
|
||||||
currentUser,
|
currentUser,
|
||||||
currentMeeting,
|
|
||||||
possibleDates,
|
possibleDates,
|
||||||
|
participant,
|
||||||
}) {
|
}) {
|
||||||
const [availability, setAvailability] = useState([]);
|
const [availability, setAvailability] = useState([]);
|
||||||
const [timezone, setTimezone] = useState(currentUser.timezone);
|
const [timezone, setTimezone] = useState(currentUser.timezone);
|
||||||
@ -84,8 +71,7 @@ export default function Availability({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
meeting_id: currentMeeting.id,
|
participant_id: participant.id,
|
||||||
account_id: currentUser.id,
|
|
||||||
possible_date_id: date.id,
|
possible_date_id: date.id,
|
||||||
preference: false, // set to 'true" when implementing preference
|
preference: false, // set to 'true" when implementing preference
|
||||||
start_time: dtToUTC(event.start, timezone),
|
start_time: dtToUTC(event.start, timezone),
|
||||||
@ -205,7 +191,9 @@ export default function Availability({
|
|||||||
appearance='ghost'
|
appearance='ghost'
|
||||||
size='lg'
|
size='lg'
|
||||||
block
|
block
|
||||||
onClick={() => history.push('dashboard')}
|
onClick={() =>
|
||||||
|
history.push('dashboard')
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Go to dashboard
|
Go to dashboard
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -56,6 +56,49 @@ export default function Invite() {
|
|||||||
setParticipants([]);
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<NavBar title='Invite participants' />
|
<NavBar title='Invite participants' />
|
||||||
@ -85,7 +128,7 @@ export default function Invite() {
|
|||||||
>
|
>
|
||||||
Clear selection
|
Clear selection
|
||||||
</Button>
|
</Button>
|
||||||
<Button appearance='primary' size='lg' block>
|
<Button appearance='primary' size='lg' block onClick={() => console.log("boo")}>
|
||||||
Send invites
|
Send invites
|
||||||
</Button>
|
</Button>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
|
@ -29,6 +29,7 @@ export default function Schedule({
|
|||||||
currentMeeting,
|
currentMeeting,
|
||||||
setCurrentMeeting,
|
setCurrentMeeting,
|
||||||
currentUser,
|
currentUser,
|
||||||
|
setParticipant,
|
||||||
}) {
|
}) {
|
||||||
const [eventsList, setEventsList] = useState([]);
|
const [eventsList, setEventsList] = useState([]);
|
||||||
const [datesList, setDatesList] = useState(eventsToDates(eventsList));
|
const [datesList, setDatesList] = useState(eventsToDates(eventsList));
|
||||||
@ -147,6 +148,7 @@ export default function Schedule({
|
|||||||
|
|
||||||
addParticipant({
|
addParticipant({
|
||||||
account_id: currentUser.id,
|
account_id: currentUser.id,
|
||||||
|
email: currentUser.email,
|
||||||
meeting_id: response.data.id,
|
meeting_id: response.data.id,
|
||||||
quorum: 0, // 'false' while functionality not implemented
|
quorum: 0, // 'false' while functionality not implemented
|
||||||
mandatory: 0, // 'false' while functionality not implemented
|
mandatory: 0, // 'false' while functionality not implemented
|
||||||
@ -163,6 +165,7 @@ export default function Schedule({
|
|||||||
backend
|
backend
|
||||||
.post('/participants', data)
|
.post('/participants', data)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
setParticipant(response.data);
|
||||||
addPossibleDates({ meeting_id: response.data.meeting_id });
|
addPossibleDates({ meeting_id: response.data.meeting_id });
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user