58 lines
1.5 KiB
Svelte
58 lines
1.5 KiB
Svelte
<script>
|
|
import Icon from "../../common/Icon.svelte";
|
|
|
|
import {createEventDispatcher, getContext} from "svelte";
|
|
import Preview from "../../files/Preview.svelte";
|
|
import {previewTitle} from "./../Preview";
|
|
import Status from "./../Status.svelte";
|
|
|
|
const dispatch = createEventDispatcher();
|
|
const channel = getContext("channel");
|
|
export let record;
|
|
export let hasDelete = false;
|
|
|
|
let schema = channel.schemas.find((aschema) => aschema.name === record.schema);
|
|
let cardTitle = previewTitle(channel.schemas, record);
|
|
|
|
function remove(e) {
|
|
e.preventDefault();
|
|
|
|
dispatch("remove", record.id);
|
|
}
|
|
</script>
|
|
|
|
<div class="preview-file">
|
|
<div class="image">
|
|
<Preview {record} size="small"/>
|
|
</div>
|
|
<div class="title">
|
|
<div>
|
|
<a
|
|
class="record-title"
|
|
href="{channel.lucentUrl}/records/{record.id}"
|
|
>
|
|
{cardTitle}
|
|
</a>
|
|
<small class="d-block">
|
|
from {schema.label}
|
|
{#if record.status === "draft"}
|
|
<Status status={record.status}/>
|
|
{/if}
|
|
</small>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
{#if hasDelete}
|
|
<div class="trash-action">
|
|
<button
|
|
class="button"
|
|
on:click={remove}
|
|
>
|
|
<Icon icon="trash-can"/>
|
|
</button>
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
|