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

[Svelte]: Improve result indicator layout #62338

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,52 +36,67 @@
$: done = progress.done || state === 'complete'
</script>

<div class="indicator">
<div>
{#if loading}
<LoadingSpinner --icon-size="18px" inline />
{:else}
<Icon
svgPath={icons[severity]}
--icon-size="18px"
--color={isError ? 'var(--danger)' : 'var(--text-title)'}
/>
{/if}
</div>
<div class="root">
<div class="indicator">
<div class="progress-message">
<div class="icon">
{#if loading}
<LoadingSpinner --icon-size="18px" inline />
{:else}
<Icon
svgPath={icons[severity]}
--icon-size="18px"
--color={isError ? 'var(--danger)' : 'var(--text-title)'}
/>
{/if}
</div>

<ProgressMessage {state} {progress} {severity} />
</div>

<div class="messages">
<ProgressMessage {state} {progress} {severity} />
{#if !done && takingTooLong}
<TimeoutMessage />
{:else if done}
<SuggestedAction {progress} {suggestedItems} {severity} {state} />
{:else}
<span>Running search...</span>
{/if}
<div class="messages">
{#if !done && takingTooLong}
<TimeoutMessage />
{:else if done}
<SuggestedAction {progress} {suggestedItems} {severity} {state} />
{:else}
<span>Running search...</span>
{/if}
</div>
</div>

<Icon svgPath={mdiChevronDown} --icon-size="18px" --color={isError ? 'var(--danger)' : 'var(--text-title)'} />
</div>

<style lang="scss">
.root {
display: flex;
gap: 0.5rem;
align-items: center;
}

.indicator {
display: flex;
flex-flow: row nowrap;
justify-content: space-evenly;
flex-wrap: wrap;
align-items: center;
gap: 0.5rem;
min-width: 200px;
max-width: fit-content;
column-gap: 0.5rem;
row-gap: 0.25rem;

.progress-message {
display: flex;
gap: 0.5rem;
align-items: center;
}

padding: 0.25rem;
.icon {
align-self: baseline;
}

.messages {
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: flex-start;
margin-right: 0.75rem;
margin-left: 0.5rem;
row-gap: 0.25rem;
flex-flow: row nowrap;
align-items: baseline;
gap: 0.25rem;
}

span {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
export let state: 'error' | 'complete' | 'loading'

const SEE_MORE = 'See more details'
const CENTER_DOT = '\u00B7' // AKA 'interpunct'

interface ItemsBySeverity {
items: Skipped[]
Expand Down Expand Up @@ -40,7 +39,6 @@
{#if hasSkippedItems && mostSevere}
<small class="info-badge" class:error-text={isError}>{capitalize(mostSevere?.title ?? mostSevere.title)}</small>
{#if mostSevere.suggested}
<small>{CENTER_DOT}</small>
<small>{capitalize(mostSevere?.suggested ? mostSevere.suggested.title : '')}</small>
<small class="code-font">{mostSevere.suggested?.queryExpression}</small>
{/if}
Expand Down
10 changes: 4 additions & 6 deletions client/web-sveltekit/src/routes/search/SearchResults.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,11 @@
flex-direction: column;

.actions {
border-bottom: 1px solid var(--border-color);
padding: 0.5rem 0;
padding-left: 0.25rem;
flex-shrink: 0;
display: flex;
align-items: center;
flex-shrink: 0;
padding: 0.5rem;
border-bottom: 1px solid var(--border-color);
}

.result-list {
Expand All @@ -258,10 +257,9 @@
.message-container {
display: flex;
flex-direction: column;
margin: 2rem;
align-items: center;
margin: auto;
color: var(--text-muted);
margin: 2rem;
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@
.progress-button {
border: 1px solid var(--border-color-2);
border-radius: 4px;
margin-left: 0.3rem;
}

.streaming-popover {
Expand Down
Loading