summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/lib/components/Message.svelte15
-rw-r--r--ui/lib/components/MessageRun.svelte18
-rw-r--r--ui/routes/(app)/+layout.svelte29
-rw-r--r--ui/routes/(app)/ch/[channel]/+page.svelte9
4 files changed, 64 insertions, 7 deletions
diff --git a/ui/lib/components/Message.svelte b/ui/lib/components/Message.svelte
index 5673248..aa9e3e9 100644
--- a/ui/lib/components/Message.svelte
+++ b/ui/lib/components/Message.svelte
@@ -63,4 +63,19 @@
content: '.';
visibility: hidden;
}
+ /* Without the global selector, the Svelte CSS compiler will see this as
+ * unused, and purge it from the output. However, this is "plausibly used"
+ * because it may occur in renderedBody.
+ */
+ :global(.message-body blockquote) {
+ border-left: 0.25rem solid lightgrey;
+ margin-left: 0.5rem;
+ padding-left: 0.5rem;
+ }
+ :global(.message-body pre) {
+ border: 1px solid #312e81;
+ border-radius: 0.25rem;
+ background-color: #282555;;
+ padding: 0.25rem;
+ }
</style>
diff --git a/ui/lib/components/MessageRun.svelte b/ui/lib/components/MessageRun.svelte
index 39ee155..581682e 100644
--- a/ui/lib/components/MessageRun.svelte
+++ b/ui/lib/components/MessageRun.svelte
@@ -16,7 +16,21 @@
<span class="chip variant-soft sticky top-o left-0">
@{name}:
</span>
- {#each messages as { id, at, body, renderedBody }}
- <Message {id} {at} {body} {renderedBody} editable={ownMessage} />
+ {#each messages as message}
+ <Message {...message} editable={ownMessage} />
{/each}
</div>
+
+<style>
+ .own-message {
+ background-color: rgb(32, 42, 74);
+ }
+ /* Honestly, I don't love scoping styles per component, and this is a great
+ * example of why. MessageRuns know if they're own-message, but Messages in
+ * them need to get a style based on that fact. I don't wanna bucket-brigade
+ * that fact into the Message, when it's a pure CSS concern.
+ */
+ .own-message :global(*) {
+ color: rgb(198, 198, 198);
+ }
+</style>
diff --git a/ui/routes/(app)/+layout.svelte b/ui/routes/(app)/+layout.svelte
index 81324fd..a82d302 100644
--- a/ui/routes/(app)/+layout.svelte
+++ b/ui/routes/(app)/+layout.svelte
@@ -104,8 +104,20 @@
gesture.destroy();
}
});
+
+ function beforeUnload(evt) {
+ evt.preventDefault();
+ if (events !== null) {
+ events.close();
+ }
+ // For some compat reasons?
+ evt.returnValue = '';
+ return '';
+ }
</script>
+<svelte:window on:beforeunload={beforeUnload}/>
+
<svelte:head>
<!-- TODO: unread count? -->
<title>pilcrow</title>
@@ -136,6 +148,7 @@
--app-bar-height: 48px;
--input-row-height: 2rem;
--interface-padding: 16px;
+ --nav-width: 21rem;
}
#interface {
@@ -158,18 +171,24 @@
padding: 0.25rem;
position: var(--overlay, absolute);
transition: translate 300ms ease-out;
- width: 21rem;
- height: calc(100vh - var(--app-bar-height) - var(--interface-padding));
+ width: var(--nav-width);
+ height: 100vh;
+ @media (width > 640px) {
+ height: calc(100vh - var(--app-bar-height) - var(--interface-padding));
+ }
z-index: 10;
+ border-top-right-radius: 1.4rem;
+ border-bottom-right-radius: 1.4rem;
}
main {
grid-area: main;
height: calc(100vh - var(--app-bar-height) - var(--interface-padding));
}
.channel-list {
- height: calc(
- 100vh - var(--app-bar-height) - var(--interface-padding) - var(--input-row-height)
- );
+ height: calc(100vh - var(--input-row-height));
+ @media (width > 640px) {
+ height: calc(100vh - var(--app-bar-height) - var(--input-row-height) - var(--interface-padding));
+ }
overflow: auto;
}
nav[data-expanded='false'] {
diff --git a/ui/routes/(app)/ch/[channel]/+page.svelte b/ui/routes/(app)/ch/[channel]/+page.svelte
index 7d5b8cf..d4e04fe 100644
--- a/ui/routes/(app)/ch/[channel]/+page.svelte
+++ b/ui/routes/(app)/ch/[channel]/+page.svelte
@@ -78,4 +78,13 @@
);
overflow: auto;
}
+ .create-message {
+ position: fixed;
+ bottom: 0.5rem;
+ width: calc(100% - var(--nav-width) - 2rem);
+ @media (width <= 640px) {
+ width: 100%;
+ left: 0;
+ }
+ }
</style>