Support filtering Beatmap Discussion by multiple users#12939
Support filtering Beatmap Discussion by multiple users#12939notbakaneko wants to merge 21 commits into
Conversation
| @computed | ||
| private get visibleReplies() { | ||
| if (this.props.discussionsState == null | ||
| || this.props.discussionsState.selectedUserIds.size === 0 |
There was a problem hiding this comment.
there's an existing issue if the url param contains a user id that isn't in the discussions, I wonder if state initialization should sanitize and normalize the urls first 🤔
|
The floating bar seems like something people will be annoyed with as it takes up vertical space...? (and even worse on mobile) |
|
I did have an idea of adding the filters into the floating toolbar as a popup but that would have been a next step. Also realized the filter font sizes not shrinking down when the other tabbar sticky does looks odd... |
|
maybe a toggle button on the page tab bar? |
90631bb to
4491f7f
Compare
|
that looks weird and the expanded view takes even more space ಠ_ಠ it being still collapsed when scrolled up seems a bit pointless as well (and it should not be floating by default either?) |
|
I don't think stacking even more optionally pinable elements is the solution and looks even more weird, and having a toggle button in the tab bar that can also scroll sideways doesn't make sense either (and does nothing on the history tab). |
|
how about just not make it floatable/pinnable for now...? (also the new one cuts off the user list dropdown when it's too long instead of extending the page, although it really should just have its height limited and show scrollbar instead) |
|
Removing the pinning for now so the feature can go out while I try something else out, but that has some refactoring involved and may have additional changes that conflict |
There was a problem hiding this comment.
should be removed/renamed?
| text: ( | ||
| <> | ||
| <div className='osu-switch-v2'> | ||
| <input |
There was a problem hiding this comment.
input can't be inside an a
There was a problem hiding this comment.
I'm just removing the link instead of adding more workarounds for this, since it also doesn't seem to make sense to open in new tab with multi selection options.
There was a problem hiding this comment.
but button can't have input either ಠ_ಠ (and it just doesn't make sense if you think about it - like, are you checking the box or pressing the button)
even worse, div can't be inside button.
maybe add --checked, --checkbox modifiers to the class and use divs instead? It's not like the checkbox itself have much meaning in term of actual input.
1ad3908 to
d1b7209
Compare
| interface Props { | ||
| expand: boolean; | ||
| parentClass: string; | ||
| parentClass?: string; |
| <span className={`${bn}__checkmark`}> | ||
| {selected && <span className='fas fa-check' />} | ||
| </span> |
There was a problem hiding this comment.
technically can be done using the fa-fw class instead (className={`fa-fw ${selected ? ... }`}) although that'll ignore the decoration colour thing
but then again the --colour/--decoration-colour thing don't seem to be used anywhere at the moment...
| display: grid; | ||
| grid-template-columns: minmax(0, 500px) repeat(var(--num-columns), auto); |
There was a problem hiding this comment.
what does this do over just flex/row 🤔 (which would remove the need to specify the num-columns)
| 'user_filter' => [ | ||
| 'everyone' => 'Everyone', | ||
| 'label' => 'Filter by user', | ||
| 'multiple' => 'Multiple users selected', |
There was a problem hiding this comment.
I wonder if showing the selected count would be useful
| @@ -70,7 +70,9 @@ export default class DiscussionsState { | |||
| @observable repliesIncludeSelectedUsers = false; | |||
There was a problem hiding this comment.
already mentioned somewhere else but this addition should've also updated the user listing to include replying users
| .@{top}--beatmap-discussions & { | ||
| margin-right: 10px; | ||
| &--beatmap-discussions { | ||
| margin-right: 0; |
There was a problem hiding this comment.
or make it a variable and replace it in the block's modifier?
| if (reply.system) yield reply; | ||
| if (!this.props.discussionsState.showOtherReplies && !this.props.discussionsState.selectedUserIds.has(reply.user_id)) continue; | ||
| yield reply; |
There was a problem hiding this comment.
reply.system may end up being yielded twice
(also the only usage of this generator does ...thisGenerator() anyway so might as well return plain array instead?)
| </button> | ||
| <button | ||
| className={`${bn}__item ${bn}__item--link`} | ||
| onClick={this.toggleShowOtherReplies} |
There was a problem hiding this comment.
probably fine as is for now but it's kind of weird the checkbox options don't persist on reload/modify the url like the other filters in the same section
| return ( | ||
| <SelectOptions | ||
| href={this.props.discussionsState.url} | ||
| blackout={false} // css sticky elements render on a different stacking context and always get covered by the blackout. |
There was a problem hiding this comment.
the comment may get confusing without it being sticky
add more filtering options
fix at least 3 digits in counter box without resizing
flip positions of tabbar and toolbar (because of count contexts and stuff) also revert position of collapse/expand all since toolbar is not pinnable right now
d1b7209 to
bca7a3e
Compare
don't assume system post doesn't match other conditions
| export default function IconExpand({ expand = false, parentClass }: Props) { | ||
| return ( | ||
| <span className={`icon-stack ${parentClass}`}> | ||
| <span className={`icon-stack ${parentClass ?? ''}`}> |
| text: <span className='u-group-colour u-ellipsis-overflow' style={this.styleForUser(user)}>{user.username}</span>, | ||
| }; | ||
| }; | ||
|
|
There was a problem hiding this comment.
the spacing should probably stay
| return this.discussionsState.beatmapset.user_id; | ||
| } | ||
|
|
||
| // TODO: add actual multi user selection. |
There was a problem hiding this comment.
the comment can be removed?
| @media @desktop { | ||
| display: contents; | ||
| } |
| gap: 5px; | ||
| flex: none; | ||
|
|
||
| &--link { |
There was a problem hiding this comment.
all of them have this modifier? might as well make this the default and remove the modifier?
(also they are buttons...?)
| render() { | ||
| return ( | ||
| <> | ||
| <div className='beatmapset-discussions-toolbar'> |
There was a problem hiding this comment.
some others use bn variable, some others like this one use the name directly...
|
|
||
| render() { | ||
| return ( | ||
| <> |
There was a problem hiding this comment.
this wrapper doesn't do anything
| if (!canModeratePosts()) return null; | ||
|
|
||
| return ( | ||
| <button |
There was a problem hiding this comment.
extracting this button to its own component/function may be nice?

Filter by multiple users, include/exclude replies, hide/include replies from other users within the discussion.
Also moves the filters down to be next to the discussions closer with all the other sorting and filter options, and pins them to the top for easier access.
with a user selected:

I did think about putting all the usernames selected as the main dropdown text but it just gets long and truncated so I went with
Multiple users selectedinstead...closes #11666