here and there

This commit is contained in:
2024-08-17 21:10:01 +03:00
parent 36165444cf
commit ec15f21e67
18 changed files with 170 additions and 135 deletions
@@ -25,6 +25,9 @@
extractLabel(schema, key),
].reduce((mem, fn) => fn(mem), filter);
function extractOperator(key) {
return (filter) => {
if (filter.isReference) {
@@ -81,6 +84,7 @@
{:else}
{filter.label} {operators.find((o) => o.name === filter.operator)?.symbol ?? ""} {value}
{/if}
<button
on:click|preventDefault={() => removeFilter(key)}
type="button"
@@ -0,0 +1,35 @@
<script>
import {createEventDispatcher, getContext} from "svelte";
import Icon from "../../common/Icon.svelte";
const channel = getContext("channel");
const dispatch = createEventDispatcher();
export let inModal;
export let modalUrl;
const url = new URL(modalUrl ?? window.location.href);
function removeFilter(k) {
const url = new URL(modalUrl ?? window.location.href);
url.searchParams.set("skip", "0");
url.searchParams.delete("notlinked");
if (inModal) {
dispatch("refresh", url);
} else {
window.location.replace(url);
}
}
</script>
{#if url.searchParams.get("notlinked")}
<span class="applied-filter">
Not linked
<button
on:click|preventDefault={() => removeFilter()}
type="button"
class="button-text"
aria-label="Close"
><Icon width={12} height={12} icon="close"></Icon></button>
</span>
{/if}
@@ -6,6 +6,7 @@
import AppliedFilter from "./AppliedFilter.svelte";
import {createEventDispatcher, getContext} from "svelte";
import Dropdown from "../../common/Dropdown.svelte";
import AppliedFilterNotLinked from "./AppliedFilterNotLinked.svelte";
const channel = getContext("channel");
@@ -136,6 +137,11 @@
{#if Object.entries(filter).length > 0}
<div class="applied-filters">
<AppliedFilterNotLinked
{inModal}
{modalUrl}
on:refresh
/>
{#each Object.entries(filter) as [k, v]}
<AppliedFilter
{schema}