diff --git a/src/App.tsx b/src/App.tsx deleted file mode 100644 index 4113e3e..0000000 --- a/src/App.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { useEffect, useState } from 'react' -import './App.scss' -import Sidebar from './componets/Sidebar' -import Settings from './routes/Settings' -import Installs from './routes/Installs' - -export default function App () { - const [hash, setHash] = useState(window.location.hash || '#installs') - - useEffect(() => { - const onHashChange = () => setHash(window.location.hash || '#installs') - window.addEventListener('hashchange', onHashChange) - return () => window.removeEventListener('hashchange', onHashChange) - }, []) - - useEffect(() => { - const handler = (e: MouseEvent) => e.preventDefault() - document.addEventListener('contextmenu', handler) - return () => document.removeEventListener('contextmenu', handler) - }, []) - - function renderContent() { - if (hash === "#installs") { - return - } else if (hash === "#settings") { - return - } - return null - } - - return ( - <> - -
- {renderContent()} -
- - ) -} diff --git a/src/App.scss b/src/Globals.scss similarity index 100% rename from src/App.scss rename to src/Globals.scss diff --git a/src/main.tsx b/src/main.tsx index 197a6e3..8a36309 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,6 +1,43 @@ -import React from 'react' +import React, { useEffect, useState } from 'react' import ReactDOM from 'react-dom/client' -import App from './App' +import Installs from './routes/Installs' +import Settings from './routes/Settings' +import Sidebar from './componets/Sidebar' +import './Globals.scss' + +function App () { + const [hash, setHash] = useState(window.location.hash || '#installs') + + useEffect(() => { + const onHashChange = () => setHash(window.location.hash || '#installs') + window.addEventListener('hashchange', onHashChange) + return () => window.removeEventListener('hashchange', onHashChange) + }, []) + + useEffect(() => { + const handler = (e: MouseEvent) => e.preventDefault() + document.addEventListener('contextmenu', handler) + return () => document.removeEventListener('contextmenu', handler) + }, []) + + function renderContent() { + if (hash === "#installs") { + return + } else if (hash === "#settings") { + return + } + return null + } + + return ( + <> + +
+ {renderContent()} +
+ + ) +} ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(