diff --git a/src/App.tsx b/src/App.tsx
index 3df3201..4dc46f3 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,15 +1,13 @@
-import { useEffect } from "kaioken"
+import { Route, Router, useEffect } from "kaioken"
import Main from "./pages/Main"
-import Player from "./pages/Player"
-import Add from "./pages/Add"
-import useNavigationStore, { Navs } from "./hooks/navigationStores"
import { useStorage } from "./hooks/storageStores"
import { useStationsStore } from "./hooks/stationStores"
+import Add from "./pages/Add"
+import Player from "./pages/Player"
export function App() {
const { getStationsFile } = useStorage()
const { override } = useStationsStore()
- const { value } = useNavigationStore()
useEffect(() => {
getStationsFile()
@@ -17,16 +15,12 @@ export function App() {
.catch()
}, [])
-
- switch (value) {
- case Navs.MAIN:
- return
- case Navs.ADD:
- return
- case Navs.PLAYER:
- return
- default:
- return
404 Not Found
- }
+ return (
+
+
+
+
+
+ )
}
diff --git a/src/hooks/navigationStores.ts b/src/hooks/navigationStores.ts
deleted file mode 100644
index 5e7a5db..0000000
--- a/src/hooks/navigationStores.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { createStore } from "kaioken"
-
-export enum Navs {
- MAIN,
- ADD,
- PLAYER,
-}
-
-const useNavigationStore = createStore(Navs.MAIN, (set) => ({
- navigate: (value) => set(() => value),
-}))
-
-export default useNavigationStore
diff --git a/src/pages/Add.tsx b/src/pages/Add.tsx
index df7c4a0..fb8497a 100644
--- a/src/pages/Add.tsx
+++ b/src/pages/Add.tsx
@@ -1,8 +1,7 @@
import { writeTextFile } from "@tauri-apps/api/fs"
-import { useModel } from "kaioken"
+import { navigate, useModel } from "kaioken"
import { Station, useStationsStore } from "../hooks/stationStores"
import { useStorageStore } from "../hooks/storageStores"
-import useNavigationStore, { Navs } from "../hooks/navigationStores"
export default function Add() {
const { value } = useStorageStore()
@@ -20,12 +19,12 @@ export default function Add() {
const store = useStationsStore.methods.add(data)
const valid = store && value
valid && void writeTextFile(value, JSON.stringify(store))
- useNavigationStore.setState(Navs.MAIN)
+ navigate('/')
}
return (
-
))}
- navigate(Navs.ADD)}>+
+ navigate('/add')}>+
)
diff --git a/src/pages/Player.tsx b/src/pages/Player.tsx
index 6f0ac8b..9f0dfd7 100644
--- a/src/pages/Player.tsx
+++ b/src/pages/Player.tsx
@@ -1,12 +1,11 @@
-import useNavigationStore, { Navs } from "../hooks/navigationStores"
+import { navigate } from "kaioken"
import { useSelectStationStore } from "../hooks/stationStores"
export default function Player() {
const { value: selectedStation, make } = useSelectStationStore()
- const { navigate } = useNavigationStore()
function _handlePlayerBackClick() {
- navigate(Navs.MAIN)
+ navigate('/')
make(null)
}