mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-05 17:37:21 +00:00
Rename Views
This commit is contained in:
parent
3d5029173f
commit
d7ba6d8c60
3 changed files with 4 additions and 4 deletions
31
src/views/PlayerView.jsx
Normal file
31
src/views/PlayerView.jsx
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { h } from 'preact'
|
||||
|
||||
import { useState, useEffect } from 'preact/hooks'
|
||||
import { prepareVM } from '~/src/common/if'
|
||||
|
||||
const INITIAL_STATUS = {
|
||||
level: 'loading',
|
||||
details: 'Loading...'
|
||||
}
|
||||
|
||||
export default function ({setTheme, theme, encodedUrl}) {
|
||||
const [url] = useState(decodeURIComponent(encodedUrl))
|
||||
const [status, setStatus] = useState(INITIAL_STATUS)
|
||||
|
||||
const [vm, setVM] = useState(null)
|
||||
|
||||
useEffect(() => setTheme(theme), [theme])
|
||||
useEffect(prepareVM({
|
||||
url,
|
||||
setStatus,
|
||||
setVM
|
||||
}), [url])
|
||||
|
||||
useEffect(() => {
|
||||
if (vm) console.log('success', vm)
|
||||
}, [vm])
|
||||
return (
|
||||
<main>
|
||||
{status.details}
|
||||
</main>)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue