summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/lib/apiServer.js8
-rw-r--r--ui/lib/components/Message.svelte6
-rw-r--r--ui/lib/components/MessageInput.svelte2
-rw-r--r--ui/lib/iterator.test.js18
-rw-r--r--ui/lib/markdown.js6
-rw-r--r--ui/lib/markdown.test.js10
-rw-r--r--ui/lib/outbox.svelte.js2
-rw-r--r--ui/lib/runs.js2
-rw-r--r--ui/lib/session.svelte.js12
-rw-r--r--ui/lib/state/local/channels.svelte.js10
-rw-r--r--ui/lib/state/remote/channels.svelte.js2
-rw-r--r--ui/lib/state/remote/messages.svelte.js2
-rw-r--r--ui/lib/state/remote/state.svelte.js2
-rw-r--r--ui/routes/(app)/+layout.js2
-rw-r--r--ui/routes/(app)/ch/[channel]/+page.svelte6
-rw-r--r--ui/routes/(login)/invite/[invite]/+page.js2
-rw-r--r--ui/routes/+layout.svelte2
-rw-r--r--ui/service-worker.js2
-rw-r--r--ui/tests/lib/components/ChangePassword.svelte.test.js4
-rw-r--r--ui/tests/lib/components/CreateChannelForm.svelte.test.js4
-rw-r--r--ui/tests/lib/components/LogIn.svelte.test.js6
-rw-r--r--ui/tests/lib/components/MessageInput.svelte.test.js4
22 files changed, 57 insertions, 57 deletions
diff --git a/ui/lib/apiServer.js b/ui/lib/apiServer.js
index e682681..397638c 100644
--- a/ui/lib/apiServer.js
+++ b/ui/lib/apiServer.js
@@ -4,7 +4,7 @@ import * as r from './retry.js';
import { timedDelay } from './retry.js';
export const apiServer = axios.create({
- baseURL: '/api/'
+ baseURL: '/api/',
});
export async function boot() {
@@ -51,7 +51,7 @@ export async function acceptInvite(inviteId, name, password) {
return apiServer
.post(`/invite/${inviteId}`, {
name,
- password
+ password,
})
.catch(responseError);
}
@@ -60,8 +60,8 @@ export function subscribeToEvents(resumePoint) {
const eventsUrl = apiServer.getUri({
url: '/events',
params: {
- resume_point: resumePoint
- }
+ resume_point: resumePoint,
+ },
});
return new EventSource(eventsUrl);
}
diff --git a/ui/lib/components/Message.svelte b/ui/lib/components/Message.svelte
index 5d15d17..74cb2be 100644
--- a/ui/lib/components/Message.svelte
+++ b/ui/lib/components/Message.svelte
@@ -8,7 +8,7 @@
body,
renderedBody,
editable = false,
- deleteMessage = async (id) => {}
+ deleteMessage = async (id) => {},
} = $props();
let deleteArmed = $state(false);
let atFormatted = $derived(at.toLocaleString(DateTime.DATETIME_SHORT));
@@ -32,9 +32,9 @@
class={[
'message',
{
- ['delete-armed']: deleteArmed
+ ['delete-armed']: deleteArmed,
},
- cssClass
+ cssClass,
]}
role="article"
data-at={at}
diff --git a/ui/lib/components/MessageInput.svelte b/ui/lib/components/MessageInput.svelte
index 30038c6..77c39be 100644
--- a/ui/lib/components/MessageInput.svelte
+++ b/ui/lib/components/MessageInput.svelte
@@ -53,7 +53,7 @@
contenteditable="plaintext-only"
class={{
textarea: true,
- disabled
+ disabled,
}}
bind:innerText={value}
{onkeydown}
diff --git a/ui/lib/iterator.test.js b/ui/lib/iterator.test.js
index 4c55358..2189da1 100644
--- a/ui/lib/iterator.test.js
+++ b/ui/lib/iterator.test.js
@@ -25,7 +25,7 @@ describe('chunkBy', async () => {
const chunks = iter.chunkBy(
[],
(val) => val,
- (last, next) => last === next
+ (last, next) => last === next,
);
expect(Array.from(chunks)).toStrictEqual([]);
@@ -35,7 +35,7 @@ describe('chunkBy', async () => {
const chunks = iter.chunkBy(
[37],
(val) => val,
- (last, next) => last === next
+ (last, next) => last === next,
);
expect(Array.from(chunks)).toStrictEqual([{ key: 37, chunk: [37] }]);
@@ -45,7 +45,7 @@ describe('chunkBy', async () => {
const chunks = iter.chunkBy(
[37, 37, 28, 37],
(val) => val,
- (last, next) => last === next
+ (last, next) => last === next,
);
expect(Array.from(chunks)).toStrictEqual([
@@ -53,8 +53,8 @@ describe('chunkBy', async () => {
{ key: 28, chunk: [28] },
{
key: 37,
- chunk: [37]
- }
+ chunk: [37],
+ },
]);
});
});
@@ -64,13 +64,13 @@ describe('chunkBy', async () => {
const chunks = iter.chunkBy(
[37, 37, 28, 37],
(val) => val >> 1,
- (last, next) => last === next
+ (last, next) => last === next,
);
expect(Array.from(chunks)).toStrictEqual([
{ key: 18, chunk: [37, 37] },
{ key: 14, chunk: [28] },
- { key: 18, chunk: [37] }
+ { key: 18, chunk: [37] },
]);
});
});
@@ -80,13 +80,13 @@ describe('chunkBy', async () => {
const chunks = iter.chunkBy(
[36, 37, 28, 29, 30, 38],
(val) => val,
- (last, next) => last + 1 === next
+ (last, next) => last + 1 === next,
);
expect(Array.from(chunks)).toStrictEqual([
{ key: 37, chunk: [36, 37] },
{ key: 30, chunk: [28, 29, 30] },
- { key: 38, chunk: [38] }
+ { key: 38, chunk: [38] },
]);
});
});
diff --git a/ui/lib/markdown.js b/ui/lib/markdown.js
index 6caf80b..3f58176 100644
--- a/ui/lib/markdown.js
+++ b/ui/lib/markdown.js
@@ -12,8 +12,8 @@ const extension = {
rel="noreferrer"
${titleAttr}
href="${href}">${text}</a>`;
- }
- }
+ },
+ },
};
marked.use(extension);
@@ -21,6 +21,6 @@ marked.use(extension);
export function render(body) {
const rendered = marked.parse(body, { breaks: true });
return DOMPurify.sanitize(rendered, {
- ADD_ATTR: ['target']
+ ADD_ATTR: ['target'],
});
}
diff --git a/ui/lib/markdown.test.js b/ui/lib/markdown.test.js
index 126eacd..7aa10b1 100644
--- a/ui/lib/markdown.test.js
+++ b/ui/lib/markdown.test.js
@@ -7,7 +7,7 @@ describe('render', async () => {
const html = md.render(markdown);
expect(html).toStrictEqual(
`<p><a href="https://example.com?foo=bar" rel="noreferrer" target="_blank">a link</a></p>
-`
+`,
);
});
@@ -16,7 +16,7 @@ describe('render', async () => {
const html = md.render(markdown);
expect(html).toStrictEqual(
`<p><a href="https://example.com?foo=bar" title="what title" rel="noreferrer" target="_blank">a link</a></p>
-`
+`,
);
});
@@ -28,7 +28,7 @@ describe('render', async () => {
const html = md.render(markdown);
expect(html).toStrictEqual(
`<p><a href="https://example.com?foo=bar" rel="noreferrer" target="_blank">a link</a></p>
-`
+`,
);
});
@@ -40,7 +40,7 @@ describe('render', async () => {
const html = md.render(markdown);
expect(html).toStrictEqual(
`<p><a href="https://example.com?foo=bar" title="what title" rel="noreferrer" target="_blank">a link</a></p>
-`
+`,
);
});
@@ -49,7 +49,7 @@ describe('render', async () => {
const html = md.render(markdown);
expect(html).toStrictEqual(
`<p><a href="https://example.com?foo=bar" rel="noreferrer" target="_blank">a <em>link</em></a></p>
-`
+`,
);
});
});
diff --git a/ui/lib/outbox.svelte.js b/ui/lib/outbox.svelte.js
index 472c58b..183f8ff 100644
--- a/ui/lib/outbox.svelte.js
+++ b/ui/lib/outbox.svelte.js
@@ -19,7 +19,7 @@ class PostToChannel {
channel: this.channel,
sender,
body: this.body,
- renderedBody: this.renderedBody
+ renderedBody: this.renderedBody,
};
}
diff --git a/ui/lib/runs.js b/ui/lib/runs.js
index de00e6a..e020da3 100644
--- a/ui/lib/runs.js
+++ b/ui/lib/runs.js
@@ -13,7 +13,7 @@ function summarizeRun(self, { key, chunk }) {
return {
sender: sender.name,
ownMessage: sender.id === self.id,
- messages: chunk
+ messages: chunk,
};
}
diff --git a/ui/lib/session.svelte.js b/ui/lib/session.svelte.js
index 432fad2..d742dbe 100644
--- a/ui/lib/session.svelte.js
+++ b/ui/lib/session.svelte.js
@@ -36,7 +36,7 @@ class Message {
channel,
sender: users.get(sender),
body,
- renderedBody
+ renderedBody,
});
}
@@ -56,12 +56,12 @@ class Session {
currentUser = $derived(this.remote.currentUser);
users = $derived(this.remote.users.all);
messages = $derived(
- this.remote.messages.all.map((message) => Message.fromRemote(message, this.users))
+ this.remote.messages.all.map((message) => Message.fromRemote(message, this.users)),
);
channels = $derived(
this.remote.channels.all.map((channel) =>
- Channel.fromRemote(channel, this.messages, this.local.all)
- )
+ Channel.fromRemote(channel, this.messages, this.local.all),
+ ),
);
static boot({ user, users, channels, messages, resume_point, heartbeat }) {
@@ -71,7 +71,7 @@ class Session {
channels,
messages,
resumePoint: resume_point,
- heartbeat
+ heartbeat,
});
const local = l.Channels.fromLocalStorage();
return new Session(remote, local);
@@ -84,7 +84,7 @@ class Session {
channels,
messages,
resumePoint: resume_point,
- heartbeat
+ heartbeat,
});
}
diff --git a/ui/lib/state/local/channels.svelte.js b/ui/lib/state/local/channels.svelte.js
index e3ee8df..669aa1e 100644
--- a/ui/lib/state/local/channels.svelte.js
+++ b/ui/lib/state/local/channels.svelte.js
@@ -14,7 +14,7 @@ class Channel {
return new Channel({
draft,
lastReadAt: lastReadAt == null ? null : DateTime.fromISO(lastReadAt),
- scrollPosition
+ scrollPosition,
});
}
@@ -29,7 +29,7 @@ class Channel {
return {
draft,
lastReadAt: lastReadAt?.toISO(),
- scrollPosition
+ scrollPosition,
};
}
}
@@ -49,7 +49,7 @@ export class Channels {
static fromStored(stored) {
const loaded = Object.keys(stored).map((channelId) => [
channelId,
- Channel.fromStored(stored[channelId])
+ Channel.fromStored(stored[channelId]),
]);
const all = new SvelteMap(loaded);
return new Channels({ all });
@@ -98,9 +98,9 @@ export class Channels {
this.all.entries(),
(stored, [channelId, channel]) => ({
...stored,
- [channelId]: channel.toStored()
+ [channelId]: channel.toStored(),
}),
- {}
+ {},
);
}
diff --git a/ui/lib/state/remote/channels.svelte.js b/ui/lib/state/remote/channels.svelte.js
index 19946f2..b2888cb 100644
--- a/ui/lib/state/remote/channels.svelte.js
+++ b/ui/lib/state/remote/channels.svelte.js
@@ -5,7 +5,7 @@ class Channel {
return new Channel({
at: DateTime.fromISO(at),
id,
- name
+ name,
});
}
diff --git a/ui/lib/state/remote/messages.svelte.js b/ui/lib/state/remote/messages.svelte.js
index 0a081bb..7ce28b4 100644
--- a/ui/lib/state/remote/messages.svelte.js
+++ b/ui/lib/state/remote/messages.svelte.js
@@ -9,7 +9,7 @@ class Message {
channel,
sender,
body,
- renderedBody: render(body)
+ renderedBody: render(body),
});
}
diff --git a/ui/lib/state/remote/state.svelte.js b/ui/lib/state/remote/state.svelte.js
index e00d55c..a30e0fe 100644
--- a/ui/lib/state/remote/state.svelte.js
+++ b/ui/lib/state/remote/state.svelte.js
@@ -15,7 +15,7 @@ export class State {
users: Users.boot(users),
channels: Channels.boot(channels),
messages: Messages.boot(messages),
- resumePoint
+ resumePoint,
});
}
diff --git a/ui/routes/(app)/+layout.js b/ui/routes/(app)/+layout.js
index 9c0afa8..648bf6a 100644
--- a/ui/routes/(app)/+layout.js
+++ b/ui/routes/(app)/+layout.js
@@ -5,6 +5,6 @@ export async function load() {
let s = await session.boot();
return {
outbox: Outbox.empty(),
- session: s
+ session: s,
};
}
diff --git a/ui/routes/(app)/ch/[channel]/+page.svelte b/ui/routes/(app)/ch/[channel]/+page.svelte
index 76bb638..87918f7 100644
--- a/ui/routes/(app)/ch/[channel]/+page.svelte
+++ b/ui/routes/(app)/ch/[channel]/+page.svelte
@@ -16,7 +16,7 @@
const unsent = $derived(outbox.messages.filter((message) => message.channel === channelId));
const deleted = $derived(outbox.deleted.map((message) => message.messageId));
const unsentSkeletons = $derived(
- unsent.map((message) => message.toSkeleton($state.snapshot(session.currentUser)))
+ unsent.map((message) => message.toSkeleton($state.snapshot(session.currentUser))),
);
const messageRuns = $derived(runs(messages.concat(unsentSkeletons), session.currentUser));
@@ -93,7 +93,7 @@
{sender}
class={{
['own-message']: ownMessage,
- ['other-message']: !ownMessage
+ ['other-message']: !ownMessage,
}}
>
{#each messages as message}
@@ -103,7 +103,7 @@
{deleteMessage}
class={{
unsent: !message.id,
- deleted: deleted.includes(message.id)
+ deleted: deleted.includes(message.id),
}}
/>
{/each}
diff --git a/ui/routes/(login)/invite/[invite]/+page.js b/ui/routes/(login)/invite/[invite]/+page.js
index 5d526df..2537140 100644
--- a/ui/routes/(login)/invite/[invite]/+page.js
+++ b/ui/routes/(login)/invite/[invite]/+page.js
@@ -18,6 +18,6 @@ async function loadInvite(invite) {
export function load({ params }) {
let { invite } = params;
return {
- invite: loadInvite(invite)
+ invite: loadInvite(invite),
};
}
diff --git a/ui/routes/+layout.svelte b/ui/routes/+layout.svelte
index b9468c6..83a9ef7 100644
--- a/ui/routes/+layout.svelte
+++ b/ui/routes/+layout.svelte
@@ -7,7 +7,7 @@
const session = $derived(page.data.session);
let pageContext = $state({
- showMenu: false
+ showMenu: false,
});
setContext('page', pageContext);
diff --git a/ui/service-worker.js b/ui/service-worker.js
index 9855a73..d9b2a7c 100644
--- a/ui/service-worker.js
+++ b/ui/service-worker.js
@@ -16,7 +16,7 @@ const CACHE = `cache-${version}`;
const ASSETS = [
...build, // the app itself
- ...files // everything in `static`
+ ...files, // everything in `static`
];
self.addEventListener('install', (event) => {
diff --git a/ui/tests/lib/components/ChangePassword.svelte.test.js b/ui/tests/lib/components/ChangePassword.svelte.test.js
index 9db6974..8171efd 100644
--- a/ui/tests/lib/components/ChangePassword.svelte.test.js
+++ b/ui/tests/lib/components/ChangePassword.svelte.test.js
@@ -6,13 +6,13 @@ import ChangePassword from '$lib/components/ChangePassword.svelte';
const user = userEvent.setup();
const mocks = vi.hoisted(() => ({
- changePassword: vi.fn()
+ changePassword: vi.fn(),
}));
describe('ChangePassword', async () => {
beforeEach(async () => {
render(ChangePassword, {
- changePassword: mocks.changePassword
+ changePassword: mocks.changePassword,
});
});
diff --git a/ui/tests/lib/components/CreateChannelForm.svelte.test.js b/ui/tests/lib/components/CreateChannelForm.svelte.test.js
index 15d3cfd..197cb6b 100644
--- a/ui/tests/lib/components/CreateChannelForm.svelte.test.js
+++ b/ui/tests/lib/components/CreateChannelForm.svelte.test.js
@@ -6,13 +6,13 @@ import CreateChannelForm from '$lib/components/CreateChannelForm.svelte';
const user = userEvent.setup();
const mocks = vi.hoisted(() => ({
- createChannel: vi.fn()
+ createChannel: vi.fn(),
}));
describe('CreateChannelForm', async () => {
beforeEach(async () => {
render(CreateChannelForm, {
- createChannel: mocks.createChannel
+ createChannel: mocks.createChannel,
});
});
diff --git a/ui/tests/lib/components/LogIn.svelte.test.js b/ui/tests/lib/components/LogIn.svelte.test.js
index ab77c11..00abb5c 100644
--- a/ui/tests/lib/components/LogIn.svelte.test.js
+++ b/ui/tests/lib/components/LogIn.svelte.test.js
@@ -6,13 +6,13 @@ import LogIn from '$lib/components/LogIn.svelte';
const user = userEvent.setup();
const mocks = vi.hoisted(() => ({
- logIn: vi.fn()
+ logIn: vi.fn(),
}));
describe('LogIn', async () => {
beforeEach(async () => {
render(LogIn, {
- logIn: mocks.logIn
+ logIn: mocks.logIn,
});
});
@@ -28,7 +28,7 @@ describe('LogIn', async () => {
expect(mocks.logIn).toHaveBeenCalledExactlyOnceWith(
'my username',
- 'my very creative and long password'
+ 'my very creative and long password',
);
});
});
diff --git a/ui/tests/lib/components/MessageInput.svelte.test.js b/ui/tests/lib/components/MessageInput.svelte.test.js
index c9aaa88..c32ce11 100644
--- a/ui/tests/lib/components/MessageInput.svelte.test.js
+++ b/ui/tests/lib/components/MessageInput.svelte.test.js
@@ -6,13 +6,13 @@ import MessageInput from '$lib/components/MessageInput.svelte';
const user = userEvent.setup();
const mocks = vi.hoisted(() => ({
- sendMessage: vi.fn()
+ sendMessage: vi.fn(),
}));
describe('CreateChannelForm', async () => {
beforeEach(async () => {
render(MessageInput, {
- sendMessage: mocks.sendMessage
+ sendMessage: mocks.sendMessage,
});
});