diff --git a/src/lib.ts b/src/lib.ts index 7f4e5316..90bf597c 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -44,7 +44,7 @@ export {MissingAttachmentTile} from "./domain/session/room/timeline/tiles/Missin export {SimpleTile} from "./domain/session/room/timeline/tiles/SimpleTile.js"; export {TimelineView} from "./platform/web/ui/session/room/TimelineView"; -export {viewClassForEntry} from "./platform/web/ui/session/room/common"; +export {viewClassForTile} from "./platform/web/ui/session/room/common"; export type {TileViewConstructor, ViewClassForEntryFn} from "./platform/web/ui/session/room/TimelineView"; // export timeline tile views export {AnnouncementView} from "./platform/web/ui/session/room/timeline/AnnouncementView.js"; diff --git a/src/platform/web/ui/session/room/MessageComposer.js b/src/platform/web/ui/session/room/MessageComposer.js index 9c67fa9f..7f822d37 100644 --- a/src/platform/web/ui/session/room/MessageComposer.js +++ b/src/platform/web/ui/session/room/MessageComposer.js @@ -17,7 +17,7 @@ limitations under the License. import {TemplateView} from "../../general/TemplateView"; import {Popup} from "../../general/Popup.js"; import {Menu} from "../../general/Menu.js"; -import {viewClassForEntry} from "./common" +import {viewClassForTile} from "./common" export class MessageComposer extends TemplateView { constructor(viewModel) { @@ -45,7 +45,7 @@ export class MessageComposer extends TemplateView { this._focusInput = () => this._input.focus(); this.value.on("focus", this._focusInput); const replyPreview = t.map(vm => vm.replyViewModel, (rvm, t) => { - const View = rvm && viewClassForEntry(rvm); + const View = rvm && viewClassForTile(rvm); if (!View) { return null; } return t.div({ className: "MessageComposer_replyPreview" diff --git a/src/platform/web/ui/session/room/RoomView.js b/src/platform/web/ui/session/room/RoomView.js index 2190f1f1..961be704 100644 --- a/src/platform/web/ui/session/room/RoomView.js +++ b/src/platform/web/ui/session/room/RoomView.js @@ -23,7 +23,7 @@ import {TimelineLoadingView} from "./TimelineLoadingView.js"; import {MessageComposer} from "./MessageComposer.js"; import {RoomArchivedView} from "./RoomArchivedView.js"; import {AvatarView} from "../../AvatarView.js"; -import {viewClassForEntry} from "./common"; +import {viewClassForTile} from "./common"; export class RoomView extends TemplateView { constructor(options) { @@ -55,7 +55,7 @@ export class RoomView extends TemplateView { t.div({className: "RoomView_error"}, vm => vm.error), t.mapView(vm => vm.timelineViewModel, timelineViewModel => { return timelineViewModel ? - new TimelineView(timelineViewModel, viewClassForEntry) : + new TimelineView(timelineViewModel, viewClassForTile) : new TimelineLoadingView(vm); // vm is just needed for i18n }), t.view(bottomView), diff --git a/src/platform/web/ui/session/room/TimelineView.ts b/src/platform/web/ui/session/room/TimelineView.ts index 0c893847..6dd52466 100644 --- a/src/platform/web/ui/session/room/TimelineView.ts +++ b/src/platform/web/ui/session/room/TimelineView.ts @@ -61,7 +61,7 @@ export class TimelineView extends TemplateView { private tilesView?: TilesListView; private resizeObserver?: ResizeObserver; - constructor(vm: TimelineViewModel, private readonly viewClassForEntry: ViewClassForEntryFn) { + constructor(vm: TimelineViewModel, private readonly viewClassForTile: ViewClassForEntryFn) { super(vm); } @@ -71,7 +71,7 @@ export class TimelineView extends TemplateView { // do initial scroll positioning this.restoreScrollPosition(); }); - this.tilesView = new TilesListView(vm.tiles, () => this.restoreScrollPosition(), this.viewClassForEntry); + this.tilesView = new TilesListView(vm.tiles, () => this.restoreScrollPosition(), this.viewClassForTile); const root = t.div({className: "Timeline"}, [ t.div({ className: "Timeline_scroller bottom-aligned-scroll", @@ -184,12 +184,12 @@ class TilesListView extends ListView { private onChanged: () => void; - constructor(tiles: ObservableList, onChanged: () => void, private readonly viewClassForEntry: ViewClassForEntryFn) { + constructor(tiles: ObservableList, onChanged: () => void, private readonly viewClassForTile: ViewClassForEntryFn) { super({ list: tiles, onItemClick: (tileView, evt) => tileView.onClick(evt), }, entry => { - const View = viewClassForEntry(entry); + const View = viewClassForTile(entry); return new View(entry); }); this.onChanged = onChanged; @@ -202,7 +202,7 @@ class TilesListView extends ListView { onUpdate(index: number, value: SimpleTile, param: any) { if (param === "shape") { - const ExpectedClass = this.viewClassForEntry(value); + const ExpectedClass = this.viewClassForTile(value); const child = this.getChildInstanceByIndex(index); if (!ExpectedClass || !(child instanceof ExpectedClass)) { // shape was updated, so we need to recreate the tile view, diff --git a/src/platform/web/ui/session/room/common.ts b/src/platform/web/ui/session/room/common.ts index 201f14d0..7b62630f 100644 --- a/src/platform/web/ui/session/room/common.ts +++ b/src/platform/web/ui/session/room/common.ts @@ -26,7 +26,7 @@ import {SimpleTile} from "../../../../../domain/session/room/timeline/tiles/Simp import {GapView} from "./timeline/GapView.js"; import type {TileViewConstructor, ViewClassForEntryFn} from "./TimelineView"; -export function viewClassForEntry(vm: SimpleTile): TileViewConstructor { +export function viewClassForTile(vm: SimpleTile): TileViewConstructor { switch (vm.shape) { case "gap": return GapView; diff --git a/src/platform/web/ui/session/room/timeline/ReplyPreviewView.js b/src/platform/web/ui/session/room/timeline/ReplyPreviewView.js index 3c52fc71..bddcc8fe 100644 --- a/src/platform/web/ui/session/room/timeline/ReplyPreviewView.js +++ b/src/platform/web/ui/session/room/timeline/ReplyPreviewView.js @@ -16,11 +16,11 @@ limitations under the License. import {renderStaticAvatar} from "../../../avatar"; import {TemplateView} from "../../../general/TemplateView"; -import {viewClassForEntry} from "../common"; +import {viewClassForTile} from "../common"; export class ReplyPreviewView extends TemplateView { render(t, vm) { - const viewClass = viewClassForEntry(vm); + const viewClass = viewClassForTile(vm); if (!viewClass) { throw new Error(`Shape ${vm.shape} is unrecognized.`) }