mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
render avatar img in room list
This commit is contained in:
parent
cff39019cb
commit
00718c582a
@ -61,11 +61,23 @@ export class RoomTileViewModel extends ViewModel {
|
|||||||
return this._room.name;
|
return this._room.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
get avatarInitials() {
|
// Avatar view model contract
|
||||||
|
get avatarLetter() {
|
||||||
return avatarInitials(this._room.name);
|
return avatarInitials(this._room.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
get avatarColorNumber() {
|
get avatarColorNumber() {
|
||||||
return getIdentifierColorNumber(this._room.id)
|
return getIdentifierColorNumber(this._room.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get avatarUrl() {
|
||||||
|
if (this._room.avatarUrl) {
|
||||||
|
return this._room.mediaRepository.mxcUrlThumbnail(this._room.avatarUrl, 32, 32, "crop");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
get avatarTitle() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,6 +180,10 @@ export class Room extends EventEmitter {
|
|||||||
return this._roomId;
|
return this._roomId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get avatarUrl() {
|
||||||
|
return this._summary.avatarUrl;
|
||||||
|
}
|
||||||
|
|
||||||
/** @public */
|
/** @public */
|
||||||
async openTimeline() {
|
async openTimeline() {
|
||||||
if (this._timeline) {
|
if (this._timeline) {
|
||||||
|
@ -15,11 +15,12 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {TemplateView} from "../general/TemplateView.js";
|
import {TemplateView} from "../general/TemplateView.js";
|
||||||
|
import {renderAvatar} from "../common.js";
|
||||||
|
|
||||||
export class RoomTile extends TemplateView {
|
export class RoomTile extends TemplateView {
|
||||||
render(t, vm) {
|
render(t, vm) {
|
||||||
return t.li({"className": {"active": vm => vm.isOpen}}, [
|
return t.li({"className": {"active": vm => vm.isOpen}}, [
|
||||||
t.div({className: `avatar medium usercolor${vm.avatarColorNumber}`}, vm => vm.avatarInitials),
|
renderAvatar(t, vm, 32),
|
||||||
t.div({className: "description"}, t.div({className: "name"}, vm => vm.name))
|
t.div({className: "description"}, t.div({className: "name"}, vm => vm.name))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user