From f45df29e1ff8cc11caa7600e638c27461ba9e198 Mon Sep 17 00:00:00 2001 From: chunyu <46131429+gunbux@users.noreply.github.com> Date: Mon, 30 Jan 2023 13:18:22 +0800 Subject: [PATCH 01/33] RHApp Release (#778) * removed conflict headers * removed unused export replace prop with param in BookingSection * Fixed code based on comments * simplified dailyViewatesRow code * refactored facilities code * removed hacky use of useParams in selecting weekly recurrence end date; created new SelectRecurringDatePage instead * clear unused vars * fixed index html urls * fixed date row cannot click * fixed selecting recurring end date affects calender clickedDate value * Hacky fix to overnight bookings * changed all string jsx args from ={''} to ="" * capitalised 'Lato' * converted all jsx elements with no children self closing * changed profilePictureUrl to profilePicSignedUrl * changed profilePictureUrl to profilePicSignedUrl * fixed edit profile page not showing user pic * Add docs, update gitignore * fix spread issue on react hook form require * added sample docs to some pages and components * updated sample docs * Added documentations * Add docs for action file comments * Update docs for component * Update doc for page * add in SelectRecurringDatePage page description * Update BookingBlock description * removed some unused store variables * added docs for hourblocks component * added docs for checkForDurationError, setViewFacilityMode, fetchAllCCAS, setIsLoading, setBlockOutIsOpen, setIsJCRC * added docs for viewfacility / viewconflict routes * remove space... * removed more unused store variables * added bug comment * Update frontend/src/components/FacilityBooking/CurrentTimeLine.tsx Added Props back Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Corrected documentation for fetchSelectedFacility Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * added code example for CurrentTimeLine documentation * fixed eslint error * specified return variable name for facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * specified return variable name for isJCRC in facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * context for hourblocks Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * clarified description * Update .gitignore * Updated documentation for gymkeywith * Updated documentation for GymStatus * Finished documentation * Removed empty remarks and launch.json file * changed profilePictureUrl to profilePicSignedUrl * fixed edit profile page not showing user pic * Fixed documentation according to feedback TODO: Figure out whether avatar is a url or base64 string * Updated type of url of avatar * Fixed lint errors * Updated documentation * Update frontend/src/components/Gym/GymKeyWith.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/components/Gym/GymStatus.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/components/Gym/GymStatusTab.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/components/FacilityBooking/CurrentTimeLine.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/components/FacilityBooking/CurrentTimeLine.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/components/Gym/GymConfirmationModal.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/gym/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/gym/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/components/Gym/GymConfirmationModal.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/components/Gym/GymConfirmationModal.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/components/Gym/GymHistory.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Updated gym comments * changed profilePictureUrl to profilePicSignedUrl * fixed edit profile page not showing user pic * Updated gym comments * Removed extra line in GymHistory * Facilities revamp documentation (tim's part) * added docs for more action.ts functions * completed documentation for some components and routes * Update frontend/src/components/FacilityBooking/CurrentTimeLine.tsx * Update frontend/src/components/Gym/GymKeyWith.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/components/Gym/GymStatusTab.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/components/Gym/GymStatusTab.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/gym/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/components/Gym/GymStatus.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * fixed eslint errors * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/components/FacilityBooking/ViewBlock.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/routes/FacilityBooking/EditBooking/index.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/routes/FacilityBooking/EditBooking/index.tsx Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/store/facilityBooking/action.ts Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * Update frontend/src/routes/FacilityBooking/ViewFacility/index.tsx * Update frontend/src/store/facilityBooking/action.ts * Update frontend/src/store/facilityBooking/action.ts * Update frontend/src/components/Gym/GymHistory.tsx * Code cleanup (#677) * converted == to === * converted ={' '} to =" " * removed ={true} redundancy * made all empty tags self closing * remove ===true ===false redundancy * Gym Documentation (#710) * Update Gym Docs * Update frontend/src/store/gym/action.ts * Update Gym Docs Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> * resolved * Update frontend/src/store/facilityBooking/action.ts * Update frontend/src/store/facilityBooking/action.ts * Update frontend/src/store/facilityBooking/action.ts * fixed prettier error * fix: user_CCA endpoint * added docs to button * renamed routes and fixed conflict modal view conflict redirect error * updated docs to reflect url path changes of last commit * redirects user immediately after creating a booking, and shows conflict modal if conflict * fixed bug where timing before current time can be selected for booking * fixed weekly recurring booking * Added customizable elements to the height and font size of the button * fixed weekly recurring booking * Added react-toastify notification * [WIP] Added new home page * deleted yarn.lock * Update frontend/src/components/Button.tsx * Update frontend/src/components/Button.tsx * added booking successful popup after users made a booking, added delay before booking status changes back to initial * changed the package json back to original * [WIP] Created new front page * Created New Front Page * Reordered imports * removed comment * added line-height as prop * centered on desktop and removed unused code * edited according to comments * remove ridiculous trailing spaces in button text argument * minor code cleanup * undo change to endpoint.ts * undo change to endpoint.ts * minor cleanups * changed facils booking landing page, reordered directories * update docs * removed redundant facilityId param in ClickableDateContainer and other parent components * cleaned up Calendar redux store, to be removed completely * removed Calendar redux store * abstracted and restructured Calendar component to be more modular * removed redundant selectedFacilityId param * abstracted clickedDate from clickableDateContainer; Calender is now truly stateless * created aux function isSameDate * docs and cleanup of calendar code * abstraction and improvement of my bookings and calendar container css * edit page titles * modularised BookingTimeSelector * modularised BookingTimeSelector * implemented SearchBookingTime page * abstracted FacilitiesList * removed unused common functions * fix back navigation issues from booking page * implemented get available facilities within requested timeframe (not yet tested) * updated search results page and api call to handle no facilities available during given time * created enum for SearchMode * forgot to dispatch resetTimeSelectorSelection * allow backnavigation from reselecting booking time back to create booking page by using optional url param * renamed a few folders and paths * [BE] Facilities booking revamp (#737) * Implement /available endpoint * Implement check_bookings_within_time() * Refine /available endpoint Co-authored-by: theng * implemented unsuccessful booking popup * changed based on comments * tested getFacilityListWithinTime with backend updated api function * updated unixToFullDateTime function * sort facilities alphabetically * fixed ui of facilities list * abstracted REVAMP_GREEN * fixed timeline not refreshed when selecting search time * implemented login auth for private routes (#756) * implemented login auth for private routes * added doc for PublicRoute as well * renamed routes * final code cleanup * final cleanup * Dockerize backend (#741) * Added dockerignore files * Add initial docker deployments * Updated docker compose * Update docker configs * Update docker files * Update docker configs * Added deploy scripts * Minor fixes * Added CORS middleware * Add supporting infra * Update infra * Update infra and add announcer bot Co-authored-by: RHDevs * Cleanup files * removed unused codes * renamed REVAMP_GREEN to PRIMARY_GREEN * - Cleaned up error messages (#767) - Removed warnings - Improved tree shaking * Update endpoints (#768) * Revamp facilities/final debugs (#774) * prevent overflow of facility day view title * used useEffect to check if facility name string is 0, and get facility name if necessary * abolished react-hook-form and use redux to hold all form values instead * changed redirect from select time * abstracted bookingCard and refactored time string * abstracted booking form, fixed edit booking form default values and redirect * fixed edit booking time reselection * fixed edit booking api * fixed reselect edit booking current time blocked off for reselection * convert to URLSearchParams for api url parsing * fixed booking form no reset * added docs, minor code changes * fixed prettier issue * add docs, fixed clickedDate not set * fixed TODOs in action.ts, and mobile responsiveness for view bookings * fixed top nav bar overflow * set default date on calendar pages to today * deleted unused calendar css file * fix case when user cancels reselection of time * removed facility day view unnecessary padding * fix booking alert code merge error * code cleanup and route var names renaming * fixed some TODOs * removed unnecessary console log * [WIP] Revamp facilities final redisign (sic) (#777) * added new svg assets * created round icon button * implemented new design on facility booking landing page * implemented new design on search by time booking results page * final cleanups * changed booking formcca placeholder text * fixed scroll bug * enable disable default autoscroll when selecting time * improved conflict popup messages, different popup types for single- and recurring booking conflicts * RHApp Release - Beta Improvements (#779) * changed booking formcca placeholder text * fixed scroll bug * enable disable default autoscroll when selecting time * improved conflict popup messages, different popup types for single- and recurring booking conflicts * fixed recurring booking exclusive end date * fixed view conflict page keeps loading * Bump version number * Changed version number --------- Co-authored-by: Marcus Ong <75428027+marcus-ong-qy@users.noreply.github.com> Co-authored-by: Magmanat Co-authored-by: Marcus Ong Co-authored-by: joeng03 Co-authored-by: Xin Yee <63994179+xinyee20@users.noreply.github.com> Co-authored-by: joshualeejunyi Co-authored-by: joeng03 <51855281+joeng03@users.noreply.github.com> Co-authored-by: Joshua Lee <33726740+joshualeejunyi@users.noreply.github.com> Co-authored-by: Zhu Yuechen Co-authored-by: Kieron Seven Lee <40373653+Cikguseven@users.noreply.github.com> Co-authored-by: Zhu Yuechen <64315146+yuechen2001@users.noreply.github.com> Co-authored-by: Timothy Leow Co-authored-by: Timothy Leow <64006665+swoglord@users.noreply.github.com> Co-authored-by: gabyang Co-authored-by: Vina Tan <88601826+vinatsx@users.noreply.github.com> Co-authored-by: LWS49 Co-authored-by: Li Yuan Co-authored-by: antonTan96 Co-authored-by: JCSnap Co-authored-by: Anton <111056306+antonTan96@users.noreply.github.com> Co-authored-by: ttheng3810 <81245678+ttheng3810@users.noreply.github.com> Co-authored-by: theng Co-authored-by: RHDevs --- assets/.DS_Store | Bin 6148 -> 0 bytes backend/FacilityBooking/FacilitiesAPI.py | 124 +- frontend/package.json | 12 +- frontend/public/index.html | 14 +- frontend/src/GlobalStyle.tsx | 1 + frontend/src/assets/calendarTime.svg | 3 + frontend/src/assets/circleRightArrow.svg | 3 + frontend/src/assets/door.svg | 3 + frontend/src/assets/messageIcon.svg | 2 +- frontend/src/assets/viewBookingCardButton.svg | 4 + frontend/src/assets/viewBookingUserIcon.svg | 6 + frontend/src/common/colours.ts | 1 + frontend/src/common/dates.ts | 1 + frontend/src/common/isSameDate.ts | 19 + frontend/src/common/telegramMethods.tsx | 2 +- frontend/src/common/unixTo12HourTime.ts | 21 +- frontend/src/common/unixTo24HourTime.ts | 13 + frontend/src/common/unixToFormattedTime.ts | 8 +- frontend/src/common/unixToFullDateNumeric.ts | 13 + frontend/src/common/unixToFullDateTime.ts | 22 + frontend/src/common/unixToFullDay.ts | 13 + frontend/src/components/BookingCard.tsx | 132 +++ frontend/src/components/Button.tsx | 43 - .../components/Calendar/Calendar.styled.ts | 6 + frontend/src/components/Calendar/Calendar.tsx | 98 ++ .../components/Calendar/CalendarDateRows.tsx | 56 + .../Calendar/ClickableDateContainer.tsx | 61 + .../components/Calendar/CustomDateRows.tsx | 43 + .../src/components/Calendar/DayHeaders.tsx | 20 + frontend/src/components/ConfirmationModal.tsx | 37 +- frontend/src/components/ConflictAlert.tsx | 72 ++ .../FacilityBooking/BlockStyles.styled.ts | 100 ++ .../FacilityBooking/BookingBlock.tsx | 79 ++ .../FacilityBooking/BookingCard.tsx | 201 ++++ .../FacilityBooking/BookingForm.tsx | 196 ++++ .../FacilityBooking/CurrentTimeLine.tsx | 95 ++ .../FacilityBooking/DailyViewDatesRow.tsx | 114 ++ .../FacilityBooking/FacilitiesList.tsx | 226 ++++ .../FacilityBooking/FacilityLogo.tsx | 72 ++ .../components/FacilityBooking/HourBlocks.tsx | 25 + .../FacilityBooking/MyBookingsIcon.tsx | 18 + .../FacilityBooking/TimeSelector.tsx | 68 ++ .../components/FacilityBooking/ViewBlock.tsx | 64 ++ .../FacilityBooking/ViewBookingCard.tsx | 186 +++ .../FacilityBooking/ViewScheduleBlock.tsx | 73 ++ .../components/Gym/GymConfirmationModal.tsx | 16 +- frontend/src/components/Gym/GymHistory.tsx | 7 +- frontend/src/components/Gym/GymStatusTab.tsx | 4 +- frontend/src/components/IconButton.tsx | 100 ++ .../src/components/Mobile/BottomNavBar.tsx | 2 +- .../components/Mobile/ConfirmationModal.tsx | 6 +- .../Mobile/ImageDescriptionCard.tsx | 19 +- frontend/src/components/Mobile/InputField.tsx | 106 ++ frontend/src/components/Mobile/InputRow.tsx | 2 +- .../components/Mobile/JCRCBlockOutModal.tsx | 4 +- .../src/components/Mobile/SocialPostCard.tsx | 9 +- frontend/src/components/Mobile/TopNavBar.tsx | 26 +- frontend/src/components/ModalLink.tsx | 25 + .../Scheduling/ViewEventDetailCard.tsx | 4 +- frontend/src/components/SelectableField.tsx | 66 ++ .../src/components/Supper/BubbleSection.tsx | 3 +- .../Supper/CustomCards/OrderCard.tsx | 18 +- .../Supper/CustomCards/SGPaymentStatus.tsx | 2 +- .../Supper/CustomCards/SGStatusCard.tsx | 12 +- .../components/Supper/DeliveryTimeSetter.tsx | 2 +- frontend/src/components/Supper/FoodLine.tsx | 12 +- frontend/src/components/Supper/FormHeader.tsx | 3 +- .../src/components/Supper/InformationCard.tsx | 3 +- .../src/components/Supper/LineProgess.tsx | 3 +- .../src/components/Supper/MaxPriceFixer.tsx | 2 +- .../src/components/Supper/MenuSection.tsx | 11 +- .../components/Supper/Modals/ContactModal.tsx | 9 +- .../Supper/Modals/SupperShareModal.tsx | 6 +- .../Supper/Modals/ViewMenuFoodModal.tsx | 9 +- .../src/components/Supper/NotificationBar.tsx | 9 +- .../src/components/Supper/QuantityTracker.tsx | 2 +- frontend/src/components/Supper/RedButton.tsx | 3 +- .../src/components/Supper/SelectField.tsx | 11 +- .../src/components/Supper/SupperGroupCard.tsx | 6 +- .../components/Supper/UserPaymentStatus.tsx | 9 +- frontend/src/components/Switch.tsx | 68 ++ frontend/src/components/TextButton.tsx | 87 ++ frontend/src/components/TopNavBarRevamp.tsx | 84 ++ .../src/components/timetable/EventCell.tsx | 6 +- frontend/src/hooks/useSnackbar.tsx | 3 +- .../routes/Authentication/Forget/index.tsx | 3 +- .../src/routes/Authentication/Login/index.tsx | 3 +- .../routes/Authentication/Signup/index.tsx | 7 +- .../FacilityBooking/CreateBooking/index.tsx | 319 ------ .../CreateBookingForm/index.tsx | 146 +++ .../FacilityBooking/EditBookingForm/index.tsx | 123 ++ .../FacilityBooking/FacilityBooking.styled.ts | 8 + .../FacilityBooking/FacilityDayView/index.tsx | 105 ++ .../FacilitySelectDate/index.tsx | 138 +++ .../FacilitySelectTime/index.tsx | 233 ++++ .../FacilityBooking/MyBookings/index.tsx | 242 +--- .../SearchByTimeBookingResults/index.tsx | 106 ++ .../SearchByTimeSelectBookingDate/index.tsx | 59 + .../SearchByTimeSelectBookingTime/index.tsx | 136 +++ .../SelectRecurringDatePage/index.tsx | 55 + .../ViewAllFacilities/index.tsx | 120 ++ .../FacilityBooking/ViewBooking/index.tsx | 216 ++-- .../ViewConflicts/ConflictBookingModal.tsx | 79 ++ .../FacilityBooking/ViewConflicts/index.tsx | 49 + .../FacilityBooking/ViewFacility/calendar.css | 145 --- .../FacilityBooking/ViewFacility/index.tsx | 352 ------ frontend/src/routes/FacilityBooking/index.tsx | 327 ++---- frontend/src/routes/Home/Search/index.tsx | 13 +- .../Home/components/SocialSection/index.tsx | 3 +- frontend/src/routes/Home/index.tsx | 30 +- .../Components/EditPersonalInfoContainer.tsx | 41 +- .../routes/Profile/Components/PostCard.tsx | 9 +- frontend/src/routes/Profile/index.tsx | 62 +- frontend/src/routes/RouteTypes.tsx | 2 + frontend/src/routes/Routes.tsx | 116 +- .../src/routes/Schedule/CreateEvent/index.tsx | 7 +- .../src/routes/Schedule/EventList/index.tsx | 6 +- .../Schedule/ImportFromNusMods/index.tsx | 3 +- .../routes/Schedule/ShareTimetable/index.tsx | 6 +- .../routes/Social/CreateEditPost/index.tsx | 58 +- frontend/src/routes/Social/ViewPost/index.tsx | 9 +- .../src/routes/Supper/AddFoodItem/index.tsx | 4 +- .../Supper/CreateSupperGroup/Pages/page2.tsx | 1 + .../Supper/CreateSupperGroup/Pages/page3.tsx | 1 + .../routes/Supper/DeliveryDetails/index.tsx | 7 +- .../src/routes/Supper/EditFoodItem/index.tsx | 4 +- .../routes/Supper/EditSupperGroup/index.tsx | 1 + .../src/routes/Supper/GroupHistory/index.tsx | 2 +- frontend/src/routes/Supper/Order/index.tsx | 2 +- .../OrderSummary/UpdateAllItems/index.tsx | 3 +- .../OrderSummary/UpdateDelivery/index.tsx | 6 +- .../Supper/OrderSummary/UpdateItem/index.tsx | 3 +- frontend/src/routes/Supper/Payment/index.tsx | 1 + frontend/src/routes/Supper/componentsPage.tsx | 3 +- frontend/src/routes/Supper/index.tsx | 2 +- frontend/src/service-worker.ts | 2 +- frontend/src/serviceWorkerRegistration.ts | 10 +- frontend/src/store/endpoints.ts | 100 +- frontend/src/store/facilityBooking/action.ts | 1014 ++++++++++++----- frontend/src/store/facilityBooking/reducer.ts | 257 +++-- frontend/src/store/facilityBooking/types.ts | 248 ++-- frontend/src/store/gym/action.ts | 15 + frontend/src/store/laundry/action.ts | 20 +- frontend/src/store/social/action.ts | 10 +- frontend/src/store/stubs.ts | 54 +- frontend/yarn.lock | 581 +++++++++- package.json | 3 - 147 files changed, 6553 insertions(+), 2286 deletions(-) delete mode 100644 assets/.DS_Store create mode 100644 frontend/src/assets/calendarTime.svg create mode 100644 frontend/src/assets/circleRightArrow.svg create mode 100644 frontend/src/assets/door.svg create mode 100644 frontend/src/assets/viewBookingCardButton.svg create mode 100644 frontend/src/assets/viewBookingUserIcon.svg create mode 100644 frontend/src/common/isSameDate.ts create mode 100644 frontend/src/common/unixTo24HourTime.ts create mode 100644 frontend/src/common/unixToFullDateNumeric.ts create mode 100644 frontend/src/common/unixToFullDateTime.ts create mode 100644 frontend/src/common/unixToFullDay.ts create mode 100644 frontend/src/components/BookingCard.tsx delete mode 100644 frontend/src/components/Button.tsx create mode 100644 frontend/src/components/Calendar/Calendar.styled.ts create mode 100644 frontend/src/components/Calendar/Calendar.tsx create mode 100644 frontend/src/components/Calendar/CalendarDateRows.tsx create mode 100644 frontend/src/components/Calendar/ClickableDateContainer.tsx create mode 100644 frontend/src/components/Calendar/CustomDateRows.tsx create mode 100644 frontend/src/components/Calendar/DayHeaders.tsx create mode 100644 frontend/src/components/ConflictAlert.tsx create mode 100644 frontend/src/components/FacilityBooking/BlockStyles.styled.ts create mode 100644 frontend/src/components/FacilityBooking/BookingBlock.tsx create mode 100644 frontend/src/components/FacilityBooking/BookingCard.tsx create mode 100644 frontend/src/components/FacilityBooking/BookingForm.tsx create mode 100644 frontend/src/components/FacilityBooking/CurrentTimeLine.tsx create mode 100644 frontend/src/components/FacilityBooking/DailyViewDatesRow.tsx create mode 100644 frontend/src/components/FacilityBooking/FacilitiesList.tsx create mode 100644 frontend/src/components/FacilityBooking/FacilityLogo.tsx create mode 100644 frontend/src/components/FacilityBooking/HourBlocks.tsx create mode 100644 frontend/src/components/FacilityBooking/MyBookingsIcon.tsx create mode 100644 frontend/src/components/FacilityBooking/TimeSelector.tsx create mode 100644 frontend/src/components/FacilityBooking/ViewBlock.tsx create mode 100644 frontend/src/components/FacilityBooking/ViewBookingCard.tsx create mode 100644 frontend/src/components/FacilityBooking/ViewScheduleBlock.tsx create mode 100644 frontend/src/components/IconButton.tsx create mode 100644 frontend/src/components/Mobile/InputField.tsx create mode 100644 frontend/src/components/ModalLink.tsx create mode 100644 frontend/src/components/SelectableField.tsx create mode 100644 frontend/src/components/Switch.tsx create mode 100644 frontend/src/components/TextButton.tsx create mode 100644 frontend/src/components/TopNavBarRevamp.tsx delete mode 100644 frontend/src/routes/FacilityBooking/CreateBooking/index.tsx create mode 100644 frontend/src/routes/FacilityBooking/CreateBookingForm/index.tsx create mode 100644 frontend/src/routes/FacilityBooking/EditBookingForm/index.tsx create mode 100644 frontend/src/routes/FacilityBooking/FacilityBooking.styled.ts create mode 100644 frontend/src/routes/FacilityBooking/FacilityDayView/index.tsx create mode 100644 frontend/src/routes/FacilityBooking/FacilitySelectDate/index.tsx create mode 100644 frontend/src/routes/FacilityBooking/FacilitySelectTime/index.tsx create mode 100644 frontend/src/routes/FacilityBooking/SearchByTimeBookingResults/index.tsx create mode 100644 frontend/src/routes/FacilityBooking/SearchByTimeSelectBookingDate/index.tsx create mode 100644 frontend/src/routes/FacilityBooking/SearchByTimeSelectBookingTime/index.tsx create mode 100644 frontend/src/routes/FacilityBooking/SelectRecurringDatePage/index.tsx create mode 100644 frontend/src/routes/FacilityBooking/ViewAllFacilities/index.tsx create mode 100644 frontend/src/routes/FacilityBooking/ViewConflicts/ConflictBookingModal.tsx create mode 100644 frontend/src/routes/FacilityBooking/ViewConflicts/index.tsx delete mode 100644 frontend/src/routes/FacilityBooking/ViewFacility/calendar.css delete mode 100644 frontend/src/routes/FacilityBooking/ViewFacility/index.tsx delete mode 100644 package.json diff --git a/assets/.DS_Store b/assets/.DS_Store deleted file mode 100644 index 22ff2d9e98912e3566fe11fb2f4a2e166eff6394..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}N6?5Kj7|X+`WoP;a?-E7JOl2Vt#x=uKGBgG$}Cr7o-+>257rEBhS!M!tZL zqccfbD%GQ+G6R!ub~2OQd|~+xE`uY zKUDriEIEEB1Gsj17Ba=!pyTU@TVfY<Ge(`U@AWkZkSDwk{@>A17 z6h(2ic+BuLKH-yQCjNvx3;TgSzWDc49c>>D^|j5xpdc2Ot2_0J>%05@ z!{G5r&w_E-ty<TENC1N6e8H9gC?!=mFs-70{$|TVimN4t{Cl9E+(z zlg_v;KDd1|w-pN4Z-?=v4rkmkNG&ly418n&Yd??@-v0+**Z(?*8e)JL_@4~$+`hYC zgSpwebz+uy*GkX}P!x', methods=["GET"]) @ cross_origin(supports_credentials=True) def get_facility_name(facilityID): @@ -248,6 +300,76 @@ def check_bookings(facilityID): return make_response(response) +@ facilities_api.route('/bookings', methods=["GET"]) +@ cross_origin(supports_credentials=True) +def check_bookings_within_time(): + try: + startTime = int(request.args.get('startTime')) if request.args.get('startTime') else 0 + endTime = int(request.args.get('endTime')) if request.args.get('endTime') else -1 + if endTime <= startTime: + return {"err": "Invalid start and end time", "status": "failed"}, 400 + + condition = { + "$and": [ + { + "startTime": { + "$lt": endTime + } + }, + { + "endTime": { + "$gt": startTime + } + } + ] + } + + pipeline = [ + {'$match': + condition + }, + {'$lookup': { + 'from': 'User', + 'localField': 'userID', + 'foreignField': 'userID', + 'as': 'profile' + }}, + {'$unwind': {'path': '$profile', 'preserveNullAndEmptyArrays': True}}, + {'$addFields': { + 'displayName': '$profile.displayName' + }}, + {'$lookup': { + 'from': 'CCA', + 'localField': 'ccaID', + 'foreignField': 'ccaID', + 'as': 'cca' + }}, + {'$unwind': {'path': '$cca', 'preserveNullAndEmptyArrays': True}}, + {'$addFields': { + 'ccaName': '$cca.ccaName' + }}, + {'$lookup': { + 'from': 'Facilities', + 'localField': 'facilityID', + 'foreignField': 'facilityID', + 'as': 'facility' + }}, + {'$unwind': {'path': '$facility', 'preserveNullAndEmptyArrays': True}}, + {'$addFields': { + 'facilityName': '$facility.facilityName' + }}, + {'$project': {'profile': 0, 'cca': 0, 'facility': 0, '_id': 0}} + ] + + data = list(db.Bookings.aggregate(pipeline)) + data.sort(key=lambda x: x.get('startTime')) + response = {"startTime": startTime, "endTime": endTime, "bookings_placed": data, "status": "success"}, 200 + except Exception as e: + print(e) + return {"err": "An error has occurred", "status": "failed"}, 500 + return make_response(response) + + @ facilities_api.route('/bookings', methods=['POST']) @ cross_origin(supports_credentials=True) def add_booking(): diff --git a/frontend/package.json b/frontend/package.json index a0a7f392a..9ac904d55 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "frontend", - "version": "0.1.0", + "version": "2.1.0", "private": true, "dependencies": { "@ant-design/icons": "^4.3.0", @@ -22,10 +22,11 @@ "antd": "^4.16.6", "antd-mobile": "^2.3.4", "axios": "^0.21.0", - "babel-plugin-import": "^1.13.3", + "babel-plugin-import": "^1.13.5", "bcrypt": "^5.0.0", "crypto-js": "^4.0.0", "customize-cra": "^1.0.0", + "date-fns": "^2.28.0", "dayjs": "^1.9.7", "dotenv": "^8.2.0", "dotenv-webpack": "^7.0.1", @@ -61,10 +62,12 @@ "web-vitals": "^0.2.4" }, "scripts": { + "analyze": "source-map-explorer 'build/static/js/*.js'", "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", + "docs": "typedoc", "lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix" }, "eslintConfig": { @@ -101,6 +104,9 @@ "eslint": "^7.29.0", "eslint-config-prettier": "^6.15.0", "eslint-plugin-prettier": "^3.1.4", - "prettier": "^2.2.1" + "eslint-plugin-react": "^7.30.0", + "prettier": "^2.2.1", + "react-test-renderer": "^18.1.0", + "source-map-explorer": "^2.5.3" } } diff --git a/frontend/public/index.html b/frontend/public/index.html index c87b94ff6..2dc9cd059 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -9,13 +9,13 @@ /> - - - - - - - + + + + + + +