From 3739ea7119a0f00b169dbe0c469caad04d919bd9 Mon Sep 17 00:00:00 2001 From: Coracle-Bot Date: Wed, 9 Sep 2026 17:17:55 +0000 Subject: [PATCH] Switch the thread board to the table when the board is wide enough, not the page --- e2e/USER_STORIES.md | 4 +- e2e/specs/notifications.spec.ts | 5 ++- src/app/components/ThreadBoard.svelte | 49 ++++++++++++----------- src/app/components/ThreadBoardItem.svelte | 6 +-- src/lib/theme.ts | 17 -------- 5 files changed, 33 insertions(+), 48 deletions(-) delete mode 100644 src/lib/theme.ts diff --git a/e2e/USER_STORIES.md b/e2e/USER_STORIES.md index 2ef3d86e..afbc155f 100644 --- a/e2e/USER_STORIES.md +++ b/e2e/USER_STORIES.md @@ -1611,8 +1611,8 @@ Threads indicator is as actionable on a phone as it is on a desktop. Acceptance: -- The thread list below the md breakpoint is a list of links rather than a - table, and alice's thread carries a dot there; bob's own does not. +- The thread list in a board too narrow for the table is a list of links rather + than a table, and alice's thread carries a dot there; bob's own does not. ### US-114 — See which listings are unread diff --git a/e2e/specs/notifications.spec.ts b/e2e/specs/notifications.spec.ts index 765e138d..5bff4ca8 100644 --- a/e2e/specs/notifications.spec.ts +++ b/e2e/specs/notifications.spec.ts @@ -626,8 +626,9 @@ test("US-113 see which threads are unread on a phone", async ({seed, as}) => { const space = scenario.space("space") - // ThreadBoard swaps its table for a list of links below tailwind's md breakpoint, and the two - // branches render the thread separately, so a dot on one says nothing about the other. + // ThreadBoard swaps its table for a list of links when the board is too narrow for the table, + // and the two branches render the thread separately, so a dot on one says nothing about the + // other. const bob = await as(users.bob, `${spacePath(space.url)}/threads`, { context: {viewport: {width: 390, height: 844}, hasTouch: true}, }) diff --git a/src/app/components/ThreadBoard.svelte b/src/app/components/ThreadBoard.svelte index 43b2e3a1..617004cb 100644 --- a/src/app/components/ThreadBoard.svelte +++ b/src/app/components/ThreadBoard.svelte @@ -1,7 +1,6 @@ -
+

@@ -45,30 +46,30 @@

{#if threads.length === 0}

No topics yet.

- {:else if $matchMd} -
- - - - - - - - - - - {#each threads as event (event.id)} - - {/each} - -
TopicAuthorRepliesLast post
-
{:else}
- {#each threads as event (event.id)} - - {/each} + {#if width >= 640} + + + + + + + + + + + {#each threads as event (event.id)} + + {/each} + +
TopicAuthorRepliesLast post
+ {:else} + {#each threads as event (event.id)} + + {/each} + {/if}
{/if}
diff --git a/src/app/components/ThreadBoardItem.svelte b/src/app/components/ThreadBoardItem.svelte index c7b74eca..1c070417 100644 --- a/src/app/components/ThreadBoardItem.svelte +++ b/src/app/components/ThreadBoardItem.svelte @@ -15,10 +15,10 @@ url: string event: TrustedEvent context: FeedContext - mobile?: boolean + stacked?: boolean } - const {url, event, context, mobile = false}: Props = $props() + const {url, event, context, stacked = false}: Props = $props() const related = context.related(event) const replies = derived(related, $related => filter(spec({kind: COMMENT}), $related)) @@ -29,7 +29,7 @@ const onClick = () => navigate(path) -{#if mobile} +{#if stacked} diff --git a/src/lib/theme.ts b/src/lib/theme.ts deleted file mode 100644 index 4d19132c..00000000 --- a/src/lib/theme.ts +++ /dev/null @@ -1,17 +0,0 @@ -import theme from "tailwindcss/defaultTheme" -import {readable} from "svelte/store" -import type {Readable} from "svelte/store" - -export const matchWidth = (query: string): Readable => - readable(typeof window !== "undefined" && window.matchMedia(query).matches, set => { - const mq = window.matchMedia(query) - - const onChange = () => set(mq.matches) - - onChange() - mq.addEventListener("change", onChange) - - return () => mq.removeEventListener("change", onChange) - }) - -export const matchMd = matchWidth(`(min-width: ${theme.screens.md})`)