apple2js/js/components/debugger/Debugger.tsx

45 lines
1.3 KiB
TypeScript
Raw Normal View History

2022-07-14 03:34:50 +00:00
import { h } from 'preact';
2022-07-23 19:00:38 +00:00
import { useState } from 'preact/hooks';
2022-07-14 03:34:50 +00:00
import { Inset } from '../Inset';
import { Tab, Tabs } from '../Tabs';
import { Apple2 } from 'js/apple2';
import { Applesoft } from './Applesoft';
2022-07-23 19:00:38 +00:00
import { CPU } from './CPU';
import { Disks } from './Disks';
2022-07-14 03:34:50 +00:00
import { Memory } from './Memory';
import { VideoModes } from './VideoModes';
2022-07-23 19:00:38 +00:00
import styles from './css/Debugger.module.css';
2022-07-14 03:34:50 +00:00
interface DebuggerProps {
apple2: Apple2 | undefined;
}
export const Debugger = ({ apple2 }: DebuggerProps) => {
const [selected, setSelected] = useState(0);
if (!apple2) {
return null;
}
return (
<Inset className={styles.inset}>
<Tabs setSelected={setSelected}>
<Tab>CPU</Tab>
<Tab>Video</Tab>
<Tab>Memory</Tab>
2022-07-23 19:00:38 +00:00
<Tab>Disks</Tab>
2022-07-14 03:34:50 +00:00
<Tab>Applesoft</Tab>
</Tabs>
<div className={styles.debugger}>
{selected === 0 ? <CPU apple2={apple2} /> : null}
{selected === 1 ? <VideoModes apple2={apple2} /> : null}
{selected === 2 ? <Memory apple2={apple2} /> : null}
2022-07-23 19:00:38 +00:00
{selected === 3 ? <Disks apple2={apple2} /> : null}
{selected === 4 ? <Applesoft apple2={apple2} /> : null}
2022-07-14 03:34:50 +00:00
</div>
</Inset>
);
};