fix(frontend): jobs name their chats, open links tab counts only links that are really open
This commit is contained in:
1 parent
4082adba25
commit
90b37ec708
2 files changed
+10
-6
No files matched your search
@@ -6,6 +6,7 @@
|
||||
import { locale, t } from "#lib/i18n/locale.svelte.js";
|
||||
import type { MessageKey } from "#lib/i18n/messages.js";
|
||||
import { accounts } from "#lib/stores/accounts.svelte.js";
|
||||
import { chats } from "#lib/stores/chats.svelte.js";
|
||||
import { toasts } from "#lib/stores/toasts.svelte.js";
|
||||
|
||||
interface Props {
|
||||
@@ -75,6 +76,9 @@
|
||||
|
||||
async function load() {
|
||||
jobs = await listJobs();
|
||||
chats.ensureMany(
|
||||
jobs.map(chatId).filter((id): id is number => id !== null)
|
||||
);
|
||||
loading = false;
|
||||
schedule();
|
||||
}
|
||||
@@ -100,6 +104,10 @@
|
||||
return typeof value === "number" ? value : null;
|
||||
}
|
||||
|
||||
function chatLabel(id: number): string {
|
||||
return chats.byId(id)?.title ?? t("jobs.chat", { id });
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
if (version >= 0 && accounts.selectedId !== null) {
|
||||
load().catch(() => {
|
||||
@@ -141,7 +149,7 @@
|
||||
</div>
|
||||
<div class="meta">
|
||||
{#if chat !== null}
|
||||
<span>{t("jobs.chat", { id: chat })}</span>
|
||||
<span>{chatLabel(chat)}</span>
|
||||
{/if}
|
||||
{#if count !== null}
|
||||
<span>
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
let items = $state<FileShare[]>([]);
|
||||
let loading = $state(false);
|
||||
let filter = $state<Filter>("active");
|
||||
let fetchedAll = $state(false);
|
||||
let expanded = $state<number | null>(null);
|
||||
let token = 0;
|
||||
|
||||
@@ -39,9 +38,7 @@
|
||||
: items
|
||||
);
|
||||
const activeCount = $derived(
|
||||
fetchedAll
|
||||
? items.filter((item) => shareState(item) === "active").length
|
||||
: items.length
|
||||
items.filter((item) => shareState(item) === "active").length
|
||||
);
|
||||
|
||||
async function load() {
|
||||
@@ -53,7 +50,6 @@
|
||||
const rows = await listShares(activeOnly);
|
||||
if (current === token) {
|
||||
items = rows;
|
||||
fetchedAll = !activeOnly;
|
||||
}
|
||||
} catch {
|
||||
if (current === token) {
|
||||
|
||||
Reference in new issue
Block a user