<script>
    import Preview from "../../files/Preview.svelte";

    export let record;
    export let field;
    export let graph;


    let filePreviews = graph.edges?.filter((ed) => ed.field === field.name && ed.source === record.id)
        .map((ed) => graph.records.find((r) => r.id === ed.target));
    // if (edges[0]) {
    //     firstRecord = record._children.find((r) => r.data.id === edges[0].to);
    // }

    console.log(filePreviews)
</script>

<!-- {#if firstRecord}
    <Preview record={firstRecord} size="tiny" />
{/if} -->
<div class="d-flex me-1">
    {#each filePreviews as file}
        <div class="me-1">
            <Preview record={file} size="tiny"/>
        </div>
    {/each}
</div>
