mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-10 20:17:32 +01:00
Render static avatar
This commit is contained in:
parent
540aa6c546
commit
d6233e7c77
@ -17,7 +17,7 @@ limitations under the License.
|
|||||||
import {BaseMessageTile} from "./BaseMessageTile.js";
|
import {BaseMessageTile} from "./BaseMessageTile.js";
|
||||||
import {stringAsBody} from "../MessageBody.js";
|
import {stringAsBody} from "../MessageBody.js";
|
||||||
import {createEnum} from "../../../../../utils/enum";
|
import {createEnum} from "../../../../../utils/enum";
|
||||||
import {avatarInitials, getIdentifierColorNumber} from "../../../../avatar.js";
|
import {avatarInitials, getAvatarHttpUrl, getIdentifierColorNumber} from "../../../../avatar.js";
|
||||||
|
|
||||||
export const BodyFormat = createEnum("Plain", "Html");
|
export const BodyFormat = createEnum("Plain", "Html");
|
||||||
|
|
||||||
@ -70,9 +70,9 @@ export class BaseTextTile extends BaseMessageTile {
|
|||||||
body: this._parseBody(body, format),
|
body: this._parseBody(body, format),
|
||||||
sender: entry.displayName,
|
sender: entry.displayName,
|
||||||
avatar: {
|
avatar: {
|
||||||
colorNumber: getIdentifierColorNumber(entry.sender),
|
avatarColorNumber: getIdentifierColorNumber(entry.sender),
|
||||||
initial: avatarInitials(entry.displayName),
|
avatarLetter: avatarInitials(entry.displayName),
|
||||||
avatarUrl: entry.avatarUrl
|
avatarUrl: (size) => getAvatarHttpUrl(entry.avatarUrl, size, this.platform, this._mediaRepository)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { renderStaticAvatar } from "../../../avatar";
|
||||||
import {tag, text} from "../../../general/html";
|
import {tag, text} from "../../../general/html";
|
||||||
import {BaseMessageView} from "./BaseMessageView.js";
|
import {BaseMessageView} from "./BaseMessageView.js";
|
||||||
|
|
||||||
@ -39,9 +40,9 @@ export class TextMessageView extends BaseMessageView {
|
|||||||
if (!body) {
|
if (!body) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const replyContainer = t.blockquote([
|
const replyContainer = tag.blockquote([
|
||||||
t.a({ className: "link", href: "#" }, "In reply to"),
|
tag.a({ className: "link", href: "#" }, "In reply to"),
|
||||||
t.a({ className: "pill", href: "#" }, [tag.div({class: `avatar size-12 usercolor${avatar.colorNumber}`}, text(avatar.initial)), sender]), t.br()]);
|
tag.a({ className: "pill", href: "#" }, [renderStaticAvatar(avatar, 12), sender]), tag.br()]);
|
||||||
for (const part of body.parts) {
|
for (const part of body.parts) {
|
||||||
replyContainer.appendChild(renderPart(part));
|
replyContainer.appendChild(renderPart(part));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user