move global search to right sidebar

This commit is contained in:
geoffrey45 2022-01-30 00:58:53 +03:00
parent e847574446
commit 3eef90dc8a
16 changed files with 221 additions and 171 deletions

View File

@ -9,7 +9,6 @@
"lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src" "lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src"
}, },
"dependencies": { "dependencies": {
"animate.css": "^4.1.1",
"mitt": "^3.0.0", "mitt": "^3.0.0",
"register-service-worker": "^1.7.1", "register-service-worker": "^1.7.1",
"sass": "^1.49.0", "sass": "^1.49.0",

View File

@ -15,7 +15,7 @@ def initialize() -> None:
Runs all the necessary setup functions. Runs all the necessary setup functions.
""" """
helpers.create_config_dir() helpers.create_config_dir()
# helpers.check_for_new_songs() helpers.check_for_new_songs()
initialize() initialize()

View File

@ -12,22 +12,10 @@
<PinnedStuff :collapsed="collapsed" /> <PinnedStuff :collapsed="collapsed" />
</div> </div>
<div class="content"> <div class="content">
<div class="search-box"> <div class="search-box"></div>
<Search
v-model:search="search"
@expandSearch="expandSearch"
@collapseSearch="collapseSearch"
/>
</div>
<router-view /> <router-view />
</div> </div>
<div class="r-sidebar"> <RightSideBar />
<div class="m-np">
<NowPlaying />
</div>
<UpNext v-model:up_next="up_next" @expandQueue="expandQueue" />
<RecommendedArtist />
</div>
<div class="bottom-bar"> <div class="bottom-bar">
<BottomBar /> <BottomBar />
</div> </div>
@ -38,24 +26,18 @@
import { ref } from "@vue/reactivity"; import { ref } from "@vue/reactivity";
import Navigation from "./components/LeftSidebar/Navigation.vue"; import Navigation from "./components/LeftSidebar/Navigation.vue";
import PinnedStuff from "./components/LeftSidebar/PinnedStuff.vue" import PinnedStuff from "./components/LeftSidebar/PinnedStuff.vue";
import Search from "./components/Search.vue";
import NowPlaying from "./components/RightSideBar/NowPlaying.vue";
import UpNext from "./components/RightSideBar/UpNext.vue";
import RecommendedArtist from "./components/RightSideBar/Recommendation.vue";
import BottomBar from "@/components/BottomBar/BottomBar.vue"; import BottomBar from "@/components/BottomBar/BottomBar.vue";
import perks from "@/composables/perks.js"; import perks from "@/composables/perks.js";
import Main from "./components/RightSideBar/Main.vue";
export default { export default {
components: { components: {
Navigation, Navigation,
PinnedStuff, PinnedStuff,
Search, BottomBar,
NowPlaying, RightSideBar: Main,
UpNext,
RecommendedArtist,
BottomBar
}, },
setup() { setup() {
@ -67,29 +49,9 @@ export default {
collapsed.value = !collapsed.value; collapsed.value = !collapsed.value;
} }
let up_next = ref(true);
let search = ref(false);
const expandQueue = () => {
up_next.value = !up_next.value;
};
const expandSearch = () => {
search.value = true;
};
const collapseSearch = () => {
search.value = false;
};
return { return {
toggleNav, toggleNav,
expandSearch,
collapseSearch,
expandQueue,
collapsed, collapsed,
up_next,
search,
}; };
}, },
}; };
@ -106,10 +68,10 @@ export default {
#toggle { #toggle {
position: absolute; position: absolute;
left: 0.2rem; left: 0.2rem;
width: 4rem; width: 3rem;
height: 100%; height: 100%;
background: url(./assets/icons/menu.svg); background: url(./assets/icons/menu.svg);
background-size: 50%; background-size: 2rem;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
cursor: pointer; cursor: pointer;
@ -118,14 +80,11 @@ export default {
.logo { .logo {
height: 2rem; height: 2rem;
width: 9rem; width: 9rem;
margin-left: 4rem; margin-left: 3rem;
background: url(./assets/logo.svg); background: url(./assets/logo.svg);
background-size: contain; background-size: contain;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
animation: fadeIn;
animation-duration: 2s;
animation-iteration-count: 1;
} }
.r-sidebar { .r-sidebar {

View File

@ -47,6 +47,7 @@
align-items: center; align-items: center;
margin: $small; margin: $small;
padding: $small; padding: $small;
background-color: $bbb;
.progress-bottom { .progress-bottom {
display: flex; display: flex;

View File

@ -45,6 +45,8 @@
.search-icon { .search-icon {
position: absolute; position: absolute;
top: 0;
right: 0;
height: 2.5rem; height: 2.5rem;
width: 2.5rem; width: 2.5rem;
background-image: url(../../icons/search.svg); background-image: url(../../icons/search.svg);

View File

@ -7,12 +7,16 @@ $green: #439443;
$separator: #ffffff46; $separator: #ffffff46;
$pink: #c43a3a; $pink: #c43a3a;
$highlight-blue: #006eff; $highlight-blue: #006eff;
$bbb: #050608; //bottom controls background
// sizes // sizes
$small: 0.5em; $small: 0.5rem;
$smaller: 0.25em; $smaller: 0.25rem;
$medium: 0.75rem;
$large: 1.5rem;
$larger: 2rem;
// media query mixins // media query mixins
@mixin phone-only { @mixin phone-only {
@media (max-width: 599px) { @media (max-width: 599px) {
@content; @content;

View File

@ -95,11 +95,9 @@ button {
} }
.l-sidebar { .l-sidebar {
width: 15em; width: 15rem;
grid-area: l-sidebar; grid-area: l-sidebar;
padding-top: 0.5rem; padding-top: 0.5rem;
margin: 0.5rem 0 0.5rem 0.5rem;
border-radius: 0.5rem;
background-color: $card-dark; background-color: $card-dark;
} }
@ -109,7 +107,7 @@ button {
} }
.collapsed .l-sidebar { .collapsed .l-sidebar {
width: 70px; width: 3rem;
transition: all 0.3s ease; transition: all 0.3s ease;
} }
@ -141,16 +139,6 @@ button {
.r-sidebar { .r-sidebar {
grid-area: r-sidebar; grid-area: r-sidebar;
border-radius: 5px;
margin-right: 0.5rem;
overflow-y: auto;
width: 30em;
position: relative;
margin-bottom: 0.5em;
@include tablet-landscape {
display: none;
}
} }
.image { .image {

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="side-nav-container border" :class="{ collapsed: collapsed }"> <div class="side-nav-container" :class="{ collapsed: collapsed }">
<router-link :to="{ name: 'Home' }"> <router-link :to="{ name: 'Home' }">
<div class="nav-button" id="home-button"> <div class="nav-button" id="home-button">
<div class="in"> <div class="in">
@ -75,14 +75,12 @@ export default {
<style lang="scss"> <style lang="scss">
.collapsed { .collapsed {
.nav-button { .nav-button {
font-size: smaller;
margin-top: 5px; margin-top: 5px;
align-items: center;
justify-content: center;
span { span {
display: none; display: none;
} }
.in { .in {
width: 100%; width: 100%;
flex-direction: column; flex-direction: column;
@ -93,8 +91,9 @@ export default {
.side-nav-container { .side-nav-container {
padding: $small; padding: $small;
color: #fff; color: #fff;
margin-bottom: 10px; margin-bottom: 1rem;
padding-top: 10px; padding-top: 10px;
margin-top: 1rem;
.nav-button { .nav-button {
border-radius: $small; border-radius: $small;
@ -105,7 +104,33 @@ export default {
padding: 0.6rem 0 0.6rem 0; padding: 0.6rem 0 0.6rem 0;
&:hover { &:hover {
background-color: rgb(5, 80, 150); #home-icon {
background-color: rgba(145, 58, 58, 0.555);
}
#album-icon {
background-color: rgba(113, 58, 145, 0.555);
}
#artists-icon {
background-color: rgba(13, 72, 139, 0.555);
}
#playlists-icon {
background-color: rgba(206, 13, 132, 0.555);
}
#mixes-icon {
background-color: rgba(0, 85, 81, 0.555);
}
#folders-icon {
background-color: rgba(90, 89, 3, 0.596);
}
#settings-icon {
background-color: rgba(129, 106, 106, 0.596);
}
} }
.nav-icon { .nav-icon {

View File

@ -0,0 +1,55 @@
<template>
<div class="r-sidebar">
<!-- <div class="m-np"> -->
<!-- <NowPlaying class="hidden"/> -->
<!-- </div> -->
<div class="s">
<Search
v-model:search="search"
@expandSearch="expandSearch"
@collapseSearch="collapseSearch"
/>
</div>
<div class="q">
<UpNext v-model:up_next="up_next" @expandQueue="expandQueue" />
</div>
<div class="r">
<RecommendedArtist />
</div>
</div>
</template>
<script setup>
import { ref } from "vue";
import Search from "../Search.vue";
import UpNext from "./UpNext.vue";
import RecommendedArtist from "@/components/RightSideBar/Recommendation.vue";
let up_next = ref(true);
let search = ref(false);
const expandQueue = () => {
up_next.value = !up_next.value;
};
const expandSearch = () => {
search.value = true;
};
const collapseSearch = () => {
search.value = false;
};
</script>
<style lang="scss">
.r-sidebar {
border-radius: 5px;
margin-right: 0.5rem;
margin-bottom: $small;
overflow-y: auto;
width: 30em;
display: grid;
grid-auto-flow: row;
grid-template-rows: min-content min-content auto;
}
</style>

View File

@ -25,37 +25,7 @@
:class="{ v0: !is_expanded, v1: is_expanded }" :class="{ v0: !is_expanded, v1: is_expanded }"
class="scrollable border" class="scrollable border"
> >
<div <TrackItem v-for="song in queue" :key="song" :track="song" />
class="song-item h-1"
v-for="song in queue"
:key="song"
@click="playThis(song)"
:class="{
currentInQueue: current.id == song.id,
}"
>
<div
class="album-art image"
:style="{
backgroundImage: `url(&quot;${song.image}&quot;)`,
}"
>
<div
class="now-playing-track image"
v-if="current.id == song.id"
:class="{ active: is_playing, not_active: !is_playing }"
></div>
</div>
<div class="tags">
<div class="title ellip">{{ song.title }}</div>
<hr />
<div class="artist ellip">
<span v-for="artist in putCommas(song.artists)" :key="artist">{{
artist
}}</span>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -65,16 +35,14 @@
import { ref, toRefs } from "@vue/reactivity"; import { ref, toRefs } from "@vue/reactivity";
import perks from "@/composables/perks.js"; import perks from "@/composables/perks.js";
import audio from "@/composables/playAudio.js"; import audio from "@/composables/playAudio.js";
import state from "@/composables/state.js";
import { watch } from "@vue/runtime-core"; import { watch } from "@vue/runtime-core";
import TrackItem from "../shared/TrackItem.vue";
export default { export default {
props: ["up_next"], props: ["up_next"],
setup(props, { emit }) { setup(props, { emit }) {
const is_expanded = toRefs(props).up_next; const is_expanded = toRefs(props).up_next;
const queue = ref(perks.queue); const queue = ref(perks.queue);
const current = ref(perks.current);
const next = ref(perks.next); const next = ref(perks.next);
let collapse = () => { let collapse = () => {
@ -90,27 +58,18 @@ export default {
}); });
const { playNext } = audio; const { playNext } = audio;
const { playAudio } = audio;
const playThis = (song) => {
playAudio(song.filepath);
perks.current.value = song;
};
const putCommas = perks.putCommas; const putCommas = perks.putCommas;
return { return {
collapse, collapse,
is_expanded, is_expanded,
is_playing: state.is_playing,
playNext, playNext,
playThis,
putCommas, putCommas,
queue, queue,
current,
next, next,
}; };
}, },
components: { TrackItem },
}; };
</script> </script>
@ -207,38 +166,4 @@ export default {
background-color: transparent; background-color: transparent;
} }
} }
.up-next .scrollable .song-item {
display: flex;
align-items: center;
padding: 0.5rem;
border-radius: 0.5rem;
&:hover {
cursor: pointer;
background-color: $blue;
}
hr {
border: none;
margin: 0.1rem;
}
.album-art {
display: flex;
align-items: center;
justify-content: center;
width: 3rem;
height: 3rem;
margin: 0 0.5rem 0 0;
border-radius: 0.5rem;
background-image: url(../../assets/images/null.webp);
}
.artist {
width: 20rem;
font-size: small;
color: rgba(255, 255, 255, 0.637);
}
}
</style> </style>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="right-search border" ref="searchComponent"> <div class="right-search border" ref="searchComponent">
<div class="input"> <div class="input">
<div class="search-icon image"></div> <Loader />
<Filters :filters="filters" @removeFilter="removeFilter" /> <Filters :filters="filters" @removeFilter="removeFilter" />
<div class="input-loader border"> <div class="input-loader border">
<input <input
@ -13,7 +13,8 @@
placeholder="find your music" placeholder="find your music"
v-model="query" v-model="query"
/> />
<Loader /> <div class="search-icon image"></div>
<!-- -->
</div> </div>
<div <div
class="suggestions v00" class="suggestions v00"

View File

@ -1,5 +1,7 @@
<template> <template>
<div class="loader" v-if="loading"></div> <div class="loaderx" :class="{ loader: loading, not_loader: !loading }">
<div class="content" v-if="!loading">/</div>
</div>
</template> </template>
<script> <script>
@ -14,12 +16,15 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.loader { .loaderx {
position: absolute; position: absolute;
right: 0.65rem; left: 0.65rem;
top: 0.65rem; top: 0.65rem;
width: 1.5rem; width: 1.5rem;
height: 1.5rem; height: 1.5rem;
}
.loader {
border: dotted $blue; border: dotted $blue;
border-radius: 50%; border-radius: 50%;
animation: spin 0.25s linear infinite; animation: spin 0.25s linear infinite;
@ -33,4 +38,10 @@ export default {
} }
} }
} }
.not_loader {
border: solid 1px;
border-radius: 50%;
background-image: url("");
}
</style> </style>

View File

@ -4,11 +4,10 @@
<div class="items"> <div class="items">
<table> <table>
<tbody> <tbody>
<SongItem <TrackItem
v-for="(track, index) in props.tracks" v-for="track in props.tracks"
:key="track" :key="track"
:song="track" :track="track"
:index="index + 1"
/> />
</tbody> </tbody>
</table> </table>
@ -18,8 +17,8 @@
</template> </template>
<script setup> <script setup>
import SongItem from "@/components/shared/SongItem.vue";
import LoadMore from "./LoadMore.vue"; import LoadMore from "./LoadMore.vue";
import TrackItem from "../shared/TrackItem.vue";
const props = defineProps({ const props = defineProps({
tracks: { tracks: {

View File

@ -0,0 +1,87 @@
<template>
<div
class="track-item h-1"
@click="playThis(props.track)"
:class="{
currentInQueue: current.id == props.track.id,
}"
>
<div
class="album-art image"
:style="{
backgroundImage: `url(&quot;${props.track.image}&quot;)`,
}"
>
<div
class="now-playing-track image"
v-if="current.id == props.track.id"
:class="{ active: is_playing, not_active: !is_playing }"
></div>
</div>
<div class="tags">
<div class="title ellip">{{ props.track.title }}</div>
<hr />
<div class="artist ellip">
<span v-for="artist in putCommas(props.track.artists)" :key="artist">{{
artist
}}</span>
</div>
</div>
</div>
</template>
<script setup>
import { ref } from "vue";
import perks from "../../composables/perks";
import playAudio from "../../composables/playAudio";
const props = defineProps({
track: Object,
});
const current = ref(perks.current);
const putCommas = perks.putCommas;
const is_playing = ref(playAudio.playing);
const playThis = (song) => {
playAudio.playAudio(song.filepath);
perks.current.value = song;
};
</script>
<style lang="scss">
.track-item {
display: flex;
align-items: center;
padding: 0.5rem;
border-radius: 0.5rem;
&:hover {
cursor: pointer;
background-color: $blue;
}
hr {
border: none;
margin: 0.1rem;
}
.album-art {
display: flex;
align-items: center;
justify-content: center;
width: 3rem;
height: 3rem;
margin: 0 0.5rem 0 0;
border-radius: 0.5rem;
background-image: url(../../assets/images/null.webp);
}
.artist {
width: 20rem;
font-size: small;
color: rgba(255, 255, 255, 0.637);
}
}
</style>

View File

@ -5,7 +5,6 @@ import router from "./router";
import "../src/assets/css/global.scss"; import "../src/assets/css/global.scss";
import "animate.css";
import mitt from "mitt"; import mitt from "mitt";
const emitter = mitt(); const emitter = mitt();

View File

@ -333,11 +333,6 @@ ajv@^6.10.0, ajv@^6.12.4, ajv@^6.12.5:
json-schema-traverse "^0.4.1" json-schema-traverse "^0.4.1"
uri-js "^4.2.2" uri-js "^4.2.2"
animate.css@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/animate.css/-/animate.css-4.1.1.tgz#614ec5a81131d7e4dc362a58143f7406abd68075"
integrity sha512-+mRmCTv6SbCmtYJCN4faJMNFVNN5EuCTTprDTAo7YzIGji2KADmakjVA3+8mVDkZ2Bf09vayB35lSQIex2+QaQ==
ansi-regex@^5.0.1: ansi-regex@^5.0.1:
version "5.0.1" version "5.0.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"