import React from 'react';
import { createRoot } from 'react-dom/client';
import { createInertiaApp, Link } from '@inertiajs/react';
import Account from './pages/account/show.jsx';

function Away() {
    return <main><h1>Away</h1><Link href="/account">Account</Link></main>;
}

const pages = { 'account/show': Account, away: Away };
window.fixtureReactVersion = React.version;
createInertiaApp({
    resolve(name) {
        if (!pages[name]) throw new Error(`Missing fixture page: ${name}`);
        return pages[name];
    },
    setup({ el, App, props }) {
        createRoot(el).render(<App {...props} />);
    },
}).catch(error => { window.fixtureFailure = String(error); });
