Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1157x 1x 1x 4x 4x 4x 4x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x | <template>
<!--
Collapsible filter panel for the Table and Matches tabs (SB-1714), after
the Android panel (SB-1680). Closed, the header is the summary of what is
narrowing the list; open, the rows below say it.
Open until the viewer first closes it, then remembered per tab — the
filters are the first thing a new visitor needs and the last thing a
returning one wants to scroll past.
-->
<section
class="rounded-lg border border-line bg-surface-alt/40"
:data-testid="testid"
>
<button
type="button"
class="w-full flex items-center gap-3 px-4 py-3 min-h-[44px] text-left"
:aria-expanded="open ? 'true' : 'false'"
:aria-controls="bodyId"
:data-testid="`${testid}-toggle`"
@click="toggle"
>
<!-- sliders icon -->
<svg
class="w-5 h-5 shrink-0 text-fg-muted"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
aria-hidden="true"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="1.5"
d="M10.5 6h9.75M10.5 6a1.5 1.5 0 11-3 0m3 0a1.5 1.5 0 10-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-9.75 0h9.75"
/>
</svg>
<span v-if="open || !summary" class="flex-1 text-sm font-semibold text-fg"
>Filters</span
>
<span
v-else
class="flex-1 min-w-0 line-clamp-2 text-sm text-fg"
:title="summary"
:data-testid="`${testid}-summary`"
>{{ summary }}</span
>
<span class="sr-only">{{ open ? 'Hide filters' : 'Show filters' }}</span>
<svg
:class="[
'w-5 h-5 shrink-0 text-fg-muted transition-transform',
open ? 'rotate-180' : '',
]"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
aria-hidden="true"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M19 9l-7 7-7-7"
/>
</svg>
</button>
<div
v-show="open"
:id="bodyId"
class="px-4 pb-4 pt-1 space-y-4"
:data-testid="`${testid}-body`"
>
<slot />
</div>
</section>
</template>
<script setup>
import { ref } from 'vue';
import { useAuthStore } from '@/stores/auth';
import { useFilterMemory } from '@/composables/useFilterMemory';
const props = defineProps({
/** Which tab's panel this is — the memory key and the test id. */
view: { type: String, required: true },
/** One line of what is narrowing the list; shown while closed. */
summary: { type: String, default: '' },
});
const testid = `filter-panel-${props.view}`;
const bodyId = `${testid}-body`;
// Per viewer, and kept on the account when signed in (SB-1715): two people
// on one iPad no longer share it, and it follows a viewer to a new device.
const authStore = useAuthStore();
const memory = useFilterMemory(
props.view,
() => authStore.state?.profile?.id ?? authStore.state?.user?.id ?? null
);
const open = ref(memory.loadPanel());
const toggle = () => {
open.value = !open.value;
memory.savePanel(open.value);
};
</script>
|