<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 "./layout/Navbar.svelte";
    import HomeIndex from "./home/Index.svelte";
    import BuildReport from "./build/Report.svelte";
    import Header from "./layout/Header.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>


<div class="main-wrapper">
    <div class="sidebar-content">
        <Navbar schema={data.schema}/>
    </div>
    <div class="main-content">
        <Header/>
        <svelte:component this={components[view]} {title} {...data}/>
    </div>
</div>



