diff --git a/app/src/lib/ai/types.ts b/app/src/lib/ai/types.ts index 1f3ab5da9..4ff924a41 100644 --- a/app/src/lib/ai/types.ts +++ b/app/src/lib/ai/types.ts @@ -39,11 +39,11 @@ export interface AIClient { defaultCommitTemplate: Prompt; } -export interface UserPrompt { +export type UserPrompt = { id: string; name: string; prompt: Prompt; -} +}; export interface Prompts { defaultPrompt: Prompt; diff --git a/app/src/lib/components/BaseBranchSwitch.svelte b/app/src/lib/components/BaseBranchSwitch.svelte index c7a7b4f4b..444cb6a70 100644 --- a/app/src/lib/components/BaseBranchSwitch.svelte +++ b/app/src/lib/components/BaseBranchSwitch.svelte @@ -76,7 +76,14 @@ wide={true} label="Current target branch" > - + {item.name} @@ -91,7 +98,14 @@ disabled={targetChangeDisabled} label="Create branches on remote" > - + {item.name} diff --git a/app/src/lib/components/ProjectSwitcher.svelte b/app/src/lib/components/ProjectSwitcher.svelte index f638a37b3..e7b8ddfcb 100644 --- a/app/src/lib/components/ProjectSwitcher.svelte +++ b/app/src/lib/components/ProjectSwitcher.svelte @@ -9,11 +9,26 @@ const projectService = getContext(ProjectService); const project = maybeGetContext(Project); - const projects = projectService.projects; + type ProjectRecord = { + id: string; + title: string; + }; + + let mappedProjects: ProjectRecord[] = []; + + projectService.projects.subscribe((projectList) => { + // Map the projectList to fit the ProjectRecord type + mappedProjects = projectList.map((project) => { + return { + id: project.id, + title: project.title + }; + }); + }); let loading = false; - let select: Select; - let selectValue = project; + let select: Select; + let selectValue: ProjectRecord | undefined = project;
@@ -22,7 +37,7 @@ label="Switch to another project" itemId="id" labelId="title" - items={$projects} + items={mappedProjects} placeholder="Select a project..." wide bind:value={selectValue} diff --git a/app/src/lib/components/Select.svelte b/app/src/lib/components/Select.svelte index e90f788c8..6eea01181 100644 --- a/app/src/lib/components/Select.svelte +++ b/app/src/lib/components/Select.svelte @@ -1,18 +1,30 @@ - + + @@ -67,9 +164,10 @@ type="select" reversedDirection icon="select-chevron" - value={value?.[labelId]} + value={filterText ?? value?.[labelId]} disabled={disabled || loading} on:mousedown={() => toggleList()} + on:keydown={(ev) => handleKeyDown(ev)} />
(listOpen = !listOpen), + handler: closeList, enabled: listOpen }} > - {#if items} + {#if filteredItems}
- {#each items as item} + {#each filteredItems as item}
handleItemClick(item)} on:keydown|preventDefault|stopPropagation > - +
{/each}
diff --git a/app/src/lib/components/SelectItem.svelte b/app/src/lib/components/SelectItem.svelte index 56b3d0827..3ae2edaff 100644 --- a/app/src/lib/components/SelectItem.svelte +++ b/app/src/lib/components/SelectItem.svelte @@ -7,12 +7,19 @@ export let selected = false; export let disabled = false; export let loading = false; + export let highlighted = false; export let value: string | undefined = undefined; const dispatch = createEventDispatcher<{ click: string | undefined }>(); -