treebird/templates/chat.tt
nekobit 9917ac981e Reverse chat loop
FossilOrigin-Name: b408ab947f0ee6ceff7ff49d04022c5329fb4fba0f4e92581e41598c8c7e3a82
2022-08-18 02:54:33 +00:00

41 lines
1.5 KiB
Text

<div class="page-header">
<a href="/chats" class="page-header-button">&larr;</a>
<img src="[% chat.account.avatar %]" class="page-header-image avatar">
<a href="/@[% chat.account.acct %]" class="page-header-title">[% format_username(chat.account) %]</a>
</div>
<div class="chat-view">
[%# I can't quite say the below is fastest or could be done inline (one eval?),
not the fastest but it just works %]
[% revmessages = messages.reverse %]
[% FOREACH msg IN revmessages %]
<div class="message-container[% IF msg.account_id == ssn.account.id %] message-you[% END %]">
<img src="
[%- IF msg.account_id == ssn.account.id -%]
[% ssn.account.avatar %]
[%- ELSE -%]
[% chat.account.avatar %]
[%- END -%]
" class="avatar">
<div class="message-wrapper">
<div class="message" id="[% msg.id %]">
<span class="content">[% emojify(msg.content, msg.emojis) %]</span>
<span class="time">[% reltime(msg.created_at) %]</span>
</div>
</div>
</div>
[% END %]
<div class="anchor"></div>
</div>
<form action="" method="post">
<table class="chatbox ui-table">
<tr>
<td>
<textarea></textarea>
</td>
<td>
<input type="submit" class="chatbox-btn btn" value="Send">
</td>
</tr>
</table>
</form>