mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
4a188a9a5c
First pass at a Preact UI, still short some major features but full proof of concept.
36 lines
951 B
TypeScript
36 lines
951 B
TypeScript
import 'preact/debug';
|
|
import { h, Fragment } from 'preact';
|
|
import { Header } from './Header';
|
|
import { Apple2 } from './Apple2';
|
|
import { usePrefs } from './hooks/usePrefs';
|
|
import { SYSTEM_TYPE_APPLE2E } from '../ui/system';
|
|
import { SCREEN_GL } from '../ui/screen';
|
|
import { defaultSystem, systemTypes } from './util/systems';
|
|
|
|
/**
|
|
* Top level application component, provides the parameters
|
|
* needed by the Apple2 component to bootstrap itself.
|
|
*
|
|
* @returns Application component
|
|
*/
|
|
export const App = () => {
|
|
const prefs = usePrefs();
|
|
const systemType = prefs.readPref(SYSTEM_TYPE_APPLE2E, 'apple2enh');
|
|
const gl = prefs.readPref(SCREEN_GL, 'true') === 'true';
|
|
|
|
const system = {
|
|
...defaultSystem,
|
|
...(systemTypes[systemType] || {})
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<Header e={system.e} />
|
|
<Apple2
|
|
gl={gl}
|
|
{...system}
|
|
/>
|
|
</>
|
|
);
|
|
};
|