Skip to content

Commit

Permalink
Merge branch 'png-fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
xnought committed Apr 6, 2024
2 parents a56a0df + b69226d commit 772ce11
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 54 deletions.
14 changes: 9 additions & 5 deletions frontend/src/lib/DelayedSpinner.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
</script>

{#if showSpinner}
{#if textRight}
<Spinner {...spinnerProps} /> {text}
{:else}
{text} <Spinner {...spinnerProps} />
{/if}
<div class="flex gap-2 items-center">
{#if textRight}
<Spinner {...spinnerProps} />
<p>{text}</p>
{:else}
<p>{text}</p>
<Spinner {...spinnerProps} />
{/if}
</div>
{/if}
106 changes: 57 additions & 49 deletions frontend/src/routes/Search.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import ListProteins from "../lib/ListProteins.svelte";
import { Search, Button } from "flowbite-svelte";
import RangerFilter from "../lib/RangerFilter.svelte";
import DelayedSpinner from "../lib/DelayedSpinner.svelte";
let query = "";
let proteinEntries: ProteinEntry[];
Expand Down Expand Up @@ -50,59 +51,63 @@
<section>
<div id="sidebar">
<h2 class="text-primary-900 mb-2">Filter By</h2>

<div>
{#if species && species.length > 0}
<div>
<h3>Species</h3>
</div>
<div class="flex gap-2 flex-wrap">
{#each species as s}
<Button
outline
on:click={async () => {
speciesFilter = s;
await search();
}}
>
{s}
</Button>
{/each}
</div>
{/if}
</div>
<div>
{#if lengthExtent && lengthFilter}
{#if lengthExtent && massExtent && species}
<div>
{#if species && species.length > 0}
<div>
<h3>Species</h3>
</div>
<div class="flex gap-2 flex-wrap">
{#each species as s}
<Button
outline
on:click={async () => {
speciesFilter = s;
await search();
}}
>
{s}
</Button>
{/each}
</div>
{/if}
</div>
<div>
<h3>Amino Acids Length</h3>
<RangerFilter
min={lengthExtent.min}
max={lengthExtent.max}
on:change={async ({ detail }) => {
lengthFilter = detail;
await search();
}}
/>
{/if}
</div>
{#if lengthExtent && lengthFilter}
<RangerFilter
min={lengthExtent.min}
max={lengthExtent.max}
on:change={async ({ detail }) => {
lengthFilter = detail;
await search();
}}
/>
{/if}
</div>

<div>
{#if massExtent && massFilter}
<div>
<h3>Mass (Da)</h3>
<RangerFilter
min={massExtent.min}
max={massExtent.max}
on:change={async ({ detail }) => {
massFilter = detail;
await search();
}}
/>
{/if}
</div>
{#if massExtent && massFilter}
<RangerFilter
min={massExtent.min}
max={massExtent.max}
on:change={async ({ detail }) => {
massFilter = detail;
await search();
}}
/>
{/if}
</div>

<div class="mt-5">
<Button on:click={resetFilter}>Reset All Filters</Button>
</div>
<div class="mt-5">
<Button on:click={resetFilter}>Reset All Filters</Button>
</div>
{:else}
<DelayedSpinner text="Fetching Properties to Filter By" textRight />
{/if}
</div>

<div id="view">
<form id="search-bar" on:submit|preventDefault={search}>
<Search
Expand All @@ -120,7 +125,10 @@
</div>
{/if}
{#if proteinEntries === undefined || proteinEntries.length === 0}
No proteins Found
<DelayedSpinner
text="Fetching Proteins from the Venome DB..."
textRight
/>
{:else}
<ListProteins allEntries={proteinEntries} />
{/if}
Expand Down

0 comments on commit 772ce11

Please sign in to comment.