group previews: fix go to groups button #4206
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes TLON-3007
This was happening because weren't passing an
onGroupAction
function to the GroupPreviewSheet from the user profile.onGroupAction
was set as an optional prop, which seems like a mistake, so I made it not optional.After setting it as not optional, I found that we were pulling the GroupPreviewSheet into ContentReference unnecessarily (rather than using some local state for control and rendering the sheet there, we can just use the GroupPreviewSheet that's already rendered in the Channel view and PostScreenView and use the existing onPressGroupRef method in the navigation context).
I also noticed that we were navigating users directly to the
lastChannel
of a group when going to a group, which seems like it might not be what users expect here, so instead I've got thegoTo
action setup to reset the navigation stack to the GroupChannelsScreen for that particular group.I also added a new eslint rule to catch any instance where we're accidentally importing from
packages/*
and some lint scripts to theapp
package.Copilot description:
This pull request includes several changes to enhance group action handling and improve code quality in the project. The most important changes include adding group action handling in
ChatListScreen
andUserProfileScreen
, updating the group navigation logic, and introducing new linting scripts.Enhancements to group action handling:
packages/app/features/top/ChatListScreen.tsx
: AddedhandleGroupAction
function and integrated it withGroupPreviewSheet
to handle group actions. [1] [2] [3]packages/app/features/top/UserProfileScreen.tsx
: AddedhandleGroupAction
function and integrated it withGroupPreviewSheet
to handle group actions. [1] [2] [3]Updates to group navigation logic:
packages/app/hooks/useGroupActions.tsx
: UpdatedperformGroupAction
to usegoToGroupChannels
instead ofgoToChannel
.packages/app/hooks/useGroupNavigation.ts
: AddedgoToGroupChannels
function to navigate to group channels. [1] [2]packages/app/navigation/utils.ts
: AddeduseResetToGroup
function to reset navigation to group channels.Code quality improvements:
.eslintrc.cjs
: Added a rule to prevent direct imports from the "packages" directory.packages/app/package.json
: Added new linting scripts for code quality checks.These changes collectively improve the handling of group actions and ensure better code quality and maintainability.