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

'my' context and user settings in mobile #256

Merged
merged 83 commits into from
Feb 21, 2025

Conversation

thomasgwatson
Copy link
Collaborator

See #254 for the goals of this branch.

@lorenjohnson I'm trying to treat each commit on this branch as a diff worth discussing.

First one in, want to get your feel on the brute force approach for my context nav out of the tab

Will next focus on making sure the various my context menu links work

@thomasgwatson thomasgwatson changed the title 'my' context and user 'my' context and user settings in mobile Feb 12, 2025
@thomasgwatson
Copy link
Collaborator Author

Ok, one piece of possible weirdness:

In the front end, we don't have the static groups. And the front-end basically treats my and all as the same entity. So similarly.... we should probably collapse those two down to the same static group?

@@ -77,7 +86,14 @@ export default function TabsNavigator () {
/>
<Tabs.Screen
name='Settings Tab'
component={UserSettingsTabsNavigator}
component={HomeNavigator} // it will never navigate to this but we need to pass a valid component here anyway
Copy link
Member

Choose a reason for hiding this comment

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

This looks fine by me for now.

@lorenjohnson
Copy link
Member

Ok, one piece of possible weirdness:

In the front end, we don't have the static groups. And the front-end basically treats my and all as the same entity. So similarly.... we should probably collapse those two down to the same static group?

By front-end you mean Web. How does it relate to things here? I am not making the connection, but I do hear that My and All are the same, or mostly the same target. I think if they are not actually the same then keeping them as their own targets it still good, and to share their common functionality through components they both use, vs blending the logic. However I'm speaking on abstractly and not entirely familiar with the patterns yet. My includes all of All though I think you were telling me? But still have an /all route?

@thomasgwatson
Copy link
Collaborator Author

So yeah...

Post new context menu; my has basically subsumed all of all routes... so now I'm wondering if we don't just go the whole way and change all references to all to my.

On web, at the moment, while the context part of their paths are still different, both the my and all paths end up with the same context menu. And obviously display different things in the main panel based on the rest of their paths.

Its probably more trouble to keep both all and my than it will be to tidy up the remainder of all references.

@tibetsprague would like you to add your perspective; do we really need to have the /all context?

@@ -72,7 +72,7 @@ export default function UserSettingsTabsNavigator ({ navigation, route }) {
})
}, [navigation, route])


console.log('does this get called? at alll?')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It doesn't, because the navigator isn't rendered

@@ -85,42 +85,42 @@ export default function UserSettingsTabsNavigator ({ navigation, route }) {
name='Edit Profile'
component={UserSettingsWebView}
initialParams={{
path: '/settings'
path: '/my/edit-profile'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was trying to navigate to these webviews with the existing structure and haven't figured it out. But do they even need a separate settings tab/navigator now? Could these screens just be moved over to the home navigator?

'/:groupSlug(all|public)/post/:id': `${AUTH_ROOT_SCREEN_NAME}/Drawer/Tabs/Home Tab/Post Details`,
'/:groupSlug(all|public)/post/:id/comments/:commentId': `${AUTH_ROOT_SCREEN_NAME}/Drawer/Tabs/Home Tab/Post Details`,
'/:groupSlug(all)/members/:id': `${AUTH_ROOT_SCREEN_NAME}/Drawer/Tabs/Home Tab/Member`,
'/:groupSlug(all)/topics/:topicName': `${AUTH_ROOT_SCREEN_NAME}/Drawer/Tabs/Home Tab/Stream`,
'/:groupSlug(all|public)/events': `${AUTH_ROOT_SCREEN_NAME}/Drawer/Tabs/Home Tab/Stream`,
'/:groupSlug(all|public)': `${AUTH_ROOT_SCREEN_NAME}/Drawer/Tabs/Home Tab/Stream`,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved this to the bottom, so other all/public paths wouldn't be eaten by this one first

Copy link
Member

Choose a reason for hiding this comment

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

Correct! Always be on the lookout for that, the logic can seem a little inverted if thinking it through. This is always the correct pattern though. The least specific things last.

'/:groupSlug(my)/blocked-users': `${AUTH_ROOT_SCREEN_NAME}/Drawer/Tabs/Settings Tab/Blocked Users`,
'/:groupSlug(my)/:section?': `${AUTH_ROOT_SCREEN_NAME}/Drawer/Tabs/Settings Tab/Edit Profile`,
// So, some user settings aren't explicitly linked, but I assume are avaiable because of this section wildcard.
// But ultimately everything just redirects to the `Edit Profile` screen.... so maybe none of the extra paths need to be here?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right?

@thomasgwatson
Copy link
Collaborator Author

@lorenjohnson

This is what openURL is translating the path to... and it looks right, as far as I can tell. But when its passed to return navigation.dispatch(actionForPath), it doesn't seem to do anything.

From the openURL debugging:
Screenshot 2025-02-13 at 3 32 08 PM

Got any ideas on what needs to be switched around here? Am I just barking up the wrong tree by trying to navigate to these screens after changing the path structure?

@thomasgwatson
Copy link
Collaborator Author

oooooooooo I have an idea....

I removed the Settings Tab from the Tabs navigator when I made the changes to the user avatar... will fiddle with that for a second

@thomasgwatson
Copy link
Collaborator Author

Ok, that kinda works. I'll keep playing with this when I get back from my break

@tibetsprague
Copy link
Collaborator

my perspective on /my and /all. The main reasons to keep /all are:

  1. To support old links that use /all.
  2. Because it becomes awkward to figure out the right URL to all posts across all your groups when it starts with /my. Would it be /my/all-group-posts? /my/all-group-events, etc? /all/posts is just cleaner and makes sense when you read it.

That being said I could be convinced to switch to /my for everything with a good proposal :)

@lorenjohnson
Copy link
Member

my perspective on /my and /all. The main reasons to keep /all are:

  1. To support old links that use /all.
  2. Because it becomes awkward to figure out the right URL to all posts across all your groups when it starts with /my. Would it be /my/all-group-posts? /my/all-group-events, etc? /all/posts is just cleaner and makes sense when you read it.

That being said I could be convinced to switch to /my for everything with a good proposal :)

/my/groups/stream ?

lorenjohnson and others added 27 commits February 20, 2025 08:58
…gging logging and comments, cleans-up some code
Make i18n-next instance (not config or translations) a shared module
…bile-LEJ

'my' context and user settings in mobile (LEJ)
@thomasgwatson thomasgwatson merged commit 0512d0d into dev Feb 21, 2025
1 of 3 checks passed
@thomasgwatson thomasgwatson deleted the 254-my-context+user-settings-mobile branch February 21, 2025 23:44
Copy link

sentry-io bot commented Feb 22, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ React ErrorBoundary TypeError: Cannot read property 'slug' of undefined ChatRoomWebView(/Users/lorenjohnson/dev/hylo/hy... View Issue

Did you find this useful? React with a 👍 or 👎

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

Successfully merging this pull request may close these issues.

3 participants