2023-10-02 23:10:49 +03:00
|
|
|
<script>
|
|
|
|
|
import Icon from "../common/Icon.svelte";
|
2023-10-04 13:32:30 +03:00
|
|
|
import {imgurl} from "../files/imageserver";
|
|
|
|
|
import {getContext} from "svelte";
|
|
|
|
|
|
2023-10-02 23:10:49 +03:00
|
|
|
export let record;
|
|
|
|
|
const channel = getContext("channel");
|
|
|
|
|
export let size = "small";
|
|
|
|
|
export let showFilename = false;
|
|
|
|
|
let imageSide;
|
|
|
|
|
let fileSide;
|
|
|
|
|
let fontSize;
|
|
|
|
|
if (size == "large") {
|
|
|
|
|
imageSide = 256;
|
|
|
|
|
fileSide = 32;
|
|
|
|
|
fontSize = "20";
|
|
|
|
|
} else if (size == "medium") {
|
|
|
|
|
imageSide = 128;
|
|
|
|
|
fileSide = 12;
|
|
|
|
|
fontSize = "17";
|
|
|
|
|
} else if (size == "small") {
|
|
|
|
|
imageSide = 64;
|
|
|
|
|
fileSide = 12;
|
|
|
|
|
fontSize = "15";
|
|
|
|
|
} else if (size == "tiny") {
|
|
|
|
|
imageSide = 42;
|
|
|
|
|
fileSide = 12;
|
|
|
|
|
fontSize = "13";
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
{#if record}
|
|
|
|
|
{#if record._file.mime.startsWith("image")}
|
|
|
|
|
<!-- href={imgurl(record)} -->
|
|
|
|
|
<a
|
2023-10-04 13:32:30 +03:00
|
|
|
href="{channel.lucentUrl}/records/{record.id}"
|
|
|
|
|
title={record._file.path}
|
|
|
|
|
class="d-flex align-items-center justify-content-center "
|
|
|
|
|
style="width:{imageSide}px;height:{imageSide}px"
|
2023-10-02 23:10:49 +03:00
|
|
|
>
|
|
|
|
|
<img
|
2023-10-04 13:32:30 +03:00
|
|
|
class="rounded w-100"
|
2023-10-17 18:56:37 +03:00
|
|
|
src={imgurl(record)}
|
2023-10-04 13:32:30 +03:00
|
|
|
alt={record._file.path}
|
2023-10-02 23:10:49 +03:00
|
|
|
/>
|
|
|
|
|
</a>
|
|
|
|
|
{:else}
|
|
|
|
|
<a
|
2023-10-04 13:32:30 +03:00
|
|
|
href="{channel.lucentUrl}/records/{record.id}"
|
|
|
|
|
title={record._file.path}
|
|
|
|
|
class="btn btn-outline-primary btn-sm d-flex align-items-center justify-content-center"
|
|
|
|
|
style="width:{imageSide}px;height:{imageSide}px"
|
2023-10-02 23:10:49 +03:00
|
|
|
>
|
2023-10-04 13:32:30 +03:00
|
|
|
<Icon icon="file" width={fileSide} height={fileSide}/>
|
2023-10-02 23:10:49 +03:00
|
|
|
<span class="ms-2" style="font-size:{fontSize}px"
|
2023-10-04 13:32:30 +03:00
|
|
|
>.{record._file.path.split(".").pop()}</span
|
2023-10-02 23:10:49 +03:00
|
|
|
>
|
|
|
|
|
</a>
|
|
|
|
|
{/if}
|
|
|
|
|
{/if}
|
|
|
|
|
{#if showFilename}
|
|
|
|
|
<a
|
2023-10-04 13:32:30 +03:00
|
|
|
href="{channel.lucentUrl}/records/{record.id}"
|
|
|
|
|
title={record._file.path}
|
|
|
|
|
class="preview-file-filename lx-small-text text-decoration-none"
|
|
|
|
|
>{record._file.path}</a
|
2023-10-02 23:10:49 +03:00
|
|
|
>
|
|
|
|
|
{/if}
|