diff --git a/src/components/FileSelector.js b/src/components/FileSelector.js
new file mode 100644
index 0000000..eeba467
--- /dev/null
+++ b/src/components/FileSelector.js
@@ -0,0 +1,15 @@
+import { h } from 'preact'
+
+export default function ({ emitName, emitURL }) {
+ const fileInputHandler = ({ target }) => {
+ const file = target.files[0]
+ emitName(file.name)
+ emitURL(URL.createObjectURL(file))
+ target.value = null
+ }
+
+ return (
+ )
+}
diff --git a/src/components/URLSelector.js b/src/components/URLSelector.js
new file mode 100644
index 0000000..1c86948
--- /dev/null
+++ b/src/components/URLSelector.js
@@ -0,0 +1,23 @@
+import { h } from 'preact'
+
+export default function ({ emitName, emitURL }) {
+ const reURL = /^(http|https):\/\/[^ "]+$/
+
+ const emit = url => {
+ emitName(url)
+ emitURL(url)
+ }
+
+ const urlInputHandler = ({ target }) => {
+ const url = target.value
+ emit(reURL.test(url)
+ ? url
+ : null)
+ }
+
+ return (
+ )
+}
diff --git a/src/index.js b/src/index.js
index e7e8113..f408685 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,10 +1,11 @@
import { h, render } from 'preact'
-import {
- Redirect, Switch, Route, Link, Router
-} from 'wouter-preact'
+import { Link, Route, Router, Switch } from 'wouter-preact'
import { useHashLocation } from '~/src/utils/utils.routing'
+import Index from '~/src/views/Index'
+import Player from '~/src/views/Player'
+
function App () {
return (
@@ -12,22 +13,21 @@ function App () {
-
- Root
+
+
+
+ top100
-
- About
-
-
-
-
-
+
404
diff --git a/src/views/Index.js b/src/views/Index.js
new file mode 100644
index 0000000..cec2725
--- /dev/null
+++ b/src/views/Index.js
@@ -0,0 +1,34 @@
+import { h } from 'preact'
+import { useState } from 'preact/hooks'
+
+import { Link } from 'wouter-preact'
+
+import FileSelector from '~/src/components/FileSelector'
+import URLSelector from '~/src/components/URLSelector'
+
+export default function () {
+ const [targetName, setTargetName] = useState(null)
+ const [targetURL, setTargetURL] = useState(null)
+
+ const playButton = (
+
+ Play "{targetName}"
+ )
+
+ return (
+
+
+ { targetURL ? playButton : null }
+ )
+}
diff --git a/src/views/Player.jsx b/src/views/Player.jsx
new file mode 100644
index 0000000..6113aaf
--- /dev/null
+++ b/src/views/Player.jsx
@@ -0,0 +1,11 @@
+import { h } from 'preact'
+
+export default function ({params: {theme, encodedUrl}}) {
+ const url = decodeURIComponent(encodedUrl)
+
+ return (
+
+ {theme}
+ {url}
+
)
+}