better file filter

This commit is contained in:
Nikita Galaiko 2023-03-27 16:37:23 +02:00
parent 2057c9216e
commit d8af16f0cf
2 changed files with 11 additions and 3 deletions

View File

@ -35,12 +35,12 @@
</a>
{/if}
<div class="flex-auto overflow-auto flex h-full w-full flex-row gap-2 p-2">
<div class="flex h-full w-full flex-auto flex-row gap-2 overflow-auto p-2">
<ul id="days" class="flex h-full flex-shrink-0 flex-col gap-2 overflow-y-scroll">
{#each $dates as date}
<li class="w-full">
<a
href="/projects/{projectId}/player/{date}"
href="/projects/{projectId}/player/{date}{$page.url.search}"
class:bg-gb-800={date === $currentDate}
class:text-white={date === $currentDate}
class:border-gb-700={date !== $currentDate}

View File

@ -47,7 +47,7 @@
.map((s) => enrichSession(projectId, s, paths))
).then((sessions) =>
sessions
.filter((s) => s.deltas.length > 0)
.filter((s) => s.deltas.length > 0 && Object.keys(s.files).length > 0)
.sort((a, b) => a.meta.startTimestampMs - b.meta.startTimestampMs)
);
});
@ -56,6 +56,14 @@
const currentSessionId = writable($page.params.sessionId);
const currentDate = writable($page.params.date);
richSessions.subscribe((sessions) => {
if (!sessions) return;
if (sessions.length === 0) return;
if (!sessions.some((s) => s.id === $currentSessionId)) {
currentSessionId.set(sessions[0].id);
}
});
const scrollToSession = () => {
const sessionEl = document.getElementById('current-session');
if (sessionEl) {