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

BoG Spring 24 Deployment - Friends Feature #253

Merged
merged 99 commits into from
Apr 2, 2024
Merged

Conversation

samarth52
Copy link
Contributor

@samarth52 samarth52 commented Oct 20, 2023

Complete friends feature frontend.

cloud functions : gt-scheduler/firebase-conf#7

Hailey Ho and others added 30 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]>
commit 91e54e0
Merge: 99d4c57 f0c3319
Author: Samarth Chandna <[email protected]>
Date:   Fri Apr 21 16:11:39 2023 -0400

    Merge branch 'bog-changes-s23' of https://github.com/gt-scheduler/website into Samarth/172-load-friend-schedules

commit 99d4c57
Author: Samarth Chandna <[email protected]>
Date:   Fri Apr 21 13:20:02 2023 -0400

    added check to see if terms field exists in FriendData

commit 549c9fc
Author: Samarth Chandna <[email protected]>
Date:   Sat Apr 8 11:39:56 2023 -0400

    nits

commit b44ca3c
Author: Samarth Chandna <[email protected]>
Date:   Sat Apr 8 03:55:28 2023 -0400

    added useDeepCompareEffect and decoupled states from their setters

commit a11b277
Author: Samarth Chandna <[email protected]>
Date:   Sat Apr 8 01:33:00 2023 -0400

    changed request content type to prevent CORS preflight request

commit c6fde45
Author: Hailey Ho <[email protected]>
Date:   Fri Mar 31 03:17:56 2023 -0400

    Fix friend schedule type

commit 5a3a578
Merge: aa9e4bb adfc241
Author: Nghi Ho <[email protected]>
Date:   Fri Mar 31 03:08:23 2023 -0400

    Merge branch 'bog-changes-s23' into Samarth/172-load-friend-schedules

commit aa9e4bb
Merge: d2c0c01 20c58a2
Author: Nghi Ho <[email protected]>
Date:   Fri Mar 31 00:27:47 2023 -0400

    Merge branch 'bog-changes-s23' into Samarth/172-load-friend-schedules

commit d2c0c01
Author: Samarth Chandna <[email protected]>
Date:   Fri Mar 3 05:24:11 2023 -0500

    integrated friend stages and create friend context

commit 8d11931
Merge: 1771779 52006bb
Author: Samarth Chandna <[email protected]>
Date:   Fri Mar 3 00:24:29 2023 -0500

    Merge branch '171-friend-data' of https://github.com/gt-scheduler/website into Samarth/172-load-friend-schedules

commit 52006bb
Author: nathangong <[email protected]>
Date:   Fri Mar 3 00:19:06 2023 -0500

    Preliminary friend data workflow

commit 1771779
Author: Samarth Chandna <[email protected]>
Date:   Fri Mar 3 00:11:21 2023 -0500

    added hooks to extract friend info and fetch schedules
Nathan-Papa and others added 8 commits March 31, 2024 23:29
### Summary

Resolves #313

- Moved github button according to design on Figma
- Added donation button
- Added donation banner component which is shown only once ever
- Replaced action button in information modal with donation button as
per design

### How to Test

Run website and observe the new donate now button in the information
modal, and the donate banner across the top. The new banner closes when
you press the 'X', the GitHub button is in the bottom now, and the
donate button is in the top navbar.

---------

Co-authored-by: Yatharth Bhargava <[email protected]>
### Summary

Resolves Brandon Sprint 5 tickets

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

### Checklist

- [x] Right Panel Checkboxes
- [x] New Design for big share back button
- [x] Right Panel Scroll Feature improvements
- [x] On-hover tooltips for right panel friends - In progress
- [ ] Email Styling


### How to Test
Share Schedule Feature

---------

Co-authored-by: Yatharth Bhargava <[email protected]>
@yatharth-b yatharth-b changed the title Share Schedule Feature Merged Branch BoG Spring 24 Deployment - Friends Feature Apr 1, 2024
@yatharth-b yatharth-b closed this Apr 1, 2024
@yatharth-b yatharth-b reopened this Apr 1, 2024
joannacheng21 and others added 3 commits April 1, 2024 19:12
### Summary

Fix light mode share back button design

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

### Checklist

- [ ] Copy paste checklist from issue.


### How to Test
<!-- Describe how to test your code. -->
@yatharth-b yatharth-b requested review from yatharth-b and removed request for nhatnghiho April 2, 2024 05:47
Copy link
Contributor

@yatharth-b yatharth-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@yatharth-b yatharth-b merged commit bb9b7b7 into main Apr 2, 2024
3 checks passed
@yatharth-b yatharth-b deleted the bog-changes-s23-merged branch April 2, 2024 05:56
@yatharth-b yatharth-b restored the bog-changes-s23-merged branch April 2, 2024 05:56
yatharth-b added a commit that referenced this pull request Apr 2, 2024
yatharth-b added a commit that referenced this pull request Apr 2, 2024
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.

10 participants