2022-05-10 13:52:06 +00:00
|
|
|
import 'preact/debug';
|
2023-01-12 02:14:44 +00:00
|
|
|
import cs from 'classnames';
|
2022-06-20 02:42:34 +00:00
|
|
|
import { h } from 'preact';
|
2022-05-10 13:52:06 +00:00
|
|
|
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';
|
|
|
|
|
2023-01-12 02:14:44 +00:00
|
|
|
import styles from './css/App.module.scss';
|
|
|
|
import componentStyles from './css/Components.module.scss';
|
2022-06-03 22:30:39 +00:00
|
|
|
|
2022-05-10 13:52:06 +00:00
|
|
|
/**
|
|
|
|
* 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 (
|
2023-01-12 02:14:44 +00:00
|
|
|
<div className={cs(styles.container, componentStyles.components)}>
|
2022-05-10 13:52:06 +00:00
|
|
|
<Header e={system.e} />
|
|
|
|
<Apple2
|
|
|
|
gl={gl}
|
|
|
|
{...system}
|
|
|
|
/>
|
2022-06-20 02:42:34 +00:00
|
|
|
</div>
|
2022-05-10 13:52:06 +00:00
|
|
|
);
|
|
|
|
};
|