-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.tsx
More file actions
67 lines (61 loc) · 2.25 KB
/
App.tsx
File metadata and controls
67 lines (61 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Tune Player - A cute music player ❤ *
* Copyright © 2026 Moebytes <moebytes.com> *
* Licensed under CC BY-NC 4.0. See license.txt for details. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
import "bootstrap/dist/css/bootstrap.min.css"
import React, { useEffect } from "react"
import {createRoot} from "react-dom/client"
import {Provider} from "react-redux"
import TitleBar from "./components/TitleBar"
import RecentPlays from "./components/RecentPlays"
import AudioPlayer from "./components/AudioPlayer"
import AudioEffects from "./components/AudioEffects"
import AudioFilters from "./components/AudioFilters"
import MIDISynth from "./components/MIDISynth"
import SearchDialog from "./components/SearchDialog"
import ContextMenu from "./components/ContextMenu"
import LocalStorage from "./LocalStorage"
import store from "./store"
import "./index.less"
const App: React.FunctionComponent = () => {
const onDrop = (event: React.DragEvent) => {
event.preventDefault()
const file = window.webUtils.getPathForFile(event.dataTransfer?.files[0])
if (file) window.ipcRenderer.invoke("upload-file", file)
}
const onDragOver = (event: React.DragEvent) => {
event.stopPropagation()
event.preventDefault()
}
useEffect(() => {
const keyDown = async (event: globalThis.KeyboardEvent) => {
if (event.key === "Enter") {
window.ipcRenderer.invoke("enter-pressed")
}
if (event.key === "Escape") {
window.ipcRenderer.invoke("escape-pressed")
}
}
window.ipcRenderer.on("debug", console.log)
document.addEventListener("keydown", keyDown)
return () => {
document.removeEventListener("keydown", keyDown)
}
}, [])
return (
<main className="app" onDrop={onDrop} onDragOver={onDragOver}>
<TitleBar/>
<ContextMenu/>
<LocalStorage/>
<SearchDialog/>
<AudioEffects/>
<AudioFilters/>
<MIDISynth/>
<RecentPlays/>
<AudioPlayer/>
</main>
)
}
const root = createRoot(document.getElementById("root")!)
root.render(<Provider store={store}><App/></Provider>)