mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Inline methods
This commit is contained in:
parent
273c44424f
commit
086e0c0320
@ -20,27 +20,23 @@ import {viewClassForEntry} from "../common";
|
|||||||
|
|
||||||
export class ReplyPreviewView extends TemplateView {
|
export class ReplyPreviewView extends TemplateView {
|
||||||
render(t, vm) {
|
render(t, vm) {
|
||||||
return t.div({ className: "ReplyPreviewView" }, this._renderReplyPreview(t, vm));
|
|
||||||
}
|
|
||||||
|
|
||||||
_renderReplyPreview(t, vm) {
|
|
||||||
const viewClass = viewClassForEntry(vm);
|
const viewClass = viewClassForEntry(vm);
|
||||||
const view = new viewClass(vm, { reply: true, interactive: false });
|
if (!viewClass) {
|
||||||
if (!view) {
|
|
||||||
throw new Error(`Shape ${vm.shape} is unrecognized.`)
|
throw new Error(`Shape ${vm.shape} is unrecognized.`)
|
||||||
}
|
}
|
||||||
const rendered = t.view(view);
|
const view = new viewClass(vm, { reply: true, interactive: false });
|
||||||
return this._renderReplyHeader(t, vm, [rendered]);
|
return t.div(
|
||||||
}
|
{ className: "ReplyPreviewView" },
|
||||||
|
t.blockquote([
|
||||||
_renderReplyHeader(t, vm, children = []) {
|
t.a({ className: "link", href: vm.permaLink }, "In reply to"),
|
||||||
return t.blockquote(
|
t.a({ className: "pill", href: vm.senderProfileLink }, [
|
||||||
[
|
renderStaticAvatar(vm, 12, undefined, true),
|
||||||
t.a({ className: "link", href: vm.permaLink }, "In reply to"),
|
vm.displayName,
|
||||||
t.a({ className: "pill", href: vm.senderProfileLink }, [renderStaticAvatar(vm, 12, undefined, true), vm.displayName]),
|
]),
|
||||||
t.br(),
|
t.br(),
|
||||||
...children
|
t.view(view),
|
||||||
]);
|
])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user