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

User Context and User Type created and wrapped chat screen #131

Merged
merged 6 commits into from
Feb 25, 2024

Conversation

AaronGibson2
Copy link
Contributor

@AaronGibson2 AaronGibson2 commented Feb 6, 2024

Closes #87

Created UserContext, useUser, UserProvider, and UserType. Wrapped layout in home with UserProvider. Chat screen now features a user.username which keeps the username consistent between messages instead of creating a whole new username each time someone sends a message.

client/src/contexts/UserContext.tsx Outdated Show resolved Hide resolved
client/src/utils/types.ts Show resolved Hide resolved
client/src/components/Chat/ChatScreen.tsx Outdated Show resolved Hide resolved
pfp: "null"
});

const [user, setUser] = useState<UserType>({
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you separate these into 3 different states?

@AlexanderWangY
Copy link
Collaborator

@h1divp Any progress for this on your end?

@h1divp
Copy link
Collaborator

h1divp commented Feb 24, 2024

The changes are almost done on my end, I just haven't been working in a while since I've been a little busy. I'll have them drive by the end of tonight

Amongst these changes, the user type on the frontend has been edited in order
to prevent hidden functions that would pull information into the UserContext
from other contexts. The message type was also modified to keep a new author
section with a displayName attribute. An issue should be created for a socket
API endpoint for grabbing the displayName, and one to set it in a connectedUser
document in the databse.
Copy link
Collaborator

@AlexanderWangY AlexanderWangY left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@AlexanderWangY AlexanderWangY merged commit 1bd5642 into ufosc:main Feb 25, 2024
1 check failed
AlexanderWangY added a commit that referenced this pull request Feb 25, 2024
* Made error case for email in use display correctly in front end

* Made error case for email in use display correctly in front end (#158)

* Cleaned up useEffect function #159

* Added testing pipeline (#175)

* Create main.yml

* Update main.yml

* Update _layout.tsx

* Update main.yml

* Update socketio.test.ts

* Update socketio.test.ts

* Update _layout.tsx

* User Context and User Type created and wrapped chat screen (#131)

* added user context

* Added userID and displayName

* moved user and display name generation into UserProvider

* Improved UserContext implementation

Amongst these changes, the user type on the frontend has been edited in order
to prevent hidden functions that would pull information into the UserContext
from other contexts. The message type was also modified to keep a new author
section with a displayName attribute. An issue should be created for a socket
API endpoint for grabbing the displayName, and one to set it in a connectedUser
document in the databse.

* updated package lock

---------

Co-authored-by: h1divp <[email protected]>

* Set up Firebase-Admin in adminInit.ts (#155)

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* added passport

* started auth + admin sdk

* removed passport

* added private key to gitignore

* Delete server/private_keys/private.json

---------

Co-authored-by: AlexanderWangY <[email protected]>

* Refactored most of the actions (#156)

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* added passport

* started auth + admin sdk

* removed passport

* added private key to gitignore

* Delete server/private_keys/private.json

* initializing firestore in admin

* finished most of action refactoring

* Made error case for email in use display correctly in front end (#158)

* changed getConnectedUsers to admin

* migrated to firebase-admin

---------

Co-authored-by: AlexanderWangY <[email protected]>
Co-authored-by: Mohammed Ali <[email protected]>

* added middleware

---------

Co-authored-by: Phantom0110 <[email protected]>
Co-authored-by: Mohammed Ali <[email protected]>
Co-authored-by: AaronGibson2 <[email protected]>
Co-authored-by: h1divp <[email protected]>
Co-authored-by: AlexanderWangY <[email protected]>
AlexanderWangY added a commit that referenced this pull request Feb 25, 2024
* Made error case for email in use display correctly in front end

* Made error case for email in use display correctly in front end (#158)

* Cleaned up useEffect function #159

* Added testing pipeline (#175)

* Create main.yml

* Update main.yml

* Update _layout.tsx

* Update main.yml

* Update socketio.test.ts

* Update socketio.test.ts

* Update _layout.tsx

* User Context and User Type created and wrapped chat screen (#131)

* added user context

* Added userID and displayName

* moved user and display name generation into UserProvider

* Improved UserContext implementation

Amongst these changes, the user type on the frontend has been edited in order
to prevent hidden functions that would pull information into the UserContext
from other contexts. The message type was also modified to keep a new author
section with a displayName attribute. An issue should be created for a socket
API endpoint for grabbing the displayName, and one to set it in a connectedUser
document in the databse.

* updated package lock

---------

Co-authored-by: h1divp <[email protected]>

---------

Co-authored-by: Phantom0110 <[email protected]>
Co-authored-by: Mohammed Ali <[email protected]>
Co-authored-by: AaronGibson2 <[email protected]>
Co-authored-by: h1divp <[email protected]>
h1divp added a commit that referenced this pull request Feb 29, 2024
* Set up Firebase-Admin in adminInit.ts (#155)

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* added passport

* started auth + admin sdk

* removed passport

* added private key to gitignore

* Delete server/private_keys/private.json

---------

Co-authored-by: AlexanderWangY <[email protected]>

* Refactored most of the actions (#156)

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* added passport

* started auth + admin sdk

* removed passport

* added private key to gitignore

* Delete server/private_keys/private.json

* initializing firestore in admin

* finished most of action refactoring

* Made error case for email in use display correctly in front end (#158)

* changed getConnectedUsers to admin

* migrated to firebase-admin

---------

Co-authored-by: AlexanderWangY <[email protected]>
Co-authored-by: Mohammed Ali <[email protected]>

* Added JWT on top of Firebase-Admin (#178)

* Made error case for email in use display correctly in front end

* Made error case for email in use display correctly in front end (#158)

* Cleaned up useEffect function #159

* Added testing pipeline (#175)

* Create main.yml

* Update main.yml

* Update _layout.tsx

* Update main.yml

* Update socketio.test.ts

* Update socketio.test.ts

* Update _layout.tsx

* User Context and User Type created and wrapped chat screen (#131)

* added user context

* Added userID and displayName

* moved user and display name generation into UserProvider

* Improved UserContext implementation

Amongst these changes, the user type on the frontend has been edited in order
to prevent hidden functions that would pull information into the UserContext
from other contexts. The message type was also modified to keep a new author
section with a displayName attribute. An issue should be created for a socket
API endpoint for grabbing the displayName, and one to set it in a connectedUser
document in the databse.

* updated package lock

---------

Co-authored-by: h1divp <[email protected]>

* Set up Firebase-Admin in adminInit.ts (#155)

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* added passport

* started auth + admin sdk

* removed passport

* added private key to gitignore

* Delete server/private_keys/private.json

---------

Co-authored-by: AlexanderWangY <[email protected]>

* Refactored most of the actions (#156)

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* fixes pt2

* JWT WIP

* new branch + function fix

* small bug fixes

* added passport

* started auth + admin sdk

* removed passport

* added private key to gitignore

* Delete server/private_keys/private.json

* initializing firestore in admin

* finished most of action refactoring

* Made error case for email in use display correctly in front end (#158)

* changed getConnectedUsers to admin

* migrated to firebase-admin

---------

Co-authored-by: AlexanderWangY <[email protected]>
Co-authored-by: Mohammed Ali <[email protected]>

* added middleware

---------

Co-authored-by: Phantom0110 <[email protected]>
Co-authored-by: Mohammed Ali <[email protected]>
Co-authored-by: AaronGibson2 <[email protected]>
Co-authored-by: h1divp <[email protected]>
Co-authored-by: AlexanderWangY <[email protected]>

* Delete server/src/private_key/private.json

* Update main.yml

* Updated pipeline to reflect firebase-admin

* Update main.yml

* Update main.yml

* Create subdirectory before creating service account JSON (#187)

* Update socket tests (#185)

* Update socket tests

* Remove unused type

* Update comment in socketio.test.ts

---------

Co-authored-by: Phoenix <[email protected]>

* Create subdirectory before creating service account JSON

---------

Co-authored-by: Phoenix <[email protected]>

* made changes to collection name + socket test load testing

* Added socketIo.connect()

* Remade collection name changes

* updated location of firebase secrets, added comment about it in config_example.md

* renamed file to firebaseInit from adminInit

* Updated comment

---------

Co-authored-by: AlexanderWangY <[email protected]>
Co-authored-by: Mohammed Ali <[email protected]>
Co-authored-by: Phantom0110 <[email protected]>
Co-authored-by: AaronGibson2 <[email protected]>
Co-authored-by: h1divp <[email protected]>
Co-authored-by: Aadit Kamat <[email protected]>
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.

Make a User type and context
3 participants