2022-12-01 10:24:26 +01:00
|
|
|
<!--
|
|
|
|
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 "@tslib/ftl";
|
|
|
|
import { getPlatformString } from "@tslib/shortcuts";
|
|
|
|
|
2023-09-09 01:00:55 +02:00
|
|
|
import LabelButton from "./LabelButton.svelte";
|
|
|
|
import Shortcut from "./Shortcut.svelte";
|
2022-12-01 10:24:26 +01:00
|
|
|
|
|
|
|
export let path: string;
|
|
|
|
export let onImport: () => void;
|
|
|
|
|
|
|
|
const keyCombination = "Control+Enter";
|
|
|
|
|
|
|
|
function basename(path: String): String {
|
|
|
|
return path.split(/[\\/]/).pop()!;
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="sticky-header d-flex flex-row justify-content-between">
|
|
|
|
<div class="filename">{basename(path)}</div>
|
|
|
|
<div class="accept">
|
|
|
|
<LabelButton
|
|
|
|
primary
|
|
|
|
tooltip={getPlatformString(keyCombination)}
|
|
|
|
on:click={onImport}
|
|
|
|
--border-left-radius="5px"
|
|
|
|
--border-right-radius="5px"
|
|
|
|
>
|
|
|
|
<div class="import">{tr.actionsImport()}</div>
|
|
|
|
</LabelButton>
|
|
|
|
<Shortcut {keyCombination} on:action={onImport} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.sticky-header {
|
|
|
|
position: sticky;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
z-index: 10;
|
|
|
|
|
|
|
|
margin: 0;
|
|
|
|
padding: 0.5rem;
|
|
|
|
|
|
|
|
background: var(--canvas);
|
|
|
|
border-bottom: 1px solid var(--border);
|
|
|
|
|
|
|
|
.import {
|
|
|
|
margin-inline: 0.75rem;
|
|
|
|
}
|
|
|
|
}
|
2023-11-05 03:43:43 +01:00
|
|
|
|
|
|
|
.filename {
|
|
|
|
word-break: break-word;
|
|
|
|
}
|
2022-12-01 10:24:26 +01:00
|
|
|
</style>
|