mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-04 17:07:22 +00:00
Linting
This commit is contained in:
parent
3288234f36
commit
7a96d99055
21 changed files with 174 additions and 170 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { h } from 'preact'
|
||||
|
||||
export default function ({ theme, setLocation, buildLink }) {
|
||||
export default function LocalFileSelector ({ theme, setLocation, buildLink }) {
|
||||
const fileInputHandler = ({ target }) => {
|
||||
const file = target.files[0]
|
||||
const url = `${URL.createObjectURL(file)}#${file.name}`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { h } from 'preact'
|
||||
|
||||
export default function ({ theme, setLocation, buildLink }) {
|
||||
export default function TargetURLSelector ({ theme, setLocation, buildLink }) {
|
||||
const urlRE = /^(http|https):\/\/[^ "]+$/
|
||||
|
||||
const onKeyPress = ({ keyCode, target }) => {
|
||||
|
|
|
|||
|
|
@ -2,22 +2,24 @@ import { h } from 'preact'
|
|||
import { Link } from 'wouter-preact'
|
||||
|
||||
import {
|
||||
buildPlayLinkHref
|
||||
buildPlayLinkHref,
|
||||
} from '~/src/utils/utils.routing'
|
||||
|
||||
export default ({ name, ifdb, url }) => (
|
||||
<div>
|
||||
<h4>{name}</h4>
|
||||
<a
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
href={ifdb}>
|
||||
IFDB page
|
||||
</a>
|
||||
<span> | </span>
|
||||
<Link
|
||||
href={buildPlayLinkHref({ url })}>
|
||||
Play
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
export default function GameEntry ({ name, ifdb, url }) {
|
||||
return (
|
||||
<div>
|
||||
<h4>{name}</h4>
|
||||
<a
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
href={ifdb}>
|
||||
IFDB page
|
||||
</a>
|
||||
<span> | </span>
|
||||
<Link
|
||||
href={buildPlayLinkHref({ url })}>
|
||||
Play
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { useEffect, useState } from 'preact/hooks'
|
|||
|
||||
import TextMessage from './TextMessage'
|
||||
|
||||
export default function ({ inbox, currentWindow }) {
|
||||
export default function GridBuffer ({ inbox, currentWindow }) {
|
||||
const [prevMessages, setPrevMessages] = useState([])
|
||||
const [messages, setMessages] = useState([])
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ export default function ({ inbox, currentWindow }) {
|
|||
|
||||
const currentInbox = currentInboxObj?.lines ?? []
|
||||
|
||||
const newOrPrev = (cur, prev) => i => {
|
||||
const newOrPrev = (cur, prev) => (i) => {
|
||||
const byId = (list, i) =>
|
||||
list.find(({ line }) => line === i)
|
||||
|
||||
|
|
@ -31,23 +31,23 @@ export default function ({ inbox, currentWindow }) {
|
|||
|
||||
const rawMessagesContent =
|
||||
rawMessages
|
||||
.map(x => x.content)
|
||||
.map((x) => x.content)
|
||||
.map(([x]) => x)
|
||||
.map(({ text }) => text)
|
||||
.map(text => text.trim())
|
||||
.map((text) => text.trim())
|
||||
|
||||
const isEmpty =
|
||||
rawMessagesContent
|
||||
.map(text => text.length)
|
||||
.every(l => l === 0)
|
||||
.map((text) => text.length)
|
||||
.every((l) => l === 0)
|
||||
|
||||
const messages =
|
||||
rawMessagesContent
|
||||
.map(text =>
|
||||
.map((text) =>
|
||||
text.replace(' ', ' / '))
|
||||
.map(text => ({
|
||||
.map((text) => ({
|
||||
style: 'grid',
|
||||
text
|
||||
text,
|
||||
}))
|
||||
|
||||
setMessages(isEmpty ? [] : messages)
|
||||
|
|
@ -56,7 +56,7 @@ export default function ({ inbox, currentWindow }) {
|
|||
return (
|
||||
<section
|
||||
className='buffer gridBuffer'>
|
||||
{messages.map(TextMessage)}
|
||||
{messages.map(TextMessage)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@ const keyNames = {
|
|||
}
|
||||
/* eslint-enable */
|
||||
|
||||
export default function ({
|
||||
export default function InputBox ({
|
||||
inputType,
|
||||
windows,
|
||||
currentWindowId,
|
||||
sendMessage
|
||||
sendMessage,
|
||||
}) {
|
||||
const [targetWindow, setTargetWindow] = useState(null)
|
||||
const [inputText, setInputText] = useState('')
|
||||
|
|
@ -56,7 +56,7 @@ export default function ({
|
|||
id === currentWindowId))
|
||||
}, [currentWindowId, windows])
|
||||
|
||||
const send = message => {
|
||||
const send = (message) => {
|
||||
sendMessage(
|
||||
message,
|
||||
inputType,
|
||||
|
|
@ -65,12 +65,12 @@ export default function ({
|
|||
setInputText('')
|
||||
}
|
||||
|
||||
const charHandler = event =>
|
||||
const charHandler = (event) =>
|
||||
(event.keyCode === 229
|
||||
? charHandlerMobile
|
||||
: charHandlerDefault)(event)
|
||||
|
||||
const charHandlerDefault = event => {
|
||||
const charHandlerDefault = (event) => {
|
||||
event.preventDefault()
|
||||
|
||||
const key =
|
||||
|
|
@ -80,8 +80,8 @@ export default function ({
|
|||
send(key)
|
||||
}
|
||||
|
||||
const charHandlerMobile = event =>
|
||||
setTimeout(_ => {
|
||||
const charHandlerMobile = (event) =>
|
||||
setTimeout(() => {
|
||||
send(event.target.value.slice(-1).toUpperCase())
|
||||
setInputText('')
|
||||
})
|
||||
|
|
@ -96,7 +96,7 @@ export default function ({
|
|||
if (keyCode === keyCodes.KEY_UP) {
|
||||
setInputText(lastInput)
|
||||
|
||||
setTimeout(_ => {
|
||||
setTimeout(() => {
|
||||
const end = lastInput.length
|
||||
inputEl.current.setSelectionRange(end, end)
|
||||
}, 0)
|
||||
|
|
@ -113,16 +113,16 @@ export default function ({
|
|||
autocorrect: 'off',
|
||||
spellcheck: 'false',
|
||||
placeholder: 'Press any key here',
|
||||
onKeyDown: charHandler
|
||||
onKeyDown: charHandler,
|
||||
},
|
||||
line: {
|
||||
placeholder: ' > ',
|
||||
onKeyDown: lineArrowHandler,
|
||||
onKeyPress: lineHandler
|
||||
}
|
||||
onKeyPress: lineHandler,
|
||||
},
|
||||
}
|
||||
|
||||
const enterFullscreen = _ =>
|
||||
const enterFullscreen = () =>
|
||||
document.documentElement.requestFullscreen()
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import './player.css'
|
|||
|
||||
const INITIAL_STATUS = {
|
||||
stage: 'loading',
|
||||
details: ['Preparing']
|
||||
details: ['Preparing'],
|
||||
}
|
||||
|
||||
const runMachine = ({ engine: Engine, file, handlers }) => {
|
||||
|
|
@ -28,8 +28,8 @@ const runMachine = ({ engine: Engine, file, handlers }) => {
|
|||
return { sendFn, instance: vm }
|
||||
}
|
||||
|
||||
export default function ({
|
||||
vmParts: { file, engine }, singleWindow
|
||||
export default function Player ({
|
||||
vmParts: { file, engine }, singleWindow,
|
||||
}) {
|
||||
const [status, setStatus] = useState(INITIAL_STATUS)
|
||||
|
||||
|
|
@ -50,28 +50,28 @@ export default function ({
|
|||
setWindows,
|
||||
setCurrentWindowId,
|
||||
setInputType,
|
||||
setInbox
|
||||
})
|
||||
setInbox,
|
||||
}),
|
||||
})
|
||||
|
||||
setVm(vm)
|
||||
}, [file, engine])
|
||||
|
||||
useEffect(() => {
|
||||
setSendMessage(_ => vm
|
||||
setSendMessage(() => vm
|
||||
? vm.sendFn
|
||||
: null)
|
||||
}, [vm])
|
||||
|
||||
const textWindow = inbox => currentWindow => {
|
||||
const textWindow = (inbox) => (currentWindow) => {
|
||||
const props = {
|
||||
inbox,
|
||||
currentWindow
|
||||
currentWindow,
|
||||
}
|
||||
|
||||
return ({
|
||||
buffer: <TextBuffer {...props} />,
|
||||
grid: <GridBuffer {...props} />
|
||||
grid: <GridBuffer {...props} />,
|
||||
})[currentWindow.type]
|
||||
}
|
||||
|
||||
|
|
@ -82,18 +82,18 @@ export default function ({
|
|||
? (<Status {...status} />)
|
||||
: (<section className='ifplayer'>
|
||||
<section className='output'>{
|
||||
windows
|
||||
.sort(byTop)
|
||||
.filter(singleWindow
|
||||
? ({ id }) => id === currentWindowId
|
||||
: _ => true)
|
||||
.map(textWindow(inbox))}
|
||||
windows
|
||||
.sort(byTop)
|
||||
.filter(singleWindow
|
||||
? ({ id }) => id === currentWindowId
|
||||
: () => true)
|
||||
.map(textWindow(inbox))}
|
||||
</section>
|
||||
<InputBox {...{
|
||||
inputType,
|
||||
windows,
|
||||
currentWindowId,
|
||||
sendMessage
|
||||
sendMessage,
|
||||
}} />
|
||||
</section>)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import { h } from 'preact'
|
||||
import { Link } from 'wouter-preact'
|
||||
|
||||
const fail = details => (
|
||||
const fail = (details) => (
|
||||
<div className='status fail'>
|
||||
<h1>
|
||||
Error
|
||||
</h1>
|
||||
{details.map(x => (<p key={x}>{x}</p>))}
|
||||
{details.map((x) => (<p key={x}>{x}</p>))}
|
||||
<hr />
|
||||
<Link href='/'>
|
||||
Home
|
||||
|
|
@ -21,9 +21,9 @@ const fail = details => (
|
|||
</div>
|
||||
)
|
||||
|
||||
const loading = details => (
|
||||
const loading = (details) => (
|
||||
<div className='status loading'>
|
||||
{details.map(x => (<div key={x}>{x}</div>))}
|
||||
{details.map((x) => (<div key={x}>{x}</div>))}
|
||||
</div>
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ import { useEffect, useRef, useState } from 'preact/hooks'
|
|||
|
||||
import TextMessage from './TextMessage'
|
||||
|
||||
const isFakeStatus = w =>
|
||||
const isFakeStatus = (w) =>
|
||||
w.height < 5
|
||||
|
||||
const trimInputPrompt = messages =>
|
||||
const trimInputPrompt = (messages) =>
|
||||
messages.length < 1
|
||||
? messages
|
||||
: messages.slice(-1)[0].text === '>'
|
||||
|
|
@ -21,7 +21,7 @@ const parseInbox = (inbox, currentWindow) => {
|
|||
if (!currentInbox) {
|
||||
return {
|
||||
clear: false,
|
||||
incoming: []
|
||||
incoming: [],
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -45,11 +45,11 @@ const parseInbox = (inbox, currentWindow) => {
|
|||
incoming,
|
||||
clear: isFakeStatus(currentWindow)
|
||||
? true
|
||||
: currentInbox.clear
|
||||
: currentInbox.clear,
|
||||
}
|
||||
}
|
||||
|
||||
export default function ({ inbox, currentWindow }) {
|
||||
export default function TextBuffer ({ inbox, currentWindow }) {
|
||||
const [messages, setMessages] = useState([])
|
||||
const textBufferEl = useRef(null)
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ export default function ({ inbox, currentWindow }) {
|
|||
const { incoming, clear } =
|
||||
parseInbox(inbox, currentWindow)
|
||||
|
||||
setMessages(messages => clear
|
||||
setMessages((messages) => clear
|
||||
? incoming
|
||||
: messages.concat(incoming))
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ export default function ({ inbox, currentWindow }) {
|
|||
tabindex='0'
|
||||
ref={textBufferEl}
|
||||
className={classes}>
|
||||
{messages.map(TextMessage)}
|
||||
{messages.map(TextMessage)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { h } from 'preact'
|
||||
|
||||
export default function ({ style, text }) {
|
||||
export default function TextMessage ({ style, text }) {
|
||||
const defaultContent = (
|
||||
<span className={['message', style].join(' ')}>
|
||||
{text}
|
||||
|
|
@ -11,6 +11,6 @@ export default function ({ style, text }) {
|
|||
input: (<span className='message input'>> {text}</span>),
|
||||
subheader: (<strong className='message subheader'>{text}</strong>),
|
||||
emphasized: (<em className='message emphasized'>{text}</em>),
|
||||
endOfLine: (<br />)
|
||||
endOfLine: (<br />),
|
||||
})[style] || defaultContent
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,16 +8,16 @@ import Status from './Status'
|
|||
|
||||
const INITIAL_STATUS = {
|
||||
stage: 'loading',
|
||||
details: ['Loading']
|
||||
details: ['Loading'],
|
||||
}
|
||||
|
||||
const prepareVM = ({ url, setStatus, setParts }) => {
|
||||
const st = (stage, details) => args => {
|
||||
const st = (stage, details) => (args) => {
|
||||
setStatus({ stage, details: [details] })
|
||||
return args
|
||||
}
|
||||
|
||||
const cleanUrl = url =>
|
||||
const cleanUrl = (url) =>
|
||||
url.startsWith('blob:')
|
||||
? url.replace(/#(.*)$/g, '')
|
||||
: url
|
||||
|
|
@ -27,21 +27,21 @@ const prepareVM = ({ url, setStatus, setParts }) => {
|
|||
.then(cleanUrl)
|
||||
.then(fetch)
|
||||
.then(st('loading', 'Processing file'))
|
||||
.then(response => response.arrayBuffer())
|
||||
.then(arrayBuffer => new Uint8Array(arrayBuffer))
|
||||
.then((response) => response.arrayBuffer())
|
||||
.then((arrayBuffer) => new Uint8Array(arrayBuffer))
|
||||
.then(st('loading', 'Downloading engine'))
|
||||
.then(file => setParts({
|
||||
.then((file) => setParts({
|
||||
file,
|
||||
engine: engineByFilename(url)
|
||||
engine: engineByFilename(url),
|
||||
}))
|
||||
.then(st('loading', 'Running'))
|
||||
.catch(e => {
|
||||
.catch((e) => {
|
||||
console.error(e)
|
||||
setStatus({ stage: 'fail', details: [e.message, url] })
|
||||
})
|
||||
}
|
||||
|
||||
export default function ({ url, singleWindow }) {
|
||||
export default function UrlPlayer ({ url, singleWindow }) {
|
||||
const [status, setStatus] = useState(INITIAL_STATUS)
|
||||
const [vmParts, setParts] = useState(null)
|
||||
|
||||
|
|
@ -54,8 +54,8 @@ export default function ({ url, singleWindow }) {
|
|||
|
||||
return vmParts
|
||||
? (<Player {...{
|
||||
vmParts,
|
||||
singleWindow
|
||||
}} />)
|
||||
vmParts,
|
||||
singleWindow,
|
||||
}} />)
|
||||
: (<Status {...status} />)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,27 +7,27 @@ const formats = [
|
|||
{
|
||||
id: 'bocfel',
|
||||
extensions: /z([3458]|blorb)$/,
|
||||
engine: bocfel
|
||||
engine: bocfel,
|
||||
},
|
||||
{
|
||||
id: 'git',
|
||||
extensions: /(gblorb|ulx)$/,
|
||||
engine: git
|
||||
engine: git,
|
||||
},
|
||||
{
|
||||
id: 'hugo',
|
||||
extensions: /hex$/,
|
||||
engine: hugo
|
||||
engine: hugo,
|
||||
},
|
||||
{
|
||||
id: 'tads',
|
||||
extensions: /(gam|t3)$/,
|
||||
engine: tads
|
||||
}
|
||||
engine: tads,
|
||||
},
|
||||
]
|
||||
|
||||
export const engineByFilename = filename => {
|
||||
const format = formats.find(x =>
|
||||
export const engineByFilename = (filename) => {
|
||||
const format = formats.find((x) =>
|
||||
x.extensions.test(filename))
|
||||
|
||||
if (format) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import {
|
||||
compressToUTF16 as encode,
|
||||
decompressFromUTF16 as decode
|
||||
decompressFromUTF16 as decode,
|
||||
} from 'lz-string'
|
||||
|
||||
export const Handlers = ({
|
||||
|
|
@ -8,33 +8,33 @@ export const Handlers = ({
|
|||
setWindows,
|
||||
setCurrentWindowId,
|
||||
setInputType,
|
||||
setInbox
|
||||
setInbox,
|
||||
}) => ({
|
||||
onInit: _ => {
|
||||
onInit: () => {
|
||||
setStatus({ stage: 'ready' })
|
||||
},
|
||||
/* */
|
||||
onUpdateWindows: windows => {
|
||||
onUpdateWindows: (windows) => {
|
||||
setWindows(windows)
|
||||
},
|
||||
onUpdateInputs: data => {
|
||||
onUpdateInputs: (data) => {
|
||||
if (data.length === 0) return null
|
||||
|
||||
const { type, id } = data[0]
|
||||
setCurrentWindowId(id)
|
||||
setInputType(type)
|
||||
},
|
||||
onUpdateContent: inbox => {
|
||||
onUpdateContent: (inbox) => {
|
||||
setInbox(inbox)
|
||||
},
|
||||
onDisable: _ => {
|
||||
onDisable: () => {
|
||||
setInputType(null)
|
||||
},
|
||||
/* */
|
||||
onFileNameRequest: (tosave, usage, _, setFileName) => {
|
||||
setFileName({
|
||||
usage,
|
||||
filename: prompt('Enter the filename')
|
||||
filename: prompt('Enter the filename'),
|
||||
})
|
||||
},
|
||||
onFileRead: ({ filename }) => {
|
||||
|
|
@ -45,7 +45,7 @@ export const Handlers = ({
|
|||
localStorage.setItem(`fake-fs/${filename}`, encode(content))
|
||||
},
|
||||
/* */
|
||||
onExit: _ => {
|
||||
onExit: () => {
|
||||
setInputType(null)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { h } from 'preact'
|
||||
|
||||
export default function ({ themeEngine }) {
|
||||
const options = themeEngine.themes.map(theme => (
|
||||
export default function ThemeSelector ({ themeEngine }) {
|
||||
const options = themeEngine.themes.map((theme) => (
|
||||
<option
|
||||
key={theme}
|
||||
value={theme}>
|
||||
{theme}
|
||||
{theme}
|
||||
</option>))
|
||||
|
||||
return (
|
||||
|
|
|
|||
20
src/index.js
20
src/index.js
|
|
@ -3,10 +3,10 @@ import { Route, Router, Switch } from 'wouter-preact'
|
|||
|
||||
import {
|
||||
useHashLocation,
|
||||
extractView
|
||||
extractView,
|
||||
} from '~/src/utils/utils.routing'
|
||||
import {
|
||||
useThemeEngine
|
||||
useThemeEngine,
|
||||
} from '~/src/themes/themes'
|
||||
|
||||
import HomeView from '~/src/views/HomeView/HomeView'
|
||||
|
|
@ -21,12 +21,14 @@ function App () {
|
|||
const themeEngine = useThemeEngine()
|
||||
const [location] = useHashLocation()
|
||||
|
||||
const playerView = (themeEngine, singleWindow) => params =>
|
||||
(<PlayerView {...{
|
||||
...themeEngine,
|
||||
...params,
|
||||
singleWindow
|
||||
}} />)
|
||||
const playerView = (themeEngine, singleWindow) =>
|
||||
function view (params) {
|
||||
return (<PlayerView {...{
|
||||
...themeEngine,
|
||||
...params,
|
||||
singleWindow,
|
||||
}} />)
|
||||
}
|
||||
|
||||
return (
|
||||
<Router hook={useHashLocation}>
|
||||
|
|
@ -38,7 +40,7 @@ function App () {
|
|||
<Switch>
|
||||
<Route path='/'>
|
||||
<HomeView {...{
|
||||
themeEngine
|
||||
themeEngine,
|
||||
}} />
|
||||
</Route>
|
||||
<Route path='/games/'>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const themes = [
|
|||
'redrum',
|
||||
'toxin',
|
||||
'valve',
|
||||
'wasp'
|
||||
'wasp',
|
||||
]
|
||||
|
||||
const LS_THEME_KEY = 'elseifplayer/theme'
|
||||
|
|
@ -24,7 +24,7 @@ const getSavedTheme = () => {
|
|||
return savedTheme || DEFAULT_THEME
|
||||
}
|
||||
|
||||
const assertTheme = theme =>
|
||||
const assertTheme = (theme) =>
|
||||
themes.includes(theme)
|
||||
? theme
|
||||
: getSavedTheme()
|
||||
|
|
@ -33,7 +33,7 @@ export const useThemeEngine = (initialTheme = getSavedTheme()) => {
|
|||
const [currentTheme, setCurrentTheme] =
|
||||
useState(initialTheme)
|
||||
|
||||
const setTheme = theme => {
|
||||
const setTheme = (theme) => {
|
||||
const newTheme = assertTheme(theme)
|
||||
|
||||
setCurrentTheme(newTheme)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import {
|
||||
useState, useEffect, useCallback
|
||||
useState, useEffect, useCallback,
|
||||
} from 'preact/hooks'
|
||||
|
||||
export const useHashLocation = () => {
|
||||
|
|
@ -16,7 +16,7 @@ export const useHashLocation = () => {
|
|||
return () => window.removeEventListener('hashchange', handler)
|
||||
}, [])
|
||||
|
||||
const navigate = useCallback(to =>
|
||||
const navigate = useCallback((to) =>
|
||||
(window.location.hash = to.replace('#/', '')), [])
|
||||
return [loc, navigate]
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ export const useHashLocation = () => {
|
|||
export const buildPlayLinkHref = ({ url }) =>
|
||||
`/#/play/${encodeURIComponent(url)}`
|
||||
|
||||
export const extractView = location => {
|
||||
export const extractView = (location) => {
|
||||
const currentView = location.split('/').filter(Boolean)[0]
|
||||
return currentView || ''
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ import './GamesView.css'
|
|||
const tutorialGame = {
|
||||
name: 'The Dreamhold',
|
||||
ifdb: 'https://ifdb.org/viewgame?id=3myqnrs64nbtwdaz',
|
||||
url: 'https://mirror.ifarchive.org/if-archive/games/zcode/dreamhold.z8'
|
||||
url: 'https://mirror.ifarchive.org/if-archive/games/zcode/dreamhold.z8',
|
||||
}
|
||||
|
||||
export default function () {
|
||||
export default function GamesView () {
|
||||
return (
|
||||
<main className='view games'>
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ export default function () {
|
|||
<ul>
|
||||
<li>
|
||||
<GameEntry {...{
|
||||
...tutorialGame
|
||||
...tutorialGame,
|
||||
}} />
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -73,10 +73,10 @@ export default function () {
|
|||
</p>
|
||||
|
||||
<ol>
|
||||
{top2019.map(game => (
|
||||
{top2019.map((game) => (
|
||||
<li key={game[0]}>
|
||||
<GameEntry {...{
|
||||
...game
|
||||
...game,
|
||||
}} />
|
||||
</li>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -3,18 +3,18 @@ export default [
|
|||
/* Check with cheap-glk */
|
||||
'Counterfeit Monkey',
|
||||
'https://ifdb.org/viewgame?id=aearuuxv83plclpl',
|
||||
'https://mirror.ifarchive.org/if-archive/games/glulx/CounterfeitMonkey.gblorb'
|
||||
'https://mirror.ifarchive.org/if-archive/games/glulx/CounterfeitMonkey.gblorb',
|
||||
],
|
||||
[
|
||||
'Lost Pig',
|
||||
'https://ifdb.org/viewgame?id=mohwfk47yjzii14w',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/LostPig.z8'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/LostPig.z8',
|
||||
],
|
||||
[
|
||||
/* Works. Check inputs */
|
||||
'Anchorhead',
|
||||
'https://ifdb.org/viewgame?id=op0uw1gn1tjqmjt7',
|
||||
'https://ifarchive.org/if-archive/games/zcode/anchor.z8'
|
||||
'https://ifarchive.org/if-archive/games/zcode/anchor.z8',
|
||||
],
|
||||
/* [
|
||||
'80 DAYS',
|
||||
|
|
@ -24,18 +24,18 @@ export default [
|
|||
[
|
||||
'Galatea',
|
||||
'https://ifdb.org/viewgame?id=urxrv27t7qtu52lb',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/Galatea.zblorb'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/Galatea.zblorb',
|
||||
],
|
||||
[
|
||||
/* Works. Check inputs */
|
||||
'Photopia',
|
||||
'https://ifdb.org/viewgame?id=ju778uv5xaswnlpl',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/photopia.z5'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/photopia.z5',
|
||||
],
|
||||
[
|
||||
'Spider and Web',
|
||||
'https://ifdb.org/viewgame?id=2xyccw3pe0uovfad',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/Tangle.z5'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/Tangle.z5',
|
||||
],
|
||||
/* [
|
||||
'Trinity',
|
||||
|
|
@ -60,12 +60,12 @@ export default [
|
|||
[
|
||||
'Slouching Towards Bedlam',
|
||||
'https://ifdb.org/viewgame?id=032krqe6bjn5au78',
|
||||
'https://mirror.ifarchive.org/if-archive/games/competition2003/zcode/slouch/slouch.z5'
|
||||
'https://mirror.ifarchive.org/if-archive/games/competition2003/zcode/slouch/slouch.z5',
|
||||
],
|
||||
[
|
||||
'Curses!',
|
||||
'https://ifdb.org/viewgame?id=plvzam05bmz3enh8',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/curses.z5'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/curses.z5',
|
||||
],
|
||||
/* [
|
||||
'howling dogs',
|
||||
|
|
@ -75,12 +75,12 @@ export default [
|
|||
[
|
||||
'Violet',
|
||||
'https://ifdb.org/viewgame?id=4glrrfh7wrp9zz7b',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/Violet.zblorb'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/Violet.zblorb',
|
||||
],
|
||||
[
|
||||
'The Wizard Sniffer',
|
||||
'https://ifdb.org/viewgame?id=uq18rw9gt8j58da',
|
||||
'https://ifarchive.org/if-archive/games/competition2017/The%20Wizard%20Sniffer/The_Wizard_Sniffer.gblorb'
|
||||
'https://ifarchive.org/if-archive/games/competition2017/The%20Wizard%20Sniffer/The_Wizard_Sniffer.gblorb',
|
||||
],
|
||||
/* [
|
||||
'Eat Me',
|
||||
|
|
@ -100,12 +100,12 @@ export default [
|
|||
[
|
||||
'Shade',
|
||||
'https://ifdb.org/viewgame?id=hsfc7fnl40k4a30q',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/shade.z5'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/shade.z5',
|
||||
],
|
||||
[
|
||||
'Vespers',
|
||||
'https://ifdb.org/viewgame?id=6dj2vguyiagrhvc2',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/vespers.z8'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/vespers.z8',
|
||||
],
|
||||
/* [
|
||||
'Will Not Let Me Go',
|
||||
|
|
@ -135,7 +135,7 @@ export default [
|
|||
[
|
||||
'Savoir-Faire',
|
||||
'https://ifdb.org/viewgame?id=p0cizeb3kiwzlm2p',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/Savoir-Faire.zblorb'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/Savoir-Faire.zblorb',
|
||||
],
|
||||
/* [
|
||||
'With Those We Love Alive',
|
||||
|
|
@ -145,7 +145,7 @@ export default [
|
|||
[
|
||||
'Aisle',
|
||||
'https://ifdb.org/viewgame?id=j49crlvd62mhwuzu',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/Aisle.z5'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/Aisle.z5',
|
||||
],
|
||||
/* [
|
||||
'Blue Lacuna',
|
||||
|
|
@ -155,7 +155,7 @@ export default [
|
|||
[
|
||||
'Gun Mute',
|
||||
'https://ifdb.org/viewgame?id=xwedbibfksczn7eq',
|
||||
'https://mirror.ifarchive.org/if-archive/games/tads/GunMute.t3'
|
||||
'https://mirror.ifarchive.org/if-archive/games/tads/GunMute.t3',
|
||||
],
|
||||
/* [
|
||||
'The King of Shreds and Patches',
|
||||
|
|
@ -180,7 +180,7 @@ export default [
|
|||
[
|
||||
'A Beauty Cold and Austere',
|
||||
'https://ifdb.org/viewgame?id=y9y7jozi0l76bb82',
|
||||
'https://ifarchive.org/if-archive/games/competition2017/A%20Beauty%20Cold%20and%20Austere/A_Beauty_Cold_and_Austere.gblorb'
|
||||
'https://ifarchive.org/if-archive/games/competition2017/A%20Beauty%20Cold%20and%20Austere/A_Beauty_Cold_and_Austere.gblorb',
|
||||
],
|
||||
/* [
|
||||
'Cactus Blue Motel',
|
||||
|
|
@ -190,7 +190,7 @@ export default [
|
|||
[
|
||||
'Coloratura',
|
||||
'https://ifdb.org/viewgame?id=g0fl99ovcrq2sqzk',
|
||||
'https://mirror.ifarchive.org/if-archive/games/competition2013/glulx/coloratura/Coloratura.gblorb'
|
||||
'https://mirror.ifarchive.org/if-archive/games/competition2013/glulx/coloratura/Coloratura.gblorb',
|
||||
],
|
||||
/* [
|
||||
'Harmonia',
|
||||
|
|
@ -200,12 +200,12 @@ export default [
|
|||
[
|
||||
'Lime Ergot',
|
||||
'https://ifdb.org/viewgame?id=b8mb4fcwmf1hrxl',
|
||||
'https://mirror.ifarchive.org/if-archive/games/glulx/Lime_Ergot.gblorb'
|
||||
'https://mirror.ifarchive.org/if-archive/games/glulx/Lime_Ergot.gblorb',
|
||||
],
|
||||
[
|
||||
'Rameses',
|
||||
'https://ifdb.org/viewgame?id=0stz0hr7a98bp9mp',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/rameses.zblorb'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/rameses.zblorb',
|
||||
],
|
||||
/* [
|
||||
'Spellbreaker',
|
||||
|
|
@ -220,7 +220,7 @@ export default [
|
|||
[
|
||||
'The Wand',
|
||||
'https://ifdb.org/viewgame?id=2jil5vbxmbv8riv1',
|
||||
'https://ifarchive.org/if-archive/games/glulx/Wand.ulx'
|
||||
'https://ifarchive.org/if-archive/games/glulx/Wand.ulx',
|
||||
],
|
||||
/* [
|
||||
'Zork I',
|
||||
|
|
@ -230,17 +230,17 @@ export default [
|
|||
[
|
||||
'1893: A World\'s Fair Mystery',
|
||||
'https://ifdb.org/viewgame?id=00e0t7swrris5pg6',
|
||||
'https://mirror.ifarchive.org/if-archive/games/tads/1893.gam'
|
||||
'https://mirror.ifarchive.org/if-archive/games/tads/1893.gam',
|
||||
],
|
||||
[
|
||||
'Adventure',
|
||||
'https://ifdb.org/viewgame?id=fft6pu91j85y4acv',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/Advent.z5'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/Advent.z5',
|
||||
],
|
||||
[
|
||||
'Alias \'The Magpie\'',
|
||||
'https://ifdb.org/viewgame?id=yspn49v69hzc8rtb',
|
||||
'https://ifarchive.org/if-archive/games/competition2018/Alias%20The%20Magpie/Alias%20%27The%20Magpie%27.gblorb'
|
||||
'https://ifarchive.org/if-archive/games/competition2018/Alias%20The%20Magpie/Alias%20%27The%20Magpie%27.gblorb',
|
||||
],
|
||||
/* [
|
||||
'De Baron',
|
||||
|
|
@ -255,22 +255,22 @@ export default [
|
|||
[
|
||||
'Cragne Manor',
|
||||
'https://ifdb.org/viewgame?id=4x7nltu8p851tn4x',
|
||||
'https://mirror.ifarchive.org/if-archive/games/glulx/cragne.gblorb'
|
||||
'https://mirror.ifarchive.org/if-archive/games/glulx/cragne.gblorb',
|
||||
],
|
||||
[
|
||||
'The Edifice',
|
||||
'https://ifdb.org/viewgame?id=4tb9soabrb4apqzd',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/edifice.z5'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/edifice.z5',
|
||||
],
|
||||
[
|
||||
'Endless, Nameless',
|
||||
'https://ifdb.org/viewgame?id=7vtm1rq16hh3xch',
|
||||
'https://ifarchive.org/if-archive/games/zcode/nameless.z8'
|
||||
'https://ifarchive.org/if-archive/games/zcode/nameless.z8',
|
||||
],
|
||||
[
|
||||
'Everybody Dies',
|
||||
'https://ifdb.org/viewgame?id=lyblvftb8xtlo0a1',
|
||||
'https://mirror.ifarchive.org/if-archive/games/competition2008/glulx/everybodydies/EverybodyDies.gblorb'
|
||||
'https://mirror.ifarchive.org/if-archive/games/competition2008/glulx/everybodydies/EverybodyDies.gblorb',
|
||||
],
|
||||
/* [
|
||||
'Fallen London',
|
||||
|
|
@ -280,12 +280,12 @@ export default [
|
|||
[
|
||||
'Foo Foo',
|
||||
'https://ifdb.org/viewgame?id=ec6x9y8qcmsrxob9',
|
||||
'https://ifarchive.org/if-archive/games/springthing/2016/FooFoo.gblorb'
|
||||
'https://ifarchive.org/if-archive/games/springthing/2016/FooFoo.gblorb',
|
||||
],
|
||||
[
|
||||
'The Gostak',
|
||||
'https://ifdb.org/viewgame?id=w5s3sv43s3p98v45',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/gostak.z5'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/gostak.z5',
|
||||
],
|
||||
/* [
|
||||
'The Hitchhiker\'s Guide to the Galaxy',
|
||||
|
|
@ -305,27 +305,27 @@ export default [
|
|||
[
|
||||
'Inside the Facility',
|
||||
'https://ifdb.org/viewgame?id=stsdri5zh7a4i5my',
|
||||
'https://ifarchive.org/if-archive/games/competition2016/Inside%20the%20Facility/Facility.z8'
|
||||
'https://ifarchive.org/if-archive/games/competition2016/Inside%20the%20Facility/Facility.z8',
|
||||
],
|
||||
[
|
||||
'Junior Arithmancer',
|
||||
'https://ifdb.org/viewgame?id=pw1rbjt1t4n4n87s',
|
||||
'https://ifarchive.org/if-archive/games/competition2018/Junior%20Arithmancer/Junior_Arithmancer.gblorb'
|
||||
'https://ifarchive.org/if-archive/games/competition2018/Junior%20Arithmancer/Junior_Arithmancer.gblorb',
|
||||
],
|
||||
[
|
||||
'Make It Good',
|
||||
'https://ifdb.org/viewgame?id=jdrbw1htq4ah8q57',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/MakeItGood.zblorb'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/MakeItGood.zblorb',
|
||||
],
|
||||
[
|
||||
'Sub Rosa',
|
||||
'https://ifdb.org/viewgame?id=73nvz9yui87ub3sd',
|
||||
'https://mirror.ifarchive.org/if-archive/games/glulx/Sub_Rosa.gblorb'
|
||||
'https://mirror.ifarchive.org/if-archive/games/glulx/Sub_Rosa.gblorb',
|
||||
],
|
||||
[
|
||||
'Suveh Nux',
|
||||
'https://ifdb.org/viewgame?id=xkai23ry99qdxce3',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/suvehnux.z5'
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/suvehnux.z5',
|
||||
],
|
||||
/* [
|
||||
'their angelical understanding',
|
||||
|
|
@ -340,6 +340,6 @@ export default [
|
|||
[
|
||||
'Varicella',
|
||||
'https://ifdb.org/viewgame?id=ywwlr3tpxnktjasd',
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/vgame.z8'
|
||||
]
|
||||
'https://mirror.ifarchive.org/if-archive/games/zcode/vgame.z8',
|
||||
],
|
||||
].map(([name, ifdb, url]) => ({ name, ifdb, url }))
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { Link } from 'wouter-preact'
|
|||
|
||||
import {
|
||||
useHashLocation,
|
||||
buildPlayLinkHref
|
||||
buildPlayLinkHref,
|
||||
} from '~/src/utils/utils.routing'
|
||||
|
||||
import LocalFileSelector from
|
||||
|
|
@ -15,7 +15,7 @@ import ThemeSelector from
|
|||
|
||||
import './HomeView.css'
|
||||
|
||||
export default function ({ themeEngine }) {
|
||||
export default function HomeView ({ themeEngine }) {
|
||||
const setLocation = useHashLocation()[1]
|
||||
|
||||
return (
|
||||
|
|
@ -46,7 +46,7 @@ export default function ({ themeEngine }) {
|
|||
</h2>
|
||||
|
||||
<ThemeSelector {...{
|
||||
themeEngine
|
||||
themeEngine,
|
||||
}} />
|
||||
|
||||
<p>
|
||||
|
|
@ -97,7 +97,7 @@ export default function ({ themeEngine }) {
|
|||
<LocalFileSelector {...{
|
||||
setLocation,
|
||||
buildLink: buildPlayLinkHref,
|
||||
theme: themeEngine.currentTheme
|
||||
theme: themeEngine.currentTheme,
|
||||
}} />
|
||||
</label>
|
||||
</p>
|
||||
|
|
@ -108,7 +108,7 @@ export default function ({ themeEngine }) {
|
|||
<TargetURLSelector {...{
|
||||
setLocation,
|
||||
buildLink: buildPlayLinkHref,
|
||||
theme: themeEngine.currentTheme
|
||||
theme: themeEngine.currentTheme,
|
||||
}} />
|
||||
</label>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { h } from 'preact'
|
||||
import { Link } from 'wouter-preact'
|
||||
|
||||
export default () => (
|
||||
<main>
|
||||
export default function NotFoundView () {
|
||||
return <main>
|
||||
<div className='status'>
|
||||
<h1>
|
||||
404
|
||||
|
|
@ -23,4 +23,4 @@ export default () => (
|
|||
</a>
|
||||
</div>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ import UrlPlayer from '~/src/components/Player/UrlPlayer'
|
|||
|
||||
import './PlayerView.css'
|
||||
|
||||
const decode = encodedUrl => decodeURIComponent(encodedUrl)
|
||||
const decode = (encodedUrl) => decodeURIComponent(encodedUrl)
|
||||
|
||||
export default function ({
|
||||
setTheme, theme, encodedUrl, singleWindow
|
||||
export default function PlayerView ({
|
||||
setTheme, theme, encodedUrl, singleWindow,
|
||||
}) {
|
||||
useEffect(() => setTheme(theme), [setTheme, theme])
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ export default function ({
|
|||
<main>
|
||||
<UrlPlayer {...{
|
||||
url: targetUrl,
|
||||
singleWindow
|
||||
singleWindow,
|
||||
}} />
|
||||
</main>
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue