Skip to content

Commit

Permalink
feat: add buttons
Browse files Browse the repository at this point in the history
to clear filters and add a paper to a stage
  • Loading branch information
Slartibartfass2 committed Jan 20, 2025
1 parent e50576d commit df5a9c3
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/routes/project/[projectId]/papers/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import CriteriaSelect from "./CriteriaSelect.svelte";
import type { PapersByStage } from "./types";
import type { Paper } from "$lib/model/backend";
import CirclePlus from "lucide-svelte/icons/circle-plus";
import Trash from "lucide-svelte/icons/trash-2";
let { data } = $props();
const {
Expand Down Expand Up @@ -51,14 +53,15 @@
criteria: string[];
}
let papersFilters = $state<PapersFilters>({
const emptyFilters: PapersFilters = {
stages: [],
reviewers: [],
publishers: [],
years: [],
decisions: [],
criteria: [],
});
};
let papersFilters = $state<PapersFilters>(emptyFilters);
$effect(() => {
const filters = Object.assign({}, $state.snapshot(papersFilters));
Expand Down Expand Up @@ -88,12 +91,7 @@
<ChevronDown class="size-4" />
{/if}
</Button>
<SearchBar
placeholderText="Search paper"
onSearch={() => {
console.log($state.snapshot(papersFilters));
}}
/>
<SearchBar placeholderText="Search paper" onSearch={() => {}} />
</div>
{#if showFilters}
<div class="flex flex-row items-center gap-2.5 flex-wrap">
Expand All @@ -112,6 +110,14 @@
{loadingCriteria}
bind:selectedCriteria={papersFilters.criteria}
/>
<Button
onclick={() => {
papersFilters = emptyFilters;
}}
>
<Trash />
Clear Filters
</Button>
</div>
{/if}
</div>
Expand Down Expand Up @@ -139,7 +145,14 @@
}}
/>
{/each}
<!-- TODO: Add 'add paper' button -->
<Button
onclick={() => {
console.log(`Add paper to stage ${stage.stageIndex}`);
}}
>
<CirclePlus strokeWidth="2.5" />
Add Paper
</Button>
</div>
</Accordion.Content>
</Accordion.Item>
Expand Down

0 comments on commit df5a9c3

Please sign in to comment.