Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nathan/new time picker #273

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

Nathan/new time picker #273

wants to merge 26 commits into from

Conversation

yatharth-b
Copy link
Contributor

Summary

Resolves #[ticket-number]

Checklist

  • Copy paste checklist from issue.

How to Test

Hailey Ho and others added 26 commits January 22, 2023 17:01
### Summary

Resolves #151

<!-- What does this PR change and why? Discuss any breaking changes. -->

### Checklist

- [x] Generated combinations do not conflict with the events.
- [x] Update getCombinations's usage in CourseContainer.


### How to Test
<!-- Describe how to test your code. -->
- In `src/components/CombinationContainer/index.tsx`, assign a dummy
events list of type `Immutable<Event[]>` to `events` after the `events`
prop import from ScheduleContext
- Choose a term in the dev environment and add courses
- Experiment with different Event times by updating `events`, and check
for conflicts in the Combinations tab (the combinations where sections
conflict with the recurring event should not appear)
- An example `events`, which will reserve the time between 9:30am to
5:00pm on Monday and Wednesday.
```
events = castImmutable([
  {
    id: '123',
    name: 'test',
    period: {
      start: 570,
      end: 1020,
    },
    days: ['M', 'W'],
  },
]);
```

---------

Co-authored-by: Hailey Ho <[email protected]>
Co-authored-by: Nghi Ho <[email protected]>
### Summary

Resolves #148 

<!-- What does this PR change and why? Discuss any breaking changes. -->
Adds functionality for courses and recurring events tab

### Checklist

- [X]  Two tabs exist for Courses and Recurring Events
- [X] Clicking on the tab should show the correct view.
- [X] Works for both light and dark modes.
- [X] Works with mobile view.


### How to Test
<!-- Describe how to test your code. -->
Click on the recurring events tab and it should switch views. Click back
to courses and it should show the courses view.

---------

Co-authored-by: Nghi Ho <[email protected]>
### Summary

Resolves #150 

Creates Event component for custom blocks / events.

### Checklist
#### UI Requirements
- [x] Event name field can handle text overflow.
- [x] Works with mobile view.

#### Functional Requirements
- [x] Use `ScheduleContext`, which stores info about custom blocks, to
populate and color the card.
- [x] Users can change color with the palette icon.
- [x] Delete icon deletes the event from `ScheduleContext`.


### How to Test
- In `src/components/CourseContainer/index.tsx` create a list of test
Events of type `Event[]`
- Add `Event` components in `src/components/CourseContainer/index.tsx`
using test events, similar to how `Course` is added

---------

Co-authored-by: Nghi Ho <[email protected]>
### Summary

Resolves #149

Creates event input form. On submit, new event is added to
`ScheduleContext`.

### Checklist
#### UI Requirements
- [x] `Name` field can handle text overflow.
- [x] Users can pick multiple days.
- [x] Works for both light and dark modes.
- [x] Works with mobile view.

#### Functional Requirements
- [x] Submitting the form updates the list of `events` in
`ScheduleContext`, the context that stores all info about courses and
custom blocks.
- [x] When submitted, start and end time should be converted to a
numeric format of `hh * 60 + mm` (e.g., 11:15am -> 11 * 60 + 15 = 675,
3:30pm or 15:30 -> 15 * 60 + 30 = 930).
- [x] New events should be assigned a unique id.
- [x] New events should be assigned a random color.


### How to Test
Temporarily add `EventAdd` component to `CourseContainer` (right above
`CourseAdd`)
Run `npm run start`

### Other Notes
I added basic error handling for the case where the end time is before
the start time, but there may be some changes needed with UX/UI.

---------

Co-authored-by: Nghi Ho <[email protected]>
### Summary

Resolves #152.

Added support for custom events in overlapping classes algorithm.

### Checklist

- [x] rowIndex and rowSize are accurate for all overlapping
events/classes.
- [x] New types are created for event's size info (and should mirror the
typing for crnSizeInfo and TimeBlockPosition)


### How to Test
Added any class and then create a custom event that overlaps with it.

---------

Co-authored-by: Nghi Ho <[email protected]>
### Summary

Resolves #151

<!-- What does this PR change and why? Discuss any breaking changes. -->
Integrated `Event` components from Sprint 1.

### Checklist
#### UI Requirements
- [x] `Recurring Events` tab always displays `EventAdd` along with any
existing events.

#### Functional Requirements
- [x] Edit button on `Event` opens up `EventAdd`. On save, `EventAdd`
disappears and changes are saved.
- [x] `Event` should display days in chronological order (currently,
days are not sorted).

### How to Test
<!-- Describe how to test your code. -->
Use the preview site to test adding, editing, and deleting recurring
events.

Co-authored-by: Hailey Ho <[email protected]>
### Summary

Resolves #153 

Adds custom event blocks to calendar

### Checklist
#### UI Requirements
- [x] The block is placed at the right date and time on the calendar.
- [x] The block has a minimum height, so even when the event's duration
is too short, users can at least see the name of the event
([Figma](https://www.figma.com/file/CkystexX4qQO9OnZRxktXa/GT-Scheduler-%2F-Spr21?node-id=3207%3A2125&t=8EcWnMFd70puiz4A-0))
- [x] Name of the event should have a character limit when displayed on
`Calendar`. Full name is shown in the popup instead.
- [x] Mobile view works.

#### Functional Requirements
- [x] Popup appears when hovered over and is focused on click.

### How to Test
Add events of varying sizes (10 min, 20 min, 30 min) and varying name
lengths.

Notes: 
- There is probably some extraneous code I haven't gotten rid of or
property edited from TimeBlock.
- Minimum time block height is set to 15 min.
- Minimum time block length to see time info is set to 30 min.

---------

Co-authored-by: Nghi Ho <[email protected]>
Co-authored-by: Hailey Ho <[email protected]>
### Summary

Resolves #160 

Updates the "most compact" sorting option to account for custom blocks

### Checklist

- [x] Combinations are sorted appropriately for each setting.
- [x] Related components (if any) are updated if this change affects
them (`Calendar` is an example). -- I don't think anything was impacted
by this change

### How to Test
Create a few custom blocks, check how the ordering of the combinations
changes as a result

---------

Co-authored-by: Nghi Ho <[email protected]>
### Summary

Resolves #164, Firebase Function PR:
gt-scheduler/firebase-conf#1

- Added schema structure through types in src/data/types.ts.
- Created hooks similar to useRawScheduleDataFromFirebase and
useRawScheduleDataFromStorage for retrieving and changing data from
firestore or local storage.
- Created a cloud function for retrieving the versions of friends the
user has access to.
- NOTE: I was not able to test if the cloud function properly checks the
validity of the IdToken provided by frontend authentication while making
the request. The function retrieves friend versions as expected.

### Checklist

- [x] A new schema Friends is created.
- [x] A function exists for adding a friend's schedule to a user's list
of accessible schedules (C/U in CRUD)
- [x] A Cloud Function exists for fetching friends' schedules.
Preferably, the algorithm should be able to fetch schedules in batch to
reduce the number of API hits (R in CRUD)
- [x] A function exists for removing a friend's schedule from a user's
list of accessible schedules (D in CRUD)

### How to Test

This is the expected structure of the body of the request made to the
firebase function:

```
{
    "friends": {
        "friend id": ["version id"]
    },
    "term": "term",
    "IDToken": "token id provided by frontend auth"
}
```

For testing purposes, comment out code from the function that verifies
the user's IdToken.

---------

Co-authored-by: Hailey Ho <[email protected]>
Co-authored-by: Nghi Ho <[email protected]>
### Summary

Resolves #162 

<!-- What does this PR change and why? Discuss any breaking changes. -->
Adds Invitation Modal to export drop down that allows users to share
their schedule

### Checklist

- [x] The "Share/Export" dropdown has a button that opens up the modal.
- [x] The modal has two sections: 1) email invitation and 2) list of
friends with access to the user's active schedule.
- [x] Feedback is displayed to users when an email invite is
successfully sent or when they try to invite a non-existent user.
- [x] An autocomplete dropdown exists (this will be used for memorizing
recently invited friends).
- [x] The list of invited friends is scrollable.


### How to Test
<!-- Describe how to test your code. -->
Click "share schedule" in "share/export" dropdown
This opens a modal where the user can share their schedule 
Email can be input, if it exists, the share is successful, otherwise the
user is told that the email is invalid
Invited users can be viewed at the bottom of the modal and their status
can be viewed on hover

---------

Co-authored-by: Nghi Ho <[email protected]>
Co-authored-by: Hailey Ho <[email protected]>
Co-authored-by: Hailey Ho <[email protected]>
Co-authored-by: Hailey Ho <[email protected]>
### Summary

Resolves #163 , Firebase Function PR:
gt-scheduler/firebase-conf#2

<!-- What does this PR change and why? Discuss any breaking changes. -->
- Added a new firebase collection (`friend-invites`) that keeps track of
pending schedule invites (information about senderId, friendId, term,
version).
- Created a firebase cloud function that checks arguments, creates a new
invite record, and sends an email with a backlink generated from the new
record's id (`gt-scheduler.org/invite/<record_id>`).
- Setup nodemailer to send emails
- Added react-dom-node to handle dynamic routes to support the invite
backlink
- Created a firebase cloud function that deletes the invite record when
the backlink is clicked. It is called by the dynamic route. This cloud
function or the function in the dynamic route can be extended to perform
the actual schedule-sharing updates

### Checklist
- [x] An email is sent to the right user. If that user does not exist in
the database, return an error.
- [x] The email must have a message (such as, who sent them the
invitation? to view which schedule? of which semester? etc.)
- [x] The email should contain a click-back link (Note: we will
implement what this click-back link would do later but right now just
know that we'll use this email to confirm/establish the "friendship")

### New Cloud Functions
New Cloud Functions expect the following in the request body:
- create_friend_invitation:
```
{
    IDToken: string,        // Firebase auth token of current user ( await auth.currentUser?.getIdToken() ),
    friendEmail: string,
    term: string,           // can be found in ScheduleContext
    version: string,        // schedule version id; can be found in ScheduleContext
}
```

- handle_friend_invitation:
```
{
    inviteId: string        // id of valid record in friend-invites collections
}
```

### How to Test
- Follow the steps in the `gt-scheduler/firebase-conf` repo to run the
firebase emulator
- Sign in with email (have at least 2 accs)
- Use the input box at the bottom of the Course Search tab to enter the
second email and then press the button. Check the emulator logs and db
updates
- Check your email for the backlink and press it. Monitor the logs and
db updates again

---------

Co-authored-by: Nghi Ho <[email protected]>
Co-authored-by: Hailey Ho <[email protected]>
### Summary

Resolves #269 
Refactored code to improve code quality, removed redundant states and
unnecessary useEffects, adding memorization

### Checklist

- [x] look at the old code in Nathan's PR here -
#240
- [x] Refactor it and improve code quality (state, useEffect, CSS) as
you see fit. Some ideas - redundant state, unncessary useEffect
- [x] If time permits look over how gt-scheduler loads data. Start
reading at components/AppDataLoader.


### How to Test
Test adding recurring events on Scheduler
Copy link

github-actions bot commented Feb 4, 2024

PR Preview Action v1.4.6
🚀 Deployed preview to https://gt-scheduler.github.io/website/pr-preview/pr-273/
on branch gh-pages at 2024-02-04 02:37 UTC

@nathangong
Copy link
Contributor

🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants