Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refine search list #187

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/lib/scss/custom/pages/_knowledgebase.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
}

.knowledge-search-result-container {
li::marker {
color: var(--bs-secondary)
}

.list-open {
list-style-type: disclosure-open;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
<script>
import LoadingDots from '$lib/common/LoadingDots.svelte';
import KnowledgeSearchItem from './knowledge-search-item.svelte';

/** @type {import('$types').KnowledgeRetrivalViewModel[]} */
export let list;

/** @type {boolean} */
export let isSearching = false;

/** @type {boolean} */
export let searchDone = false;
</script>

<div class="knowledge-search-result-container">
{#if list?.length > 0}
<ul>
{#each list as item, idx (idx)}
<KnowledgeSearchItem item={item} open={idx === 0} />
{/each}
</ul>
{:else if isSearching}
<div class="knowledge-loader mt-4">
<LoadingDots duration={'1s'} size={12} gap={5} color={'var(--bs-primary)'} />
</div>
{:else if searchDone}
<div class="mt-2">
<h3 class="text-secondary">{"Ehhh, no idea..."}</h3>
</div>
{/if}
<ul>
{#each list as item, idx (idx)}
<KnowledgeSearchItem item={item} open={idx === 0} />
{/each}
</ul>
</div>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script>
import { searchKnowledge } from "$lib/services/knowledge-base-service";
import { Button } from "@sveltestrap/sveltestrap";
import LoadingDots from "$lib/common/LoadingDots.svelte";
import KnowledgeSearchList from "./knowledge-search-list.svelte";
import _ from "lodash";

Expand Down Expand Up @@ -66,9 +67,15 @@
</Button>
</div>

<KnowledgeSearchList
list={search_results}
isSearching={is_searching}
searchDone={search_done}
/>
{#if is_searching}
<div class="knowledge-loader mt-4">
<LoadingDots duration={'1s'} size={12} gap={5} color={'var(--bs-primary)'} />
</div>
{:else if search_results?.length > 0}
<KnowledgeSearchList list={search_results} />
{:else if search_done}
<div class="mt-2">
<h4 class="text-secondary">{"Ehhh, no idea..."}</h4>
</div>
{/if}
</div>
Loading