diff --git a/src/index.js b/src/index.js index f408685..25210d1 100644 --- a/src/index.js +++ b/src/index.js @@ -3,7 +3,7 @@ import { Link, Route, Router, Switch } from 'wouter-preact' import { useHashLocation } from '~/src/utils/utils.routing' -import Index from '~/src/views/Index' +import Home from '~/src/views/Home' import Player from '~/src/views/Player' function App () { @@ -12,15 +12,13 @@ function App () {
+ component={Home} /> diff --git a/src/utils/utils.routing.js b/src/utils/utils.routing.js index 48a255d..d18ec1a 100644 --- a/src/utils/utils.routing.js +++ b/src/utils/utils.routing.js @@ -19,3 +19,6 @@ export const useHashLocation = () => { (window.location.hash = to.replace('#/', '')), []) return [loc, navigate] } + +export const buildPlayLinkHref = (url, theme = 'default') => + `/#/play/${theme}/${encodeURIComponent(url)}` diff --git a/src/views/Index.js b/src/views/Home.js similarity index 75% rename from src/views/Index.js rename to src/views/Home.js index cec2725..9d04922 100644 --- a/src/views/Index.js +++ b/src/views/Home.js @@ -6,25 +6,32 @@ import { Link } from 'wouter-preact' import FileSelector from '~/src/components/FileSelector' import URLSelector from '~/src/components/URLSelector' +import { buildPlayLinkHref } from '~/src/utils/utils.routing' + export default function () { const [targetName, setTargetName] = useState(null) const [targetURL, setTargetURL] = useState(null) const playButton = ( - + Play "{targetName}" ) return (
+

+ You can browse some + games from IFDB + or play a game from a file. +

  • -
  • -