mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 13:03:02 +00:00
[client] remove search on folder
This commit is contained in:
@@ -12,18 +12,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="search">
|
|
||||||
<div class="loaderr">
|
|
||||||
<Loader />
|
|
||||||
</div>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="search-input"
|
|
||||||
placeholder="Search this folder"
|
|
||||||
v-model="query"
|
|
||||||
/>
|
|
||||||
<div class="search-icon image"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -57,40 +45,14 @@ export default {
|
|||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.folder-top {
|
.folder-top {
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
border-bottom: 1px solid $separator;
|
border-bottom: 1px solid $separator;
|
||||||
width: calc(100% - 0.5rem);
|
width: calc(100% - 0.5rem);
|
||||||
padding-bottom: $small;
|
padding-bottom: $small;
|
||||||
height: 3rem;
|
height: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.folder-top .search {
|
|
||||||
width: 50%;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
place-items: end;
|
|
||||||
|
|
||||||
.loaderr {
|
|
||||||
width: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-input {
|
|
||||||
max-width: 20rem;
|
|
||||||
width: 100%;
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
padding-left: 1rem;
|
|
||||||
background-color: transparent;
|
|
||||||
color: $white;
|
|
||||||
font-size: 1rem;
|
|
||||||
line-height: 2.2rem;
|
|
||||||
outline: none;
|
|
||||||
border: 1px solid $gray3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.folder-top .fname {
|
.folder-top .fname {
|
||||||
width: 50%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
|
|||||||
+19
-108
@@ -1,133 +1,44 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="f-view-parent" class="rounded">
|
<div id="f-view-parent" class="rounded">
|
||||||
<div class="fixed">
|
<div class="fixed">
|
||||||
<Header :path="path" :first_song="songs[0]" @search="updateQueryString" />
|
<Header :path="FStore.path" :first_song="FStore.tracks[0]" />
|
||||||
</div>
|
</div>
|
||||||
<div id="scrollable" ref="scrollable">
|
<div id="scrollable" ref="scrollable">
|
||||||
<FolderList :folders="folders" />
|
<FolderList :folders="FStore.dirs" />
|
||||||
<div class="separator" v-if="folders.length && songs.length"></div>
|
<div
|
||||||
<SongList :songs="songs" />
|
class="separator"
|
||||||
|
v-if="FStore.dirs.length && FStore.tracks.length"
|
||||||
|
></div>
|
||||||
|
<SongList :tracks="FStore.tracks" :path="FStore.path" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
import { computed, ref } from "@vue/reactivity";
|
import { ref } from "@vue/reactivity";
|
||||||
import { useRoute } from "vue-router";
|
import { onBeforeRouteUpdate } from "vue-router";
|
||||||
|
|
||||||
import SongList from "@/components/FolderView/SongList.vue";
|
import SongList from "@/components/FolderView/SongList.vue";
|
||||||
import FolderList from "@/components/FolderView/FolderList.vue";
|
import FolderList from "@/components/FolderView/FolderList.vue";
|
||||||
import Header from "@/components/FolderView/Header.vue";
|
import Header from "@/components/FolderView/Header.vue";
|
||||||
|
|
||||||
import getTracksAndDirs from "../composables/getFilesAndFolders";
|
import useFStore from "../stores/folder";
|
||||||
import { onMounted, watch } from "@vue/runtime-core";
|
import state from "../composables/state";
|
||||||
import state from "@/composables/state";
|
|
||||||
|
|
||||||
export default {
|
const FStore = useFStore();
|
||||||
components: {
|
|
||||||
SongList,
|
|
||||||
FolderList,
|
|
||||||
Header,
|
|
||||||
},
|
|
||||||
setup() {
|
|
||||||
const route = useRoute();
|
|
||||||
const path = ref(route.params.path);
|
|
||||||
|
|
||||||
const song_list = ref(state.folder_song_list);
|
const scrollable = ref(null);
|
||||||
const folders_list = ref(state.folder_list);
|
|
||||||
|
|
||||||
const scrollable = ref(null);
|
onBeforeRouteUpdate((to) => {
|
||||||
|
|
||||||
const query = ref("");
|
|
||||||
|
|
||||||
const songs = computed(() => {
|
|
||||||
const songs_ = [];
|
|
||||||
|
|
||||||
if (query.value.length) {
|
|
||||||
for (let i = 0; i < song_list.value.length; i++) {
|
|
||||||
if (
|
|
||||||
song_list.value[i].title
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(query.value.toLowerCase())
|
|
||||||
) {
|
|
||||||
songs_.push(song_list.value[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return songs_;
|
|
||||||
} else {
|
|
||||||
return song_list.value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const folders = computed(() => {
|
|
||||||
const folders_ = [];
|
|
||||||
|
|
||||||
if (query.value.length) {
|
|
||||||
for (let i = 0; i < folders_list.value.length; i++) {
|
|
||||||
if (
|
|
||||||
folders_list.value[i].name
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(query.value.toLowerCase())
|
|
||||||
) {
|
|
||||||
folders_.push(folders_list.value[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return folders_;
|
|
||||||
} else {
|
|
||||||
return folders_list.value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
const getDirData = (path) => {
|
|
||||||
state.loading.value = true;
|
state.loading.value = true;
|
||||||
getTracksAndDirs(path)
|
FStore.fetchAll(to.params.path)
|
||||||
.then((data) => {
|
.then(() => {
|
||||||
scrollable.value.scrollTop = 0;
|
scrollable.value.scrollTop = 0;
|
||||||
|
|
||||||
state.folder_song_list.value = data.tracks;
|
|
||||||
state.folder_list.value = data.folders;
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
state.loading.value = false;
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setTimeout(() => {
|
state.loading.value = false;
|
||||||
query.value = "";
|
|
||||||
}, 100);
|
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
|
|
||||||
getDirData(path.value);
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => route.params,
|
|
||||||
() => {
|
|
||||||
path.value = route.params.path;
|
|
||||||
|
|
||||||
if (!path.value) return;
|
|
||||||
|
|
||||||
getDirData(path.value);
|
|
||||||
console.log(path.value);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
function updateQueryString(value) {
|
|
||||||
query.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
updateQueryString,
|
|
||||||
songs,
|
|
||||||
folders,
|
|
||||||
path,
|
|
||||||
scrollable,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
Reference in New Issue
Block a user