From c83a7b5dbf74ecf82d3f11c47eaef915c2bfc808 Mon Sep 17 00:00:00 2001 From: leafyzito Date: Wed, 6 May 2026 15:28:39 +0000 Subject: [PATCH 1/3] feat(logs, firehose): clickable usernames to open monthly logs --- src/routes/firehose/+page.svelte | 20 ++++++++++++++++++-- src/routes/logs/+page.svelte | 27 +++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/routes/firehose/+page.svelte b/src/routes/firehose/+page.svelte index 1d25d15..4690920 100644 --- a/src/routes/firehose/+page.svelte +++ b/src/routes/firehose/+page.svelte @@ -71,6 +71,16 @@ let instanceValue = $state(""); let searchValue = $state(""); + const openMonthlyUserLogs = async (msg: Message) => { + const c = (msg.channel || "").trim(); + const userId = msg.tags?.["user-id"]; + const u = (userId ? `id:${userId}` : msg.displayName || "").trim(); + if (!c || !u) return; + + const d = new Date(msg.timestamp).toISOString().slice(0, 7); // YYYY-MM + await goto(`/logs?c=${encodeURIComponent(c)}&u=${encodeURIComponent(u)}&d=${encodeURIComponent(d)}`, { keepFocus: true }); + }; + onMount(() => { fetchGlobalBadges(); fetchGlobalEmotes(); @@ -374,9 +384,15 @@ {/if} - + {#key emoteUpdates} {#each parseMessage(msg) as { type: Component, props }, index (index)} diff --git a/src/routes/logs/+page.svelte b/src/routes/logs/+page.svelte index 7b98c3d..a5b5e70 100644 --- a/src/routes/logs/+page.svelte +++ b/src/routes/logs/+page.svelte @@ -413,6 +413,24 @@ else return `${channelType}/${encodeURIComponent(channel)}${user ? `/${userType}/${encodeURIComponent(user)}` : ""}`; }; + const openMonthlyUserLogs = async (msg: Message) => { + const c = (channelName || msg.channel || "").trim(); + const userId = msg.tags?.["user-id"]; + const u = (userId ? `id:${userId}` : msg.displayName || "").trim(); + if (!c || !u) return; + + const d = new Date(msg.timestamp).toISOString().slice(0, 7); // YYYY-MM + untrack(() => { + inputChannelName = c; + channelName = c; + inputUserName = u; + userName = u; + dateValue = d; + }); + + await goto(`/logs?c=${encodeURIComponent(c)}&u=${encodeURIComponent(u)}&d=${encodeURIComponent(d)}`, { keepFocus: true }); + }; + const fetchChannelStats = async () => { if (!channelName) return; @@ -1192,9 +1210,14 @@ {msg.text} {:else} - + {#key emoteUpdates} {#each parseMessage(msg) as { type: Component, props }, index (index)} From da323357ed1770d0486b0707b420f53107ef4998 Mon Sep 17 00:00:00 2001 From: leafyzito Date: Wed, 6 May 2026 22:06:15 +0000 Subject: [PATCH 2/3] simplify --- src/routes/firehose/+page.svelte | 32 +++++++++++--------------- src/routes/logs/+page.svelte | 39 ++++++++++++++------------------ 2 files changed, 30 insertions(+), 41 deletions(-) diff --git a/src/routes/firehose/+page.svelte b/src/routes/firehose/+page.svelte index 4690920..3001af3 100644 --- a/src/routes/firehose/+page.svelte +++ b/src/routes/firehose/+page.svelte @@ -71,16 +71,6 @@ let instanceValue = $state(""); let searchValue = $state(""); - const openMonthlyUserLogs = async (msg: Message) => { - const c = (msg.channel || "").trim(); - const userId = msg.tags?.["user-id"]; - const u = (userId ? `id:${userId}` : msg.displayName || "").trim(); - if (!c || !u) return; - - const d = new Date(msg.timestamp).toISOString().slice(0, 7); // YYYY-MM - await goto(`/logs?c=${encodeURIComponent(c)}&u=${encodeURIComponent(u)}&d=${encodeURIComponent(d)}`, { keepFocus: true }); - }; - onMount(() => { fetchGlobalBadges(); fetchGlobalEmotes(); @@ -384,15 +374,19 @@ {/if} - + {#if !msg.tags["target-user-id"]} + {@const c = (msg.channel || "").trim()} + {@const userId = msg.tags?.["user-id"]} + {@const u = (userId ? `id:${userId}` : msg.displayName || "").trim()} + {@const d = new Date(msg.timestamp).toISOString().slice(0, 7)} + + {msg.displayName}: + + {/if} {#key emoteUpdates} {#each parseMessage(msg) as { type: Component, props }, index (index)} diff --git a/src/routes/logs/+page.svelte b/src/routes/logs/+page.svelte index a5b5e70..dfaa99d 100644 --- a/src/routes/logs/+page.svelte +++ b/src/routes/logs/+page.svelte @@ -413,24 +413,6 @@ else return `${channelType}/${encodeURIComponent(channel)}${user ? `/${userType}/${encodeURIComponent(user)}` : ""}`; }; - const openMonthlyUserLogs = async (msg: Message) => { - const c = (channelName || msg.channel || "").trim(); - const userId = msg.tags?.["user-id"]; - const u = (userId ? `id:${userId}` : msg.displayName || "").trim(); - if (!c || !u) return; - - const d = new Date(msg.timestamp).toISOString().slice(0, 7); // YYYY-MM - untrack(() => { - inputChannelName = c; - channelName = c; - inputUserName = u; - userName = u; - dateValue = d; - }); - - await goto(`/logs?c=${encodeURIComponent(c)}&u=${encodeURIComponent(u)}&d=${encodeURIComponent(d)}`, { keepFocus: true }); - }; - const fetchChannelStats = async () => { if (!channelName) return; @@ -1210,14 +1192,27 @@ {msg.text} {:else} - + {#key emoteUpdates} {#each parseMessage(msg) as { type: Component, props }, index (index)} From 247928e924328a53f8ca129dd5f04b2e31d1ebf4 Mon Sep 17 00:00:00 2001 From: leafyzito Date: Wed, 24 Jun 2026 02:22:56 +0000 Subject: [PATCH 3/3] fix(logs): show correct dates on username click --- src/routes/logs/+page.svelte | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/routes/logs/+page.svelte b/src/routes/logs/+page.svelte index dfaa99d..5373894 100644 --- a/src/routes/logs/+page.svelte +++ b/src/routes/logs/+page.svelte @@ -441,12 +441,15 @@ $effect(() => { // fetch available dates if (isQueryMode || !channelName) return; + const channel = channelName; + const user = userName; + availableDates = []; untrack(async () => { loading = true; - const res = await fetch(`https://logs.zonian.dev/list?${parseChannelUser(channelName, userName, true)}`); + const res = await fetch(`https://logs.zonian.dev/list?${parseChannelUser(channel, user, true)}`); if (!res.ok) { - if (res.status === 404) error = `No logs found for this channel ${userName ? "and user" : ""}`; + if (res.status === 404) error = `No logs found for this channel ${user ? "and user" : ""}`; else error = `Error from server: ${res.status} ${res.statusText}`; loading = false; dateValue = ""; @@ -1202,11 +1205,10 @@ const href = e.currentTarget.getAttribute("href") || ""; const q = new URL(href, page.url).searchParams; - untrack(() => { - inputChannelName = channelName = q.get("c") || ""; - inputUserName = userName = q.get("u") || ""; - dateValue = q.get("d") || ""; - }); + inputChannelName = channelName = q.get("c") || ""; + inputUserName = userName = q.get("u") || ""; + dateValue = q.get("d") || ""; + channelStats = null; goto(href, { keepFocus: true }); }}