68092082f2
* Enable access to old notetype name * Set minimum height for ChangeNotetypeDialog * Add bootstrap icons to change-notetype * Move alert up and make it collapsible * Tweak some CSS - Add variables --sticky-bg and --sticky-border to StickyContainer - Tweak base.css * Add translatable string "(Nothing)" * Rework ChangeNotetype screen * Initially load option at newIndex and remaining options on focus Optimization for big notetypes: Should increase efficiency from O(n²) to O(n). Test on notetype with 500 templates shows significant improvement in load time (~10s down to ~1s). * Try to satisfy rust test * Change arrow direction depending on reading direction + add 0.5em top padding to main * Create Alert.svelte * Introduce CSS variable --pane-bg * Revert "Initially load option at newIndex and remaining options on focus" This reverts commit f42beee45c27dba9433d76217fb583b117fb5231. * Final cleanup * Refine padding/gutter
62 lines
1.7 KiB
Svelte
62 lines
1.7 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 * as tr from "../lib/ftl";
|
|
import Badge from "../components/Badge.svelte";
|
|
import Alert from "./Alert.svelte";
|
|
import Container from "../components/Container.svelte";
|
|
import Row from "../components/Row.svelte";
|
|
import Col from "../components/Col.svelte";
|
|
import { exclamationIcon } from "./icons";
|
|
import { ChangeNotetypeState, MapContext } from "./lib";
|
|
import StickyContainer from "../components/StickyContainer.svelte";
|
|
|
|
export let state: ChangeNotetypeState;
|
|
export let ctx: MapContext;
|
|
|
|
$: info = state.info;
|
|
|
|
let heading: string =
|
|
ctx === MapContext.Field
|
|
? tr.changeNotetypeFields()
|
|
: tr.changeNotetypeTemplates();
|
|
|
|
$: unused = $info.unusedItems(ctx);
|
|
</script>
|
|
|
|
<StickyContainer
|
|
--sticky-bg={"var(--pane-bg)"}
|
|
--sticky-border="var(--border)"
|
|
--sticky-borders="0px 0 1px"
|
|
>
|
|
<h1>
|
|
{heading}
|
|
{#if unused.length > 0}
|
|
<Badge iconSize={80}>
|
|
{@html exclamationIcon}
|
|
</Badge>
|
|
{/if}
|
|
</h1>
|
|
|
|
{#if unused.length > 0}
|
|
<Alert {unused} {ctx} />
|
|
{/if}
|
|
|
|
{#if $info.templates}
|
|
<Container --gutter-inline="0.5rem" --gutter-block="0.2rem">
|
|
<Row --cols={2}>
|
|
<Col --col-size={1}><b>{tr.changeNotetypeCurrent()}</b></Col>
|
|
<Col --col-size={1}><b>{tr.changeNotetypeNew()}</b></Col>
|
|
</Row>
|
|
</Container>
|
|
{/if}
|
|
</StickyContainer>
|
|
|
|
<style lang="scss">
|
|
h1 {
|
|
padding-top: 0.5em;
|
|
}
|
|
</style>
|