-
Notifications
You must be signed in to change notification settings - Fork 119
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
Add memberlist right-panel to Hydrogen #395
Merged
Merged
Changes from all commits
Commits
Show all changes
106 commits
Select commit
Hold shift + click to select a range
69237fc
Basic barebones of memberlist view
MidhunSureshR 7e6e4ec
Duplicate navigation from room details
MidhunSureshR b74e445
Move rightpanel to separate view and vm
MidhunSureshR 7500bbe
Modify navigation to work with rightpanel segment
MidhunSureshR 8b01ca5
Create RightPanel from SessionViewModel
MidhunSureshR dfe7385
Accommodate "rightpanel" navigation segment
MidhunSureshR 1418645
Modify CSS to reflect changes
MidhunSureshR 46a6cf6
Add memberlist to navigation
MidhunSureshR f3c7ab3
Remove code from session view/vm
MidhunSureshR a765d7f
Create memberlist view from rightpanel
MidhunSureshR abd2c19
Remove unused param
MidhunSureshR 7e72d57
Make list scrollable
MidhunSureshR ddb7a16
Make member private
MidhunSureshR f7a6fbd
Make getUserLevel() public
MidhunSureshR cb5e598
Getter for powerlevel from room
MidhunSureshR 3e23392
Consider powerlevels in comparator and add tests
MidhunSureshR a9ff6ab
Sort memberlist using powerlevel
MidhunSureshR a1e3ff3
Use name instead of displayName
MidhunSureshR 2e8c456
Implement set method to support update from value
MidhunSureshR 11eb9c7
Use set instead of add in memberlist
MidhunSureshR 4fcaac3
Add binding in view
MidhunSureshR b62473a
Add update method
MidhunSureshR 0819dcb
Use MappedList instead of MappedMap
MidhunSureshR f41c835
Support updater in MappedMap
MidhunSureshR 404129f
Settle on MappedMap
MidhunSureshR dea0cad
Fix bug in FilteredMap
MidhunSureshR b8542c6
Implement name disambiguation
MidhunSureshR bcb46fc
Make tile vm support disambiguation
MidhunSureshR ef40027
Call disambiguate on update/map
MidhunSureshR 3d4ba20
Put up a temporary loading view
MidhunSureshR 86c1550
Switch to collator for perf reasons
MidhunSureshR 7139711
Add avatar to tile
MidhunSureshR 3fb89a8
Add some initial styling
MidhunSureshR d64d07a
Move loading view into separate file
MidhunSureshR bcfd1bd
Support loading view for all panels
MidhunSureshR e935423
Remove duplication in RightPanelViewModel
MidhunSureshR 3bb82e5
Disambiguator is not async
MidhunSureshR ab0a48a
rename rightpanel to right-panel
MidhunSureshR 41806b5
Remove duplication
MidhunSureshR ad6122a
Add explaining comment
MidhunSureshR da1e981
name changes
MidhunSureshR ea06d4f
Eliminate double lookup
MidhunSureshR 89e256e
Return array to prevent fetching again
MidhunSureshR 11d411c
Add failing test
MidhunSureshR 53fc6a7
Check prev name is string
MidhunSureshR db515d4
Inline flatten method
MidhunSureshR 35f6043
Support slice
MidhunSureshR 1d5b163
Export function
MidhunSureshR 0b9f4a5
Add LazyListView
MidhunSureshR ee07234
Switch to lazy list
MidhunSureshR 452eee6
Incorporate lazyrender code from element
MidhunSureshR f05574f
Fix updates
MidhunSureshR 96e2bb0
Add explaining comment
MidhunSureshR 9a00143
Improve comment
MidhunSureshR 4cb9adc
Remove misleading comment
MidhunSureshR 85924ab
Fix update method
MidhunSureshR 5338457
Use normalized index in recreateItem
MidhunSureshR d3a8e95
Find height of container from DOM
MidhunSureshR ea0851e
Keep memberlist panel open on room/grid change
MidhunSureshR f506cf6
div --> li
MidhunSureshR c539c38
Account for padding in itemHeight
MidhunSureshR d1f465e
Replace slice with iterator
MidhunSureshR 8a976ef
Make powerLevels observable
MidhunSureshR 22fab37
Remove timeline reader and only use roomState
MidhunSureshR 14c00f5
Make loadPowerLevels private
MidhunSureshR 8e39aed
Ensure that power levels are loaded only once
MidhunSureshR 2502c40
Fix broken tests
MidhunSureshR c073d4c
Unmount child views correctly
MidhunSureshR fe4f6d2
Remove listHasChangedSize
MidhunSureshR 8ee9cb1
Move css to layout.css
MidhunSureshR 72f79e8
Reduce padding
MidhunSureshR 8e55967
Create UI to open memberlist from details panel
MidhunSureshR 21f47f2
Add chevron to button
MidhunSureshR f98a884
Implement UX
MidhunSureshR b126ba1
Fix lazy list css
MidhunSureshR c7e12c9
Make addPanelIfNeeded more generic
MidhunSureshR be46d87
Center names
MidhunSureshR 5a54be2
Style loading view
MidhunSureshR 5873ab6
Release memberlist after panel is closed
MidhunSureshR e406aa6
Add jsdoc for powerlevels
MidhunSureshR 960f2c2
Remove comment
MidhunSureshR 6079379
Subscribe to powerLevels
MidhunSureshR 5c0c590
Move spinner before the text
MidhunSureshR fe18b61
Css fixes
MidhunSureshR c4c0e02
Clear margin on ul
MidhunSureshR 4bac98d
More css fixes
MidhunSureshR 9a3d7e4
Remove top padding of room details view
MidhunSureshR 0ac3d37
Remove TemplateView
MidhunSureshR da733f9
Move files to members directory
MidhunSureshR 1f67aa3
Move LoadingView.js
MidhunSureshR 694b627
Inline method
MidhunSureshR 4946683
Use ifView instead of mapView
MidhunSureshR c410aed
Use flex instead of setting height
MidhunSureshR ec8b6f9
Inline method
MidhunSureshR 611524c
Log instead of throwing error
MidhunSureshR 0e0976c
Inline method
MidhunSureshR 829830c
Fix lazylist
MidhunSureshR 0bd1d2b
Improve code
MidhunSureshR f366479
Fix move bug
MidhunSureshR 9fdfebf
Replace get with iterator and remove lambda
MidhunSureshR 66d5f4d
Make code clearer
MidhunSureshR ec4a783
Fix disambiguator
MidhunSureshR 436e875
Initialize prop in constructor
MidhunSureshR 86bb56a
Fix layout of details panel in mobile
MidhunSureshR 7c9755d
Fix width for smaller screens
MidhunSureshR 1a721fe
Import from AvatarView.js
MidhunSureshR File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import {ViewModel} from "../../ViewModel.js"; | ||
import {MemberTileViewModel} from "./MemberTileViewModel.js"; | ||
import {createMemberComparator} from "./members/comparator.js"; | ||
import {Disambiguator} from "./members/disambiguator.js"; | ||
|
||
export class MemberListViewModel extends ViewModel { | ||
constructor(options) { | ||
super(options); | ||
const list = options.members; | ||
this.track(() => list.release()); | ||
|
||
const powerLevelsObservable = options.powerLevelsObservable; | ||
this.track(powerLevelsObservable.subscribe(() => { /*resort based on new power levels here*/ })); | ||
|
||
const powerLevels = powerLevelsObservable.get(); | ||
this.memberTileViewModels = this._mapTileViewModels(list.members.filterValues(member => member.membership === "join")) | ||
.sortValues(createMemberComparator(powerLevels)); | ||
this.nameDisambiguator = new Disambiguator(); | ||
this.mediaRepository = options.mediaRepository; | ||
} | ||
|
||
get type() { return "member-list"; } | ||
|
||
get shouldShowBackButton() { return true; } | ||
|
||
get previousSegmentName() { return "details"; } | ||
|
||
_mapTileViewModels(members) { | ||
const mapper = (member, emitChange) => { | ||
const mediaRepository = this.mediaRepository; | ||
const vm = new MemberTileViewModel(this.childOptions({member, emitChange, mediaRepository})); | ||
this.nameDisambiguator.disambiguate(vm); | ||
return vm; | ||
} | ||
const updater = (vm, params, newMember) => { | ||
vm.updateFrom(newMember); | ||
this.nameDisambiguator.disambiguate(vm); | ||
}; | ||
return members.mapValues(mapper, updater); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import {ViewModel} from "../../ViewModel.js"; | ||
import {avatarInitials, getIdentifierColorNumber, getAvatarHttpUrl} from "../../avatar.js"; | ||
|
||
export class MemberTileViewModel extends ViewModel { | ||
constructor(options) { | ||
super(options); | ||
this._member = this._options.member; | ||
this._mediaRepository = options.mediaRepository | ||
this._previousName = null; | ||
this._nameChanged = true; | ||
} | ||
|
||
get name() { | ||
return `${this._member.name}${this._disambiguationPart}`; | ||
} | ||
|
||
get _disambiguationPart() { | ||
return this._disambiguate ? ` (${this.userId})` : ""; | ||
} | ||
|
||
get userId() { | ||
return this._member.userId; | ||
} | ||
|
||
get previousName() { | ||
return this._previousName; | ||
} | ||
|
||
get nameChanged() { | ||
return this._nameChanged; | ||
} | ||
|
||
_updatePreviousName(newName) { | ||
const currentName = this._member.name; | ||
if (currentName !== newName) { | ||
this._previousName = currentName; | ||
this._nameChanged = true; | ||
} else { | ||
this._nameChanged = false; | ||
} | ||
} | ||
|
||
setDisambiguation(status) { | ||
this._disambiguate = status; | ||
this.emitChange(); | ||
} | ||
|
||
updateFrom(newMember) { | ||
this._updatePreviousName(newMember.name); | ||
this._member = newMember; | ||
} | ||
|
||
get avatarLetter() { | ||
return avatarInitials(this.name); | ||
} | ||
|
||
get avatarColorNumber() { | ||
return getIdentifierColorNumber(this.userId) | ||
} | ||
|
||
avatarUrl(size) { | ||
return getAvatarHttpUrl(this._member.avatarUrl, size, this.platform, this._mediaRepository); | ||
} | ||
|
||
get avatarTitle() { | ||
return this.name; | ||
} | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed something here.
MappedMap
won't run the mapper inonRemove
. This will cause any user who leaves and rejoins a room to appear disambiguated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, can you check for this in the mapper when it is run in onAdd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed for now but there are related issues. For instance if user-A and user-B are disambiguated and user-B leaves the room, we'd ideally want user-A to be un-disambiguated (which we can't really do atm because the disambiguator does not get informed when user-B leaves).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, I think this is fine though for now.