summaryrefslogtreecommitdiff
path: root/ui/lib
diff options
context:
space:
mode:
Diffstat (limited to 'ui/lib')
-rw-r--r--ui/lib/components/Message.svelte5
-rw-r--r--ui/lib/outbox.svelte.js2
-rw-r--r--ui/lib/session.svelte.js6
-rw-r--r--ui/lib/state/remote/messages.svelte.js5
4 files changed, 7 insertions, 11 deletions
diff --git a/ui/lib/components/Message.svelte b/ui/lib/components/Message.svelte
index 4c6979e..6dbd7b2 100644
--- a/ui/lib/components/Message.svelte
+++ b/ui/lib/components/Message.svelte
@@ -1,16 +1,19 @@
<script>
import { DateTime } from 'luxon';
+ import { render } from '$lib/markdown.js';
+
let {
class: cssClass,
id,
at,
- renderedBody,
+ body,
editable = false,
deleteMessage = async (id) => {},
} = $props();
let deleteArmed = $state(false);
let atFormatted = $derived(at.toLocaleString(DateTime.DATETIME_SHORT));
+ let renderedBody = $derived(render(body));
function ondelete(event) {
event.preventDefault();
diff --git a/ui/lib/outbox.svelte.js b/ui/lib/outbox.svelte.js
index c4e2324..74f41bc 100644
--- a/ui/lib/outbox.svelte.js
+++ b/ui/lib/outbox.svelte.js
@@ -9,7 +9,6 @@ class SendToConversation {
this.conversation = conversation;
this.body = body;
this.at = DateTime.now();
- this.renderedBody = md.render(body);
}
toSkeleton(sender) {
@@ -19,7 +18,6 @@ class SendToConversation {
conversation: this.conversation,
sender,
body: this.body,
- renderedBody: this.renderedBody,
};
}
diff --git a/ui/lib/session.svelte.js b/ui/lib/session.svelte.js
index 4430e8a..42b86f0 100644
--- a/ui/lib/session.svelte.js
+++ b/ui/lib/session.svelte.js
@@ -29,24 +29,22 @@ class Conversation {
}
class Message {
- static fromRemote({ id, at, conversation, sender, body, renderedBody }, users) {
+ static fromRemote({ id, at, conversation, sender, body }, users) {
return new Message({
id,
at,
conversation,
sender: users.get(sender),
body,
- renderedBody,
});
}
- constructor({ id, at, conversation, sender, body, renderedBody }) {
+ constructor({ id, at, conversation, sender, body }) {
this.id = id;
this.at = at;
this.conversation = conversation;
this.sender = sender;
this.body = body;
- this.renderedBody = renderedBody;
}
}
diff --git a/ui/lib/state/remote/messages.svelte.js b/ui/lib/state/remote/messages.svelte.js
index 852f29e..10de27a 100644
--- a/ui/lib/state/remote/messages.svelte.js
+++ b/ui/lib/state/remote/messages.svelte.js
@@ -1,5 +1,4 @@
import { DateTime } from 'luxon';
-import { render } from '$lib/markdown.js';
class Message {
static boot({ id, at, conversation, sender, body }) {
@@ -9,17 +8,15 @@ class Message {
conversation,
sender,
body,
- renderedBody: render(body),
});
}
- constructor({ id, at, conversation, sender, body, renderedBody }) {
+ constructor({ id, at, conversation, sender, body }) {
this.id = id;
this.at = at;
this.conversation = conversation;
this.sender = sender;
this.body = body;
- this.renderedBody = renderedBody;
}
}