<script>

    import PreviewRecord from "./PreviewRecord.svelte";
    import {previewTitle} from "../../records/Preview.js";
    import {getContext} from "svelte";
    import EdgeModal from "../../edges/EdgeModal.svelte";
    const channel = getContext("channel");
    export let record
    export let edge
    export let graph
    export let classes
    export let field

    let schema = channel.schemas.find((aschema) => aschema.name === record.schema);
    let cardTitle = previewTitle({data:edge.data,schema:field.data}, graph);
    let modal;

    function edit(e){
        e.preventDefault();
        modal.open();
    }
</script>


<button class="btn btn-primary btn-sm" on:click={edit}>{cardTitle}</button>
<PreviewRecord {record} {graph} {classes} />
<EdgeModal bind:this={modal} />
<style>

</style>