mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-04 17:07:22 +00:00
Cleanup
This commit is contained in:
parent
ae31af0106
commit
675a84c14b
13 changed files with 34 additions and 54 deletions
|
|
@ -11,5 +11,6 @@ export default function ({ theme, setLocation, buildLink }) {
|
|||
return (
|
||||
<input
|
||||
type='file'
|
||||
onChange={fileInputHandler} />)
|
||||
onChange={fileInputHandler} />
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,5 +17,6 @@ export default function ({ theme, setLocation, buildLink }) {
|
|||
<input
|
||||
type='text'
|
||||
placeholder='https://...'
|
||||
onKeyPress={onKeyPress} />)
|
||||
onKeyPress={onKeyPress} />
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ const keyCodes = {
|
|||
KEY_LEFT: 37,
|
||||
KEY_UP: 38,
|
||||
KEY_RIGHT: 39,
|
||||
KEY_DOWN: 40}
|
||||
KEY_DOWN: 40
|
||||
}
|
||||
|
||||
const keyNames = {
|
||||
[keyCodes.KEY_BACKSPACE]: 'delete',
|
||||
|
|
@ -28,7 +29,8 @@ const keyNames = {
|
|||
[keyCodes.KEY_LEFT]: 'left',
|
||||
[keyCodes.KEY_UP]: 'up',
|
||||
[keyCodes.KEY_RIGHT]: 'right',
|
||||
[keyCodes.KEY_DOWN]: 'down'}
|
||||
[keyCodes.KEY_DOWN]: 'down'
|
||||
}
|
||||
/* eslint-enable */
|
||||
|
||||
export default function ({ currentWindow, inputType, sendMessage }) {
|
||||
|
|
@ -62,18 +64,15 @@ export default function ({ currentWindow, inputType, sendMessage }) {
|
|||
|
||||
const inputHandlers = {
|
||||
char: {
|
||||
placeholder: 'Press any key',
|
||||
onKeyDown: charHandler
|
||||
},
|
||||
line: {
|
||||
placeholder: ' > ',
|
||||
onKeyPress: lineHandler
|
||||
}
|
||||
}
|
||||
|
||||
const placeholder = {
|
||||
char: 'Press any key',
|
||||
line: ' > '
|
||||
}
|
||||
|
||||
const enterFullscreen = _ =>
|
||||
document.documentElement.requestFullscreen()
|
||||
|
||||
|
|
@ -82,7 +81,6 @@ export default function ({ currentWindow, inputType, sendMessage }) {
|
|||
className='inputBox'
|
||||
ref={inputEl}
|
||||
value={inputText}
|
||||
placeholder={placeholder[inputType]}
|
||||
autofocus
|
||||
autocomplete='off'
|
||||
onDblClick={enterFullscreen}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ const INITIAL_STATUS = {
|
|||
}
|
||||
|
||||
const runMachine = ({ Engine, file, handlers }) => {
|
||||
console.log('runMachine')
|
||||
|
||||
const vm = new Engine()
|
||||
const { glkInterface, sendFn } = CheapGlkOte(handlers)
|
||||
|
||||
|
|
@ -117,5 +115,6 @@ export default function ({ vmParts: { file, engine } }) {
|
|||
inputType,
|
||||
sendMessage
|
||||
}} />
|
||||
</section>)
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,20 @@
|
|||
import { h } from 'preact'
|
||||
import { Link } from 'wouter-preact'
|
||||
|
||||
const fail = details => (
|
||||
<div class='status fail'>
|
||||
<h1>Error</h1>
|
||||
<h1>
|
||||
Error
|
||||
</h1>
|
||||
{details.map(x => (<p>{x}</p>))}
|
||||
<hr />
|
||||
<a href='/'>
|
||||
<Link href='/'>
|
||||
Home
|
||||
</a>
|
||||
</Link>
|
||||
|
|
||||
<a href='https://github.com/He4eT/ifplayer/issues'>
|
||||
<a
|
||||
target='_blank'
|
||||
href='https://github.com/He4eT/ifplayer/issues'>
|
||||
Report bug
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
// import CheapGlkOte from 'cheap-glkote'
|
||||
// import engine from 'emglken/src/tads.js'
|
||||
|
||||
// import { engineByFilename } from './engines'
|
||||
|
||||
// export const fetchGameFile = url => fetch(url)
|
||||
// .then(response => (console.log(response), response))
|
||||
// .then(response => response.blob())
|
||||
// .then(blob => new Response(blob).arrayBuffer())
|
||||
// .then(buffer => new Uint8Array(buffer))
|
||||
// .then(file => {
|
||||
// const { glkInterface, sendFn } = CheapGlkOte({
|
||||
// onUpdateContent: messages => console.log(messages)
|
||||
// })
|
||||
// window.send = sendFn
|
||||
|
||||
// const vm = new engine()
|
||||
// vm.prepare(file, glkInterface)
|
||||
// vm.start()
|
||||
// })
|
||||
// .catch(console.log)
|
||||
|
|
@ -65,4 +65,3 @@
|
|||
66% { content: '..'; }
|
||||
100% { content: '...'; }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,5 +12,6 @@ export default function ({ themeEngine }) {
|
|||
onChange={({ target }) =>
|
||||
themeEngine.setTheme(target.value)}>
|
||||
{options}
|
||||
</select>)
|
||||
</select>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ function App () {
|
|||
</Route>
|
||||
<Route path='/play/:theme/:encodedUrl'>
|
||||
{params => <PlayerView {...{
|
||||
setTheme: themeEngine.setTheme,
|
||||
...themeEngine,
|
||||
...params
|
||||
}} />}
|
||||
</Route>
|
||||
|
|
|
|||
|
|
@ -2,11 +2,6 @@
|
|||
padding: var(--inner-padding);
|
||||
}
|
||||
|
||||
.view.home summary {
|
||||
display: inline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.view.home input,
|
||||
.view.home select {
|
||||
box-sizing: border-box;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useState, useCallback } from 'preact/hooks'
|
||||
import { useState } from 'preact/hooks'
|
||||
|
||||
import '~/src/style/themes.css'
|
||||
|
||||
|
|
@ -12,8 +12,7 @@ const themes = [
|
|||
'solarized-light',
|
||||
'solarized-light-borders',
|
||||
'solarized-dark',
|
||||
'solarized-dark-borders',
|
||||
'_raw'
|
||||
'solarized-dark-borders'
|
||||
]
|
||||
|
||||
const DEFAULT_THEME = themes[0]
|
||||
|
|
@ -27,9 +26,9 @@ export const useThemeEngine = (initialTheme = DEFAULT_THEME) => {
|
|||
const [currentTheme, setCurrentTheme] =
|
||||
useState(initialTheme)
|
||||
|
||||
const setTheme = useCallback(theme => {
|
||||
const setTheme = theme => {
|
||||
setCurrentTheme(assertTheme(theme))
|
||||
}, [currentTheme])
|
||||
}
|
||||
|
||||
return { currentTheme, setTheme, themes }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,5 @@ export default function ({ themeEngine }) {
|
|||
</label>
|
||||
</p>
|
||||
</section>
|
||||
|
||||
</main>)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ import { Link } from 'wouter-preact'
|
|||
export default () => (
|
||||
<main>
|
||||
<div class='status'>
|
||||
<h1>404</h1>
|
||||
<p>Page not found</p>
|
||||
<h1>
|
||||
404
|
||||
</h1>
|
||||
<p>
|
||||
Page not found
|
||||
</p>
|
||||
<hr />
|
||||
<Link href='/'>
|
||||
Home
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue