Implement new structure

This commit is contained in:
Asher
2020-02-04 13:27:46 -06:00
parent ef8da3864f
commit b29346ecdf
94 changed files with 12427 additions and 4936 deletions

37
src/browser/app.tsx Normal file
View File

@@ -0,0 +1,37 @@
import * as React from "react"
import { Application } from "../common/api"
import { Route, Switch } from "react-router-dom"
import { HttpError } from "../common/http"
import { Modal } from "./components/modal"
import { getOptions } from "../common/util"
const App: React.FunctionComponent = () => {
const [authed, setAuthed] = React.useState<boolean>(false)
const [app, setApp] = React.useState<Application>()
const [error, setError] = React.useState<HttpError | Error | string>()
React.useEffect(() => {
getOptions()
}, [])
if (typeof window !== "undefined") {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
;(window as any).setAuthed = setAuthed
}
return (
<>
<Switch>
<Route path="/vscode" render={(): React.ReactElement => <iframe id="iframe" src="/vscode-embed"></iframe>} />
<Route
path="/"
render={(): React.ReactElement => (
<Modal app={app} setApp={setApp} authed={authed} error={error} setError={setError} />
)}
/>
</Switch>
</>
)
}
export default App