-
-
Notifications
You must be signed in to change notification settings - Fork 671
Improved how muted streams are displayed on Streams screen #5522
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ import React from 'react'; | |
import type { Node } from 'react'; | ||
import type { TextStyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet'; | ||
|
||
import { IconMute, IconStream, IconPrivate, IconWebPublic } from '../common/Icons'; | ||
import { IconStream, IconPrivate, IconWebPublic } from '../common/Icons'; | ||
|
||
type Props = $ReadOnly<{| | ||
color?: string, | ||
|
@@ -15,12 +15,11 @@ type Props = $ReadOnly<{| | |
|}>; | ||
|
||
export default function StreamIcon(props: Props): Node { | ||
const { color, style, isPrivate, isMuted, isWebPublic, size } = props; | ||
const { color, style, isPrivate, isWebPublic, size } = props; | ||
|
||
let Component = undefined; | ||
if (isMuted) { | ||
Component = IconMute; | ||
} else if (isPrivate) { | ||
|
||
if (isPrivate) { | ||
Comment on lines
-21
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This component It should therefore go in its own commit, with a commit message that describes the changes it's making and why. That commit can come before the commit that changes the sorting. |
||
Component = IconPrivate; | ||
} else if (isWebPublic ?? false) { | ||
Component = IconWebPublic; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,8 @@ export default function SubscriptionsScreen(props: Props): Node { | |
.sort((a, b) => caseInsensitiveCompareFunc(a.name, b.name)); | ||
return [ | ||
{ key: 'Pinned', data: sortedSubscriptions.filter(x => x.pin_to_top) }, | ||
{ key: 'Unpinned', data: sortedSubscriptions.filter(x => !x.pin_to_top) }, | ||
{ key: 'Unpinned', data: sortedSubscriptions.filter(x => !x.pin_to_top && x.in_home_view) }, | ||
{ key: 'Muted', data: sortedSubscriptions.filter(x => !x.pin_to_top && !x.in_home_view) }, | ||
Comment on lines
61
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's avoid going through the list of subscriptions three times here. We can do it with just one pass, by using a plain old loop instead of That will also let us deduplicate the conditionals on With the old code it's a bit of a closer call between those advantages of a loop, and the declarative neatness of this Let's have one commit that's NFC (https://github.com/zulip/zulip-mobile/blob/main/docs/glossary.md#nfc ) and just changes the existing code to use a loop and make a single pass. Then a subsequent commit can make the substantive change here. |
||
]; | ||
}, [subscriptions]); | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.