summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-01-11 13:34:13 -0500
committerOwen Jacobson <owen@grimoire.ca>2025-01-11 13:34:13 -0500
commit6d51f8568e337e768505ccfdef916b84dd6eb1b3 (patch)
treedec4545ccbe44c8e2baf6e633308359f40ac610a /ui
parentd858fc8105cfe6333671426fe0e43302bceace92 (diff)
npm run format
Diffstat (limited to 'ui')
-rw-r--r--ui/app.css22
-rw-r--r--ui/lib/components/ChangePassword.svelte7
-rw-r--r--ui/lib/components/Channel.svelte2
-rw-r--r--ui/lib/components/CreateChannelForm.svelte7
-rw-r--r--ui/lib/components/LogIn.svelte8
-rw-r--r--ui/lib/components/Message.svelte8
-rw-r--r--ui/lib/components/MessageInput.svelte11
-rw-r--r--ui/lib/components/MessageRun.svelte6
-rw-r--r--ui/lib/store/channels.svelte.js9
-rw-r--r--ui/lib/store/messages.svelte.js2
-rw-r--r--ui/routes/(app)/+layout.svelte6
-rw-r--r--ui/routes/(app)/+page.svelte4
-rw-r--r--ui/routes/(app)/ch/[channel]/+page.svelte14
-rw-r--r--ui/styles/app-layout.css4
-rw-r--r--ui/styles/reset.css147
-rw-r--r--ui/styles/sidebar.css2
-rw-r--r--ui/styles/textarea.css2
-rw-r--r--ui/styles/variables.css18
18 files changed, 167 insertions, 112 deletions
diff --git a/ui/app.css b/ui/app.css
index 2df588e..a02106d 100644
--- a/ui/app.css
+++ b/ui/app.css
@@ -1,14 +1,14 @@
-@import url("styles/reset.css");
-@import url("styles/variables.css");
-@import url("styles/overscroll.css");
-@import url("styles/app-bar.css");
-@import url("styles/app-layout.css");
-@import url("styles/sidebar.css");
-@import url("styles/active-channel.css");
-@import url("styles/messages.css");
-@import url("styles/textarea.css");
-@import url("styles/forms.css");
-@import url("styles/invites.css");
+@import url('styles/reset.css');
+@import url('styles/variables.css');
+@import url('styles/overscroll.css');
+@import url('styles/app-bar.css');
+@import url('styles/app-layout.css');
+@import url('styles/sidebar.css');
+@import url('styles/active-channel.css');
+@import url('styles/messages.css');
+@import url('styles/textarea.css');
+@import url('styles/forms.css');
+@import url('styles/invites.css');
body {
background-color: var(--colour-active-channel-bg);
diff --git a/ui/lib/components/ChangePassword.svelte b/ui/lib/components/ChangePassword.svelte
index 51ebccd..bf94ea7 100644
--- a/ui/lib/components/ChangePassword.svelte
+++ b/ui/lib/components/ChangePassword.svelte
@@ -35,12 +35,7 @@
<label
>new password
- <input
- name="newPassword"
- type="password"
- placeholder="password"
- bind:value={newPassword}
- />
+ <input name="newPassword" type="password" placeholder="password" bind:value={newPassword} />
</label>
<label
diff --git a/ui/lib/components/Channel.svelte b/ui/lib/components/Channel.svelte
index 2fc3249..c73340f 100644
--- a/ui/lib/components/Channel.svelte
+++ b/ui/lib/components/Channel.svelte
@@ -3,7 +3,7 @@
</script>
<a href="/ch/{id}">
- <li class:active={active}>
+ <li class:active>
{#if hasUnreads}
<span class="badge has-unreads">❦</span>
{:else}
diff --git a/ui/lib/components/CreateChannelForm.svelte b/ui/lib/components/CreateChannelForm.svelte
index 8fab4c4..85c85bb 100644
--- a/ui/lib/components/CreateChannelForm.svelte
+++ b/ui/lib/components/CreateChannelForm.svelte
@@ -16,11 +16,6 @@
</script>
<form onsubmit={handleSubmit}>
- <input
- type="text"
- placeholder="create channel"
- bind:value={name}
- {disabled}
- />
+ <input type="text" placeholder="create channel" bind:value={name} {disabled} />
<button type="submit">&#x2795;</button>
</form>
diff --git a/ui/lib/components/LogIn.svelte b/ui/lib/components/LogIn.svelte
index 44aab44..5bfdae2 100644
--- a/ui/lib/components/LogIn.svelte
+++ b/ui/lib/components/LogIn.svelte
@@ -12,13 +12,7 @@
<form class="form" {onsubmit}>
<label for="username">
username
- <input
- name="username"
- type="text"
- placeholder="username"
- bind:value={username}
- {disabled}
- />
+ <input name="username" type="text" placeholder="username" bind:value={username} {disabled} />
</label>
<label for="password">
password
diff --git a/ui/lib/components/Message.svelte b/ui/lib/components/Message.svelte
index 6918b5d..1b1598b 100644
--- a/ui/lib/components/Message.svelte
+++ b/ui/lib/components/Message.svelte
@@ -25,13 +25,7 @@
}
</script>
-<div
- class="message"
- class:delete-armed={deleteArmed}
- role="article"
- data-at={at}
- {onmouseleave}
- >
+<div class="message" class:delete-armed={deleteArmed} role="article" data-at={at} {onmouseleave}>
<div class="handle">
{atFormatted}
{#if editable}
diff --git a/ui/lib/components/MessageInput.svelte b/ui/lib/components/MessageInput.svelte
index 25a0352..162db1b 100644
--- a/ui/lib/components/MessageInput.svelte
+++ b/ui/lib/components/MessageInput.svelte
@@ -24,13 +24,6 @@
</script>
<form bind:this={form} onsubmit={onSubmit}>
- <textarea
- onkeydown={onKeyDown}
- bind:value
- {disabled}
- type="search"
- ></textarea>
- <button
- type="submit"
- >&raquo;</button>
+ <textarea onkeydown={onKeyDown} bind:value {disabled} type="search"></textarea>
+ <button type="submit">&raquo;</button>
</form>
diff --git a/ui/lib/components/MessageRun.svelte b/ui/lib/components/MessageRun.svelte
index dec5f4f..bee64e8 100644
--- a/ui/lib/components/MessageRun.svelte
+++ b/ui/lib/components/MessageRun.svelte
@@ -8,11 +8,7 @@
let ownMessage = $derived($currentUser !== null && $currentUser.id == sender);
</script>
-<div
- class="message-run"
- class:own-message={ownMessage}
- class:other-message={!ownMessage}
->
+<div class="message-run" class:own-message={ownMessage} class:other-message={!ownMessage}>
<span class="username">
@{name}:
</span>
diff --git a/ui/lib/store/channels.svelte.js b/ui/lib/store/channels.svelte.js
index 8919be0..c82f9aa 100644
--- a/ui/lib/store/channels.svelte.js
+++ b/ui/lib/store/channels.svelte.js
@@ -1,5 +1,5 @@
import { DateTime } from 'luxon';
-const EPOCH_STRING = "1970-01-01T00:00:00Z";
+const EPOCH_STRING = '1970-01-01T00:00:00Z';
// For reasons unclear to me, a straight up class definition with a constructor
// doesn't seem to work, reactively. So we resort to this.
@@ -15,7 +15,7 @@ function makeChannelObject({ id, name, draft = '', lastReadAt = null, scrollPosi
name,
lastReadAt: lastReadAt || DateTime.fromISO(EPOCH_STRING),
draft,
- scrollPosition,
+ scrollPosition
};
}
@@ -33,10 +33,7 @@ export class Channels {
}
addChannel(id, name) {
- this.channels = [
- ...this.channels,
- makeChannelObject({ id, name }),
- ];
+ this.channels = [...this.channels, makeChannelObject({ id, name })];
this.sort();
return this;
}
diff --git a/ui/lib/store/messages.svelte.js b/ui/lib/store/messages.svelte.js
index ba4c895..dadade6 100644
--- a/ui/lib/store/messages.svelte.js
+++ b/ui/lib/store/messages.svelte.js
@@ -5,7 +5,7 @@ import DOMPurify from 'dompurify';
const RUN_COALESCE_MAX_INTERVAL = 10 /* min */ * 60 /* sec */ * 1000; /* ms */
export class Messages {
- channels = $state({}); // Mapping<ChannelId, Message>
+ channels = $state({}); // Mapping<ChannelId, Message>
inChannel(channel) {
return this.channels[channel] || [];
diff --git a/ui/routes/(app)/+layout.svelte b/ui/routes/(app)/+layout.svelte
index 08444bd..cbfef54 100644
--- a/ui/routes/(app)/+layout.svelte
+++ b/ui/routes/(app)/+layout.svelte
@@ -41,7 +41,7 @@
let hasUnreads = lastMessageAt > ch.lastReadAt;
enrichedChannels.push({
...ch,
- hasUnreads,
+ hasUnreads
});
}
}
@@ -116,7 +116,7 @@
}
</script>
-<svelte:window on:beforeunload={beforeUnload}/>
+<svelte:window on:beforeunload={beforeUnload} />
<svelte:head>
<!-- TODO: unread count? -->
@@ -128,7 +128,7 @@
{:else}
<div id="interface">
<nav id="sidebar" data-expanded={pageContext.showMenu}>
- <ChannelList active={channel} channels={enrichedChannels} />
+ <ChannelList active={channel} channels={enrichedChannels} />
<div class="create-channel">
<CreateChannelForm />
</div>
diff --git a/ui/routes/(app)/+page.svelte b/ui/routes/(app)/+page.svelte
index e15bca8..007c5c6 100644
--- a/ui/routes/(app)/+page.svelte
+++ b/ui/routes/(app)/+page.svelte
@@ -1,5 +1,3 @@
<div class="no-active-channel">
- <span class="vertical-aligner">
- Please select or create a channel.
- </span>
+ <span class="vertical-aligner"> Please select or create a channel. </span>
</div>
diff --git a/ui/routes/(app)/ch/[channel]/+page.svelte b/ui/routes/(app)/ch/[channel]/+page.svelte
index 8eba709..dbdb507 100644
--- a/ui/routes/(app)/ch/[channel]/+page.svelte
+++ b/ui/routes/(app)/ch/[channel]/+page.svelte
@@ -18,15 +18,17 @@
const elementTop = elRect.top;
const elementBottom = elRect.bottom;
- return ((parentTop < elementTop) && (parentBottom > elementBottom));
+ return parentTop < elementTop && parentBottom > elementBottom;
}
function getLastVisibleMessage() {
const parentElement = activeChannel;
const childElements = parentElement.getElementsByClassName('message');
- const lastInView = Array.from(childElements).reverse().find((el) => {
- return inView(parentElement, el);
- });
+ const lastInView = Array.from(childElements)
+ .reverse()
+ .find((el) => {
+ return inView(parentElement, el);
+ });
return lastInView;
}
@@ -50,14 +52,14 @@
});
function handleKeydown(event) {
- if (event.key === 'Escape') {
+ if (event.key === 'Escape') {
setLastRead(); // TODO: pass in "last message DT"?
}
}
let lastReadCallback = null;
function handleScroll() {
- clearTimeout(lastReadCallback); // Fine if lastReadCallback is null still.
+ clearTimeout(lastReadCallback); // Fine if lastReadCallback is null still.
lastReadCallback = setTimeout(setLastRead, 2 * 1000);
}
</script>
diff --git a/ui/styles/app-layout.css b/ui/styles/app-layout.css
index 50fa704..82d9914 100644
--- a/ui/styles/app-layout.css
+++ b/ui/styles/app-layout.css
@@ -36,7 +36,9 @@ nav.list-nav {
overflow: auto;
@media (width > 640px) {
- height: calc(100vh - var(--app-bar-height) - var(--input-row-height) - var(--interface-padding));
+ height: calc(
+ 100vh - var(--app-bar-height) - var(--input-row-height) - var(--interface-padding)
+ );
}
}
diff --git a/ui/styles/reset.css b/ui/styles/reset.css
index e29c0f5..a3f7681 100644
--- a/ui/styles/reset.css
+++ b/ui/styles/reset.css
@@ -3,46 +3,127 @@
License: none (public domain)
*/
-html, body, div, span, applet, object, iframe,
-h1, h2, h3, h4, h5, h6, p, blockquote, pre,
-a, abbr, acronym, address, big, cite, code,
-del, dfn, em, img, ins, kbd, q, s, samp,
-small, strike, strong, sub, sup, tt, var,
-b, u, i, center,
-dl, dt, dd, ol, ul, li,
-fieldset, form, label, legend,
-table, caption, tbody, tfoot, thead, tr, th, td,
-article, aside, canvas, details, embed,
-figure, figcaption, footer, header, hgroup,
-menu, nav, output, ruby, section, summary,
-time, mark, audio, video {
- margin: 0;
- padding: 0;
- border: 0;
- font-size: 100%;
- font: inherit;
- vertical-align: baseline;
+html,
+body,
+div,
+span,
+applet,
+object,
+iframe,
+h1,
+h2,
+h3,
+h4,
+h5,
+h6,
+p,
+blockquote,
+pre,
+a,
+abbr,
+acronym,
+address,
+big,
+cite,
+code,
+del,
+dfn,
+em,
+img,
+ins,
+kbd,
+q,
+s,
+samp,
+small,
+strike,
+strong,
+sub,
+sup,
+tt,
+var,
+b,
+u,
+i,
+center,
+dl,
+dt,
+dd,
+ol,
+ul,
+li,
+fieldset,
+form,
+label,
+legend,
+table,
+caption,
+tbody,
+tfoot,
+thead,
+tr,
+th,
+td,
+article,
+aside,
+canvas,
+details,
+embed,
+figure,
+figcaption,
+footer,
+header,
+hgroup,
+menu,
+nav,
+output,
+ruby,
+section,
+summary,
+time,
+mark,
+audio,
+video {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ font-size: 100%;
+ font: inherit;
+ vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
-article, aside, details, figcaption, figure,
-footer, header, hgroup, menu, nav, section {
- display: block;
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+hgroup,
+menu,
+nav,
+section {
+ display: block;
}
body {
- line-height: 1;
+ line-height: 1;
}
-ol, ul {
- list-style: none;
+ol,
+ul {
+ list-style: none;
}
-blockquote, q {
- quotes: none;
+blockquote,
+q {
+ quotes: none;
}
-blockquote:before, blockquote:after,
-q:before, q:after {
- content: '';
- content: none;
+blockquote:before,
+blockquote:after,
+q:before,
+q:after {
+ content: '';
+ content: none;
}
table {
- border-collapse: collapse;
- border-spacing: 0;
+ border-collapse: collapse;
+ border-spacing: 0;
}
diff --git a/ui/styles/sidebar.css b/ui/styles/sidebar.css
index b31c4fd..5e5e16a 100644
--- a/ui/styles/sidebar.css
+++ b/ui/styles/sidebar.css
@@ -44,7 +44,7 @@
padding: 0.5rem;
border-radius: 0.5rem 0 0 0.5rem;
border: 1px solid var(--colour-input-border);
- z-index: 1; /* Just to make the focus-active border go over the following button. */
+ z-index: 1; /* Just to make the focus-active border go over the following button. */
flex-grow: 1;
background-color: var(--colour-input-bg);
color: var(--colour-input-text);
diff --git a/ui/styles/textarea.css b/ui/styles/textarea.css
index b45a66d..c38de46 100644
--- a/ui/styles/textarea.css
+++ b/ui/styles/textarea.css
@@ -10,7 +10,7 @@
padding: 0.5rem;
border-radius: 0.5rem 0 0 0.5rem;
border: 1px solid var(--colour-input-border);
- z-index: 1; /* Just to make the focus-active border go over the following button. */
+ z-index: 1; /* Just to make the focus-active border go over the following button. */
flex-grow: 1;
background-color: var(--colour-input-bg);
color: var(--colour-input-text);
diff --git a/ui/styles/variables.css b/ui/styles/variables.css
index fa51506..80817f3 100644
--- a/ui/styles/variables.css
+++ b/ui/styles/variables.css
@@ -8,9 +8,9 @@
--nav-width: 21rem;
/* coloUrs */
- --colour-okay: #6A994E;
- --colour-warn: #EBC3BE;
- --colour-error: #DE5F55;
+ --colour-okay: #6a994e;
+ --colour-warn: #ebc3be;
+ --colour-error: #de5f55;
/* I dunno, I liked this colour: */
--colour-base: rgb(121, 96, 159);
@@ -43,9 +43,17 @@
/* MessageRun */
--colour-message-run-self-bg: color-mix(in srgb, var(--colour-base) 30%, white);
- --colour-message-run-self-border: color-mix(in srgb, var(--colour-message-run-self-bg) 50%, black);
+ --colour-message-run-self-border: color-mix(
+ in srgb,
+ var(--colour-message-run-self-bg) 50%,
+ black
+ );
--colour-message-run-other-bg: color-mix(in srgb, var(--colour-base) 50%, white);
- --colour-message-run-other-border: color-mix(in srgb, var(--colour-message-run-other-bg) 50%, black);
+ --colour-message-run-other-border: color-mix(
+ in srgb,
+ var(--colour-message-run-other-bg) 50%,
+ black
+ );
--colour-message-run-self-text: var(--dark-text);
--colour-message-run-other-text: var(--dark-text);