<script>
    import Members from "./members/Members.svelte";
    import RecordNotFound from "./records/NotFound.svelte";
    import RecordEdit from "./records/Edit.svelte";
    import ContentIndex from "./content/Index.svelte";
    import {setContext} from "svelte";
    import Navbar from "./Navbar.svelte";
    import HomeIndex from "./home/Index.svelte";
    import BuildReport from "./build/Report.svelte";

    const components = {
        members: Members,
        recordEdit: RecordEdit,
        recordNotFound: RecordNotFound,
        contentIndex: ContentIndex,
        homeIndex: HomeIndex,
        buildReport: BuildReport,
    };

    export let title;
    export let view;
    export let user;
    export let data;
    // export let layout;
    export let channel;

    export let axios;
    export let readableSchemas;


    setContext("axios", axios);
    setContext("channel", channel);
    setContext("readableSchemas", channel.schemas.filter((s) => readableSchemas.includes(s.name)));
    setContext("user", user);

</script>

<Navbar schema={data.schema}/>

<svelte:component this={components[view]} {title} {...data}/>

