feat(review-center): add repository filter and SelectMenu option meta/icon
Add a repository picker to the Review Center and wire it into the request filtering logic. Introduces repositoryFilter state and a derived repositoryOptions list (grouped by owner and carrying counts). If the chosen repository disappears from the options, the filter is cleared automatically. Enhance SelectMenu to support per-option meta text and an optional optionIcon snippet. Render options as [icon] label [meta] with updated markup and CSS to align and style icon/label/meta. Adjust toolbar grid and responsive CSS to make room for the new repository picker and to tweak select popup/option styles.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from "svelte";
|
||||
import { tick } from "svelte";
|
||||
import { Check, ChevronDown, Search } from "@lucide/svelte";
|
||||
|
||||
@@ -7,6 +8,8 @@
|
||||
label: string;
|
||||
group?: string;
|
||||
disabled?: boolean;
|
||||
/** Small right-aligned text, e.g. a count. */
|
||||
meta?: string;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
@@ -20,6 +23,8 @@
|
||||
searchable?: boolean;
|
||||
searchPlaceholder?: string;
|
||||
emptyText?: string;
|
||||
/** Optional icon in front of every option, e.g. a branch or repository mark. */
|
||||
optionIcon?: Snippet<[SelectMenuOption]>;
|
||||
onChange: (value: string) => void;
|
||||
}
|
||||
|
||||
@@ -34,6 +39,7 @@
|
||||
searchable = false,
|
||||
searchPlaceholder = "Search…",
|
||||
emptyText = "No results",
|
||||
optionIcon = undefined,
|
||||
onChange,
|
||||
}: Props = $props();
|
||||
|
||||
@@ -187,7 +193,9 @@
|
||||
onmouseenter={() => { if (!option.disabled) activeIndex = index; }}
|
||||
onclick={() => choose(index)}
|
||||
>
|
||||
<span>{option.label}</span>
|
||||
{#if optionIcon}<span class="select-menu-option-icon">{@render optionIcon(option)}</span>{/if}
|
||||
<span class="select-menu-option-label">{option.label}</span>
|
||||
{#if option.meta}<small class="select-menu-option-meta">{option.meta}</small>{/if}
|
||||
{#if option.value === value}<Check size={14} aria-hidden="true" />{/if}
|
||||
</button>
|
||||
{/each}
|
||||
|
||||
Reference in New Issue
Block a user