From a43b0907e2414a50083ed42a47d636e5cc6c9c56 Mon Sep 17 00:00:00 2001 From: Shiny Nematoda Date: Thu, 14 Jul 2022 11:42:57 +0000 Subject: [PATCH] Added Explore Tab --- src/App.vue | 43 +++++++++--- src/assets/base.css | 19 +++++- src/components/Genres.vue | 140 ++++++++++++++++++++++++++++++++++++++ src/components/NavBar.vue | 20 +++++- src/components/Prefs.vue | 1 + src/scripts/util.js | 8 ++- 6 files changed, 214 insertions(+), 17 deletions(-) create mode 100644 src/components/Genres.vue diff --git a/src/App.vue b/src/App.vue index 626e52e..03e65a8 100644 --- a/src/App.vue +++ b/src/App.vue @@ -7,6 +7,7 @@ import { ref, reactive, onBeforeMount, onMounted } from 'vue'; import NavBar from './components/NavBar.vue'; import StatusBar from './components/StatusBar.vue'; import NowPlaying from './components/NowPlaying.vue'; +import Genres from './components/Genres.vue'; import Search from './components/Search.vue'; import NewPlaylist from './components/NewPlaylist.vue'; import Playlists from './components/Playlists.vue'; @@ -52,36 +53,44 @@ const artist = reactive({ }); const search = ref(''), + genreid = ref(''), page = ref('home'), - title = ref(''); + path = ref(location.pathname); const audio = ref(null); /* Functions */ function parseUrl() { - const loc = location.href.split('/'); + const loc = location.pathname.split('/'), + base = loc[1].replace(location.search, ''); - console.log(loc, loc[3].replace(location.search, '')); + console.log(loc, base); - switch (loc[3].replace(location.search, '')) { + path.value = location.pathname; + + switch (base) { case '': getExplore(); break; case 'search': - search.value = loc[4]; + search.value = loc[2]; console.log(search.value); break; case 'watch': - getSong(loc[3]); - console.log(loc[3]); + getSong(loc[1] + location.search); + console.log(loc[1]); break; case 'playlist': - getAlbum(loc[3]); - console.log(loc[3]); + getAlbum(loc[1] + location.search); + console.log(loc[1]); break; case 'channel': - getArtist(loc[4]); - console.log(loc[4]); + getArtist(loc[1]); + console.log(loc[1]); + break; + case 'explore': + genreid.value = loc[2]; + page.value = 'genres'; default: console.log(loc); } @@ -476,6 +485,18 @@ onMounted(() => { :search="search" /> + + + + diff --git a/src/assets/base.css b/src/assets/base.css index 4006f0e..7eab181 100644 --- a/src/assets/base.css +++ b/src/assets/base.css @@ -54,6 +54,22 @@ body[data-theme='light'] { --color-text: var(--vt-c-text-light-1); } +body[data-theme='nord'] { + --color-foreground: var(--vt-c-blue); + --color-background: #2e3440; + --color-background-soft: #3b4252; + --color-background-mute: #434c5e; + + --color-border: #4c566a; + --color-border-hover: #4c566a; + + --color-shadow: #4c566a; + --color-scrollbar: var(--vt-c-blue); + + --color-heading: #d8dee9; + --color-text: #d8dee9; +} + *, *::before, *::after { @@ -146,7 +162,8 @@ button { transition: color 0.3s ease; } .bi:hover, -.bi.true { +.bi.true, +.bi[data-active='true'] { color: var(--color-foreground); } diff --git a/src/components/Genres.vue b/src/components/Genres.vue new file mode 100644 index 0000000..00dddbe --- /dev/null +++ b/src/components/Genres.vue @@ -0,0 +1,140 @@ + + + + + diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index 3f3d4c2..e525ad0 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -11,6 +11,7 @@ const emit = defineEmits(['update-page', 'update-search']), home: true, playlist: false, prefs: false, + genres: false, }); const Toggle = p => { @@ -33,13 +34,20 @@ const Toggle = p => {
+
@@ -64,6 +72,7 @@ nav { } h1.bi { font-size: calc(1.75rem + 1.5vw); + padding-bottom: 0; } .bi { font-size: calc(1rem + 1.5vw); @@ -75,4 +84,9 @@ h1.bi { .nav-ico { margin: 0 0.5rem; } +@media (min-width: 1024px) { + .bi { + font-size: 1.5rem; + } +} diff --git a/src/components/Prefs.vue b/src/components/Prefs.vue index ed90538..4bffd19 100644 --- a/src/components/Prefs.vue +++ b/src/components/Prefs.vue @@ -63,6 +63,7 @@ onMounted(() => { @change="setTheme($event.target.value)"> +

Audio Player

diff --git a/src/scripts/util.js b/src/scripts/util.js index 1676ea7..889bfec 100644 --- a/src/scripts/util.js +++ b/src/scripts/util.js @@ -1,4 +1,8 @@ -export const useStore = () => { +export function useRoute(l) { + history.pushState({}, '', l); +} + +export function useStore() { try { return window.localStorage; } catch (err) { @@ -13,7 +17,7 @@ export const useStore = () => { setItem: error, }; } -}; +} export function useLazyLoad() { let lazyElems;