char-slop/chordpad.vibed.software

git clone https://git.t4t.associates/char-slop/chordpad.vibed.software

Charlotte Sominitial commit3c7bc6e

main
995 B33 linesraw
1import type { JSX } from "@char/aftercare/jsx-runtime";
2import { importMidi } from "./actions.ts";
3import { Hints } from "./hints.tsx";
4import { ChordPanel } from "./chord-panel.tsx";
5import { installClipboard, installKeys } from "./keys.ts";
6import { Palette } from "./palette.tsx";
7import { Timeline } from "./timeline.tsx";
8import { Toolbar } from "./toolbar.tsx";
9
10export function App(): JSX.Element {
11  installKeys();
12  installClipboard();
13  addEventListener("dragover", e => {
14    if (e.dataTransfer?.types.includes("Files")) e.preventDefault();
15  });
16  addEventListener("drop", e => {
17    if (!e.dataTransfer?.types.includes("Files")) return;
18    // any dropped file would otherwise replace the page
19    e.preventDefault();
20    for (const file of e.dataTransfer.files) {
21      if (/\.midi?$/i.test(file.name)) void importMidi(file);
22    }
23  });
24  return (
25    <div class="app">
26      <Toolbar />
27      <Timeline />
28      <ChordPanel />
29      <Palette />
30      <Hints />
31    </div>
32  );
33}