30bbbaf00b
* Make eslint sort our imports * fix missing deps in eslint rule (dae) Caught on Linux due to the stricter sandboxing * Remove exports-last eslint rule (for now?) * Adjust browserslist settings - We use ResizeObserver which is not supported in browsers like KaiOS, Baidu or Android UC * Raise minimum iOS version 13.4 - It's the first version that supports ResizeObserver * Apply new eslint rules to sort imports
62 lines
1.6 KiB
Svelte
62 lines
1.6 KiB
Svelte
<!--
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
-->
|
|
<script lang="ts">
|
|
import { slide } from "svelte/transition";
|
|
|
|
import Badge from "../components/Badge.svelte";
|
|
import * as tr from "../lib/ftl";
|
|
import { minusIcon, plusIcon } from "./icons";
|
|
import { MapContext } from "./lib";
|
|
|
|
export let unused: string[];
|
|
export let ctx: MapContext;
|
|
|
|
let unusedMsg: string;
|
|
$: unusedMsg =
|
|
ctx === MapContext.Field
|
|
? tr.changeNotetypeWillDiscardContent()
|
|
: tr.changeNotetypeWillDiscardCards();
|
|
|
|
const maxItems: number = 3;
|
|
let collapsed: boolean = true;
|
|
$: collapseMsg = collapsed
|
|
? tr.changeNotetypeExpand()
|
|
: tr.changeNotetypeCollapse();
|
|
$: icon = collapsed ? plusIcon : minusIcon;
|
|
</script>
|
|
|
|
<div class="alert alert-warning" in:slide out:slide>
|
|
{#if unused.length > maxItems}
|
|
<div class="clickable" on:click={() => (collapsed = !collapsed)}>
|
|
<Badge iconSize={80}>
|
|
{@html icon}
|
|
</Badge>
|
|
{collapseMsg}
|
|
</div>
|
|
{/if}
|
|
{unusedMsg}
|
|
{#if collapsed}
|
|
<div>
|
|
{unused.slice(0, maxItems).join(", ")}
|
|
{#if unused.length > maxItems}
|
|
... (+{unused.length - maxItems})
|
|
{/if}
|
|
</div>
|
|
{:else}
|
|
<ul>
|
|
{#each unused as entry}
|
|
<li>{entry}</li>
|
|
{/each}
|
|
</ul>
|
|
{/if}
|
|
</div>
|
|
|
|
<style lang="scss">
|
|
.clickable {
|
|
cursor: pointer;
|
|
font-weight: bold;
|
|
}
|
|
</style>
|