<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}