mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 13:03:02 +00:00
add heart icon for favoriting on songitem
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
id="update-pl-image-upload"
|
id="update-pl-image-upload"
|
||||||
style="display: none"
|
style="display: none"
|
||||||
@change="handleUpload"
|
@change="handleUpload"
|
||||||
|
ref="dropZoneRef"
|
||||||
/>
|
/>
|
||||||
<div id="upload" class="rounded-sm" @click="selectFiles">
|
<div id="upload" class="rounded-sm" @click="selectFiles">
|
||||||
<div>Click to upload cover image</div>
|
<div>Click to upload cover image</div>
|
||||||
@@ -41,11 +42,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { updatePlaylist } from "@/composables/fetch/playlists";
|
import { onMounted, ref } from "vue";
|
||||||
|
// import { useDropZone } from "@vueuse/core";
|
||||||
|
|
||||||
|
import { paths } from "@/config";
|
||||||
import { Playlist } from "@/interfaces";
|
import { Playlist } from "@/interfaces";
|
||||||
import usePStore from "@/stores/pages/playlist";
|
import usePStore from "@/stores/pages/playlist";
|
||||||
import { onMounted, ref } from "vue";
|
import { updatePlaylist } from "@/composables/fetch/playlists";
|
||||||
import { paths } from "@/config";
|
|
||||||
|
|
||||||
const pStore = usePStore();
|
const pStore = usePStore();
|
||||||
|
|
||||||
@@ -53,6 +56,9 @@ const props = defineProps<{
|
|||||||
playlist: Playlist;
|
playlist: Playlist;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
// const dropZoneRef = ref<HTMLDivElement>();
|
||||||
|
// const { isOverDropZone } = useDropZone(dropZoneRef, handleDrop);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
(document.getElementById("modal-playlist-name-input") as HTMLElement).focus();
|
(document.getElementById("modal-playlist-name-input") as HTMLElement).focus();
|
||||||
});
|
});
|
||||||
@@ -83,6 +89,12 @@ function handleUpload() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function handleDrop(files: File[] | null) {
|
||||||
|
// if (files) {
|
||||||
|
// handleFile(files[0]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
function handleFile(file: File) {
|
function handleFile(file: File) {
|
||||||
if (!file || !file.type.startsWith("image/")) {
|
if (!file || !file.type.startsWith("image/")) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="songlist-item"
|
class="songlist-item rounded-sm"
|
||||||
:class="[{ current: isCurrent }, { contexton: context_on }]"
|
:class="[{ current: isCurrent }, { contexton: context_on }]"
|
||||||
@dblclick="emitUpdate(track)"
|
@dblclick="emitUpdate(track)"
|
||||||
@contextmenu.prevent="showMenu"
|
@contextmenu.prevent="showMenu"
|
||||||
>
|
>
|
||||||
<div class="index t-center ellip">
|
<div class="index t-center ellip" @dblclick.prevent.stop="() => {}">
|
||||||
|
<span class="text">
|
||||||
{{ index }}
|
{{ index }}
|
||||||
|
</span>
|
||||||
|
<HeartSvg />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div @click="emitUpdate(track)" class="thumbnail">
|
<div @click="emitUpdate(track)" class="thumbnail">
|
||||||
@@ -66,13 +69,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
|
||||||
import OptionSvg from "@/assets/icons/more.svg";
|
|
||||||
|
|
||||||
import { showTrackContextMenu as showContext } from "@/composables/context";
|
|
||||||
import { paths } from "@/config";
|
import { paths } from "@/config";
|
||||||
import { Track } from "@/interfaces";
|
import { Track } from "@/interfaces";
|
||||||
import { formatSeconds } from "@/utils";
|
import { formatSeconds } from "@/utils";
|
||||||
|
import { showTrackContextMenu as showContext } from "@/composables/context";
|
||||||
|
|
||||||
import ArtistName from "./ArtistName.vue";
|
import ArtistName from "./ArtistName.vue";
|
||||||
|
import HeartSvg from "@/assets/icons/heart.svg";
|
||||||
|
import OptionSvg from "@/assets/icons/more.svg";
|
||||||
|
|
||||||
const context_on = ref(false);
|
const context_on = ref(false);
|
||||||
const imguri = paths.images.thumb.small;
|
const imguri = paths.images.thumb.small;
|
||||||
@@ -109,6 +113,7 @@ function showMenu(e: Event) {
|
|||||||
height: 3.75rem;
|
height: 3.75rem;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
padding-left: $small;
|
||||||
|
|
||||||
.song-title {
|
.song-title {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -116,6 +121,18 @@ function showMenu(e: Event) {
|
|||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: $gray4;
|
background-color: $gray4;
|
||||||
|
|
||||||
|
.index {
|
||||||
|
.text {
|
||||||
|
transform: translateX($smaller);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
transform: translateX(0);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.song-album {
|
.song-album {
|
||||||
@@ -136,6 +153,27 @@ function showMenu(e: Event) {
|
|||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
height: 3rem;
|
||||||
|
// border: solid 1px;
|
||||||
|
|
||||||
|
.text {
|
||||||
|
opacity: 1;
|
||||||
|
display: block;
|
||||||
|
margin: auto 0;
|
||||||
|
transition: all 0.25s;
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
transition: all 0.2s;
|
||||||
|
top: $medium;
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(-1rem);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.song-duration {
|
.song-duration {
|
||||||
|
|||||||
Reference in New Issue
Block a user