Skip to content

Add Territory Sub management tab in Subscriptions #2191

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

brymut
Copy link
Contributor

@brymut brymut commented May 29, 2025

Description

Add Territory sub management in the 'subscriptions' tab in the settings page with a dropdown to switch between stackers & territories. With dropdown menu to unsubscribe from & mute territory.

Closes #1409

Screenshots

Desktop

Screen.Recording.2025-06-03.at.10.00.11.mov

Mobile

Screen.Recording.2025-06-03.at.10.03.42.mov

Additional Context

Was anything unclear during your work on this PR? Anything we should definitely take a closer look at?

Checklist

Are your changes backwards compatible? Please answer below:
Y

On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
10

For frontend changes: Tested on mobile, light and dark mode? Please answer below:
Y

Did you introduce any new environment variables? If so, call them out explicitly here:
No

@Soxasora
Copy link
Member

Hi brymut, I see you're working on this enhancement/feature.
I wanted to give you a tip to avoid linting problems, we have a Development Tips section that also contains tips for linting, such as using the StandardJS VSCode Extension to lint as you code. Take a look! ^^

@brymut
Copy link
Contributor Author

brymut commented May 30, 2025

Thanks for the tip @Soxasora, its still a very rough solution. I just decided to push since I had to move on to something else at the time

@brymut brymut force-pushed the feat/territory-subscriptions branch 3 times, most recently from 88c2832 to ffe7be8 Compare June 3, 2025 06:48
@brymut brymut marked this pull request as ready for review June 3, 2025 07:08
@brymut brymut requested review from huumn and ekzyis June 3, 2025 07:08
Copy link
Member

@huumn huumn left a comment

Choose a reason for hiding this comment

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

two changes needed

Comment on lines 12 to 23
export const getServerSideProps = async (ctx) => {
const [userRes, subsRes] = await Promise.all([
getGetServerSideProps({ query: MY_SUBSCRIBED_USERS, authRequired: true })(ctx),
getGetServerSideProps({ query: MY_SUBSCRIBED_SUBS, authRequired: true })(ctx)
])
return {
props: {
ssrUsers: userRes.props.ssrData,
ssrSubs: subsRes.props.ssrData
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm surprised this worked.

The move here is to make a compound graphql query like USER_WITH_ITEMS or make this into different .js files to call each query only when it is needed like we do for /top path.


export default function MySubscribedUsers ({ ssrData }) {
export default function MySubscribedUsers ({ ssrUsers, ssrSubs }) {
const [view, setView] = useState('stackers')
const subscribeUserContextValue = useMemo(() => ({ refetchQueries: ['MySubscribedUsers'] }), [])
Copy link
Member

Choose a reason for hiding this comment

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

This refetchQueries pattern should be used for territory subscriptions too.

@brymut brymut force-pushed the feat/territory-subscriptions branch 2 times, most recently from 87b6571 to 395375b Compare June 9, 2025 17:54
@brymut brymut requested a review from huumn June 9, 2025 17:55
@brymut brymut force-pushed the feat/territory-subscriptions branch from 395375b to 42f3d87 Compare June 9, 2025 18:02
@brymut
Copy link
Contributor Author

brymut commented Jun 9, 2025

two changes needed

Addressed

@brymut brymut force-pushed the feat/territory-subscriptions branch from 5aa762d to c1994b1 Compare June 10, 2025 08:10
@brymut brymut force-pushed the feat/territory-subscriptions branch from c1994b1 to abc5f72 Compare June 10, 2025 08:11
Copy link
Member

@huumn huumn left a comment

Choose a reason for hiding this comment

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

I fixed an number of things in this PR, some of them subjective, some of them bugs (like extra separators), then I encountered this dropdown bug.

The action dropdown works on the subscriptions territory page, but:

  1. it's still there when logged out (logged out user can't subscribe/mute)
  2. on the /top/territories/forever it thinks I'm not subscribed to any territories
  3. same as (2) on /<user nym>/territories

Comment on lines +81 to +84
<ActionDropdown>
<ToggleSubSubscriptionDropdownItem sub={sub} />
<MuteSubDropdownItem sub={sub} />
</ActionDropdown>
Copy link
Member

Choose a reason for hiding this comment

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

There are several pages with territory lists that this does not work on.

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.

Territory subscription management UI
3 participants