mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
feat: show search icon in header instead of input
+ fix: persistent updating text on update playlist modal
+ move router routes to a separate file
+ lazy import route components
+ remove loading: lazy from songcard
+ remove unused imports on navigation component
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<router-link :to="{ name: 'FolderView', params: { path: folder.path } }">
|
||||
<router-link :to="{ name: Routes.folder, params: { path: folder.path } }">
|
||||
<div class="f-item">
|
||||
<div class="icon">
|
||||
<FolderSvg v-if="!folder.is_sym" />
|
||||
@@ -16,8 +16,10 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Folder } from "@/interfaces";
|
||||
import FolderSvg from "../../assets/icons/folder.svg";
|
||||
import SymLinkSvg from "../../assets/icons/symlink.svg";
|
||||
import { Routes } from "@/composables/enums";
|
||||
|
||||
import FolderSvg from "@/assets/icons/folder.svg";
|
||||
import SymLinkSvg from "@/assets/icons/symlink.svg";
|
||||
|
||||
defineProps<{
|
||||
folder: Folder;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
:src="imguri + track?.image"
|
||||
alt=""
|
||||
class="l-image rounded force-lm"
|
||||
loading="lazy"
|
||||
/>
|
||||
<div id="bitrate" v-if="track?.bitrate">
|
||||
{{ track.filetype }}• {{ track.bitrate }}
|
||||
|
||||
@@ -22,18 +22,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from "@vue/reactivity";
|
||||
|
||||
import { Routes } from "@/composables/enums";
|
||||
import useSettingsStore from "@/stores/settings";
|
||||
|
||||
import PlaylistSvg from "../../assets/icons/playlist.svg";
|
||||
import FolderSvg from "../../assets/icons/folder.svg";
|
||||
import SettingsSvg from "../../assets/icons/settings.svg";
|
||||
import SearchSvg from "../../assets/icons/search.svg";
|
||||
|
||||
const settings = useSettingsStore();
|
||||
|
||||
const menus = [
|
||||
{
|
||||
name: "playlists",
|
||||
@@ -101,7 +95,7 @@ const menus = [
|
||||
margin: 0 $small 0 $small;
|
||||
border-radius: $small;
|
||||
transform: scale(0.9);
|
||||
opacity: .75;
|
||||
opacity: 0.75;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
>
|
||||
<img
|
||||
:src="imguri + playlist.thumb"
|
||||
class="rounded border"
|
||||
:class="{ noimg: !playlist.thumb }"
|
||||
class="rounded"
|
||||
:class="{ border: !playlist.thumb }"
|
||||
/>
|
||||
<div class="overlay rounded">
|
||||
<div class="p-name ellip">{{ playlist.name }}</div>
|
||||
@@ -42,11 +42,6 @@ const props = defineProps<{
|
||||
object-fit: cover;
|
||||
transition: all 0.5s ease;
|
||||
}
|
||||
|
||||
img.noimg {
|
||||
outline: 1px solid $gray2;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<form
|
||||
@submit="update_playlist"
|
||||
@submit.prevent="update_playlist"
|
||||
class="new-p-form"
|
||||
enctype="multipart/form-data"
|
||||
>
|
||||
@@ -34,7 +34,9 @@
|
||||
}"
|
||||
/>
|
||||
</div>
|
||||
<button type="submit" id="updateplaylistsubmit">Update</button>
|
||||
<button>
|
||||
{{ clicked ? "Updating" : "Update" }}
|
||||
</button>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
@@ -42,7 +44,7 @@
|
||||
import { updatePlaylist } from "@/composables/fetch/playlists";
|
||||
import { Playlist } from "@/interfaces";
|
||||
import usePStore from "@/stores/pages/playlist";
|
||||
import { onMounted } from "vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { paths } from "@/config";
|
||||
|
||||
const pStore = usePStore();
|
||||
@@ -96,27 +98,27 @@ function handleFile(file: File) {
|
||||
image = file;
|
||||
}
|
||||
|
||||
let clicked = false;
|
||||
let clicked = ref(false);
|
||||
|
||||
function update_playlist(e: Event) {
|
||||
e.preventDefault();
|
||||
|
||||
if (!clicked) {
|
||||
clicked = true;
|
||||
const elem = document.getElementById(
|
||||
"updateplaylistsubmit"
|
||||
) as HTMLButtonElement;
|
||||
elem.innerText = "Updating";
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
const form = e.target as HTMLFormElement;
|
||||
const formData = new FormData(form);
|
||||
|
||||
const name = formData.get("name") as string;
|
||||
|
||||
const nameChanged = name !== props.playlist.name;
|
||||
const imgChanged = image !== undefined;
|
||||
|
||||
if (!nameChanged && !imgChanged) {
|
||||
emit("hideModal");
|
||||
return;
|
||||
}
|
||||
|
||||
clicked.value = true;
|
||||
|
||||
formData.append("image", image);
|
||||
|
||||
if (formData.get("name").toString().trim() !== "") {
|
||||
if (name && name.toString().trim() !== "") {
|
||||
updatePlaylist(props.playlist.playlistid, formData, pStore).then(() => {
|
||||
emit("hideModal");
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
import { AlbumInfo } from "../../interfaces";
|
||||
import { paths } from "../../config";
|
||||
|
||||
const imguri = paths.images.thumb;
|
||||
const imguri = paths.images.thumb.large;
|
||||
defineProps<{
|
||||
album: AlbumInfo;
|
||||
}>();
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
<template>
|
||||
<div v-tooltip="returnArtists()" style="width: auto">
|
||||
<div
|
||||
class="ellip"
|
||||
v-if="
|
||||
artists === null ||
|
||||
artists.length === 0 ||
|
||||
(artists[0] === '' && artists.length === 1)
|
||||
"
|
||||
>
|
||||
<div class="ellip" v-if="artists === null || artists.length === 0">
|
||||
<span>{{ albumartist }}</span>
|
||||
</div>
|
||||
<div class="ellip" v-else>
|
||||
@@ -27,12 +20,9 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
function returnArtists() {
|
||||
if (props.artists === null) return props.albumartist;
|
||||
if (props.artists === null || props.artists.length === 0)
|
||||
return props.albumartist;
|
||||
|
||||
if (props.artists[0] !== "" && props.artists.length > 1) {
|
||||
return props.artists.join(", ");
|
||||
}
|
||||
|
||||
return props.albumartist;
|
||||
return props.artists.join(", ");
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,20 +1,31 @@
|
||||
<template>
|
||||
<input
|
||||
type="search"
|
||||
class="header-input rounded-sm pad-sm"
|
||||
placeholder="Search here"
|
||||
v-model.trim="source"
|
||||
id="page-search"
|
||||
/>
|
||||
<div class="header-input-wrapper rounded-sm" :class="{ showInput: clicked }">
|
||||
<div class="search-svg" @click="clicked = !clicked">
|
||||
<SearchSvg />
|
||||
</div>
|
||||
<input
|
||||
type="search"
|
||||
class="header-input rounded-sm pad-sm"
|
||||
:class="{ showInput: clicked }"
|
||||
placeholder="Search here"
|
||||
v-model.trim="source"
|
||||
id="page-search"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import usePStore from "@/stores/pages/playlist";
|
||||
import useFolderStore from "@/stores/pages/folder";
|
||||
import useAlbumStore from "@/stores/pages/album";
|
||||
|
||||
import { ref } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
import usePStore from "@/stores/pages/playlist";
|
||||
import useAlbumStore from "@/stores/pages/album";
|
||||
import useFolderStore from "@/stores/pages/folder";
|
||||
|
||||
import { Routes } from "@/composables/enums";
|
||||
import SearchSvg from "@/assets/icons/search.svg";
|
||||
|
||||
const clicked = ref(false);
|
||||
|
||||
const { query: playlistQuery } = storeToRefs(usePStore());
|
||||
const { query: folderQuery } = storeToRefs(useFolderStore());
|
||||
@@ -44,6 +55,18 @@ const source = getRef();
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.header-input-wrapper {
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
width: 1.5rem;
|
||||
transition: all 0.25s;
|
||||
|
||||
&.showInput {
|
||||
width: 15rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.header-input {
|
||||
background-color: $gray3;
|
||||
outline: none;
|
||||
@@ -51,9 +74,35 @@ const source = getRef();
|
||||
color: inherit;
|
||||
font-size: 1rem;
|
||||
z-index: 200;
|
||||
|
||||
transition: all 0.25s $overshoot;
|
||||
opacity: 0;
|
||||
transform: translateY(-1rem);
|
||||
|
||||
&:focus {
|
||||
outline: solid;
|
||||
}
|
||||
|
||||
&.showInput {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
transition-delay: .1s;
|
||||
}
|
||||
}
|
||||
|
||||
.search-svg {
|
||||
// outline: solid;
|
||||
margin-top: $smaller;
|
||||
cursor: pointer;
|
||||
// padding-left: ;
|
||||
width: 2.25rem;
|
||||
height: 2rem;
|
||||
// aspect-ratio: 1;
|
||||
z-index: 100;
|
||||
|
||||
svg {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
// outline: solid;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user