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

Group pages in react #1220

Merged
merged 114 commits into from
Aug 20, 2024
Merged

Group pages in react #1220

merged 114 commits into from
Aug 20, 2024

Conversation

rravelli
Copy link
Contributor

@rravelli rravelli commented Jul 3, 2024

Description

⚠️ Disclaimer: way too big pull request... (my bad)

The purpose of this PR is to finally implement group pages in React.
The goal is not to implement all the features directly (event though I almost did it), but more to have the pages ready so that we can improve them later.

Changes

Integration of group pages in react.

  • group type page
  • group list page
  • group details page

Changed and added some APIs

  • social link
  • groups
  • membership

New features

  • New admin request tab. Group admins can now accept admin requests
  • My group section in home page

Removed

  • The subscribe feature won't be implemented in this PR
  • Seeing old members in the edit group modal is not possible

Fixed

  • Event & Group Preview image not showing properly
  • Fixed and improved infinite scroll (works on mobile now)
  • Fixed notification null constraint error when creating post/event

Screenshots

image
image

@hydrielax
Copy link
Member

hydrielax commented Jul 3, 2024

Ok I will not review your code, I'm too old for that but I would like to test it, can you deploy it on staging?

@hydrielax
Copy link
Member

For the "subscribers" option, my idea on this:

  • Keep the button "Subscribe" on the page group: it should be the same as subscribing to a page on instagram
  • Remove the "Member" button from the header of the group page to avoid confusion => you can only add yourself as member from the member tab

@rravelli
Copy link
Contributor Author

rravelli commented Jul 3, 2024

Ok I will not review your code, I'm too old for that but I would like to test it, can you deploy it on staging?

It is deployed but there is a 404 on the pages.
I don't know if it's a pipeline issue or actually my code but didn't have the time to check

@rravelli rravelli force-pushed the group-page branch 3 times, most recently from 936526b to 91c3d24 Compare July 11, 2024 13:11
@rravelli rravelli changed the title Group pages in react [WIP] Group pages in react Jul 13, 2024
@rravelli rravelli marked this pull request as ready for review July 22, 2024 09:39
backend/apps/group/api_views.py Outdated Show resolved Hide resolved
backend/apps/group/api_views.py Outdated Show resolved Hide resolved
backend/apps/group/api_views.py Outdated Show resolved Hide resolved
backend/apps/group/api_views.py Outdated Show resolved Hide resolved
backend/apps/group/api_views.py Outdated Show resolved Hide resolved
groupTypes?.results.map((groupType) => ({
queryFn: () =>
getGroupListApi({ type: groupType.slug, pageSize: PAGE_SIZE }),
queryKey: ['getGroupList', groupType.slug, isAuthenticated],
Copy link
Member

Choose a reason for hiding this comment

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

No need for isAuthenticated in the key

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah bon ? Pourtant les groupes dépendent si l'utilisateur est connecté ou non.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, mais lorsque l'utilisateur se déconnecte le cache de toutes les requêtes est censé être effacé par sécurité (queryClient.clear()) donc c'est inutile de l'ajouter dans la key d'une requêtes (sinon il faudrait ajouter isAuthenticated dans toutes les requêtes vu qu'elles ont toutes une réponse différente si on est connecté ou pas)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

D'accord mais le problème persiste dans la situation inverse où l'utilisateur se connecte, les queries de groupe deviennent alors invalides.
Alors

  • soit on clear le cache à la connexion et deconnexion
  • soit on le fait uniquement à la deconnexion et on garde les query key isAuthenticated, ce qui est selon moi est une solution bien plus lisible et pas trop coûteuse parce que ça représente pas beaucoup de requêtes. Ca nous permet également de choisir quelle requête refetch lors de la connexion plûtot que de tout supprimer d'un coup...

Copy link
Member

Choose a reason for hiding this comment

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

Ok je vois, mais je serais plus pour la première solution perso. Je trouve ça plus robuste pour l'avenir : si jamais on oublie d'ajouter la key isAuthenticated sur des requêtes ça pourrait créer des bugs, donc autant s'assurer de tout refetch. Et vu que ya aucune requête (je crois) où on souhaite conserver le cache après la connexion (je vois pas d'exemple où on aurait le même résultat), autant prendre la solution la plus simple

frontend/src/pages/GroupDetails/GroupDetails.page.tsx Outdated Show resolved Hide resolved
frontend/src/pages/GroupDetails/hooks/useGroupChildren.ts Outdated Show resolved Hide resolved
frontend/src/pages/Home/views/section/MyGroupsSection.tsx Outdated Show resolved Hide resolved
@hydrielax
Copy link
Member

Pour avoir une belle grille pour les groupes (je sais plus si c'était fix) : https://youtu.be/3T0gjtXRNC0?si=jfPuEkP0yzJ8G5z4

@rravelli
Copy link
Contributor Author

Pour avoir une belle grille pour les groupes (je sais plus si c'était fix) : https://youtu.be/3T0gjtXRNC0?si=jfPuEkP0yzJ8G5z4

On utilise les Grid de MUI on a jamais eu de problème avec ça non ?

Copy link

Copy link

@rravelli rravelli merged commit 20b093e into master Aug 20, 2024
14 of 15 checks passed
@rravelli rravelli deleted the group-page branch August 23, 2024 19:50
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.

2 participants