+
+
+ {{ albumartist }}
+
+
{{
artist
}}
-
- {{ albumartist }}
-
diff --git a/src/components/shared/Input.vue b/src/components/shared/Input.vue
new file mode 100644
index 0000000..2e68c1b
--- /dev/null
+++ b/src/components/shared/Input.vue
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
diff --git a/src/components/shared/SongItem.vue b/src/components/shared/SongItem.vue
index 463a85e..fa7eeb1 100644
--- a/src/components/shared/SongItem.vue
+++ b/src/components/shared/SongItem.vue
@@ -5,7 +5,9 @@
@dblclick="emitUpdate(track)"
@contextmenu.prevent="showMenu"
>
-
{{ index }}
+
+ {{ index }}
+
![]()
{}"
>
@@ -79,17 +82,17 @@ const artisttitle = ref
(null);
const props = defineProps<{
track: Track;
- index?: number;
+ index: number;
isPlaying: Boolean;
isCurrent: Boolean;
}>();
const emit = defineEmits<{
- (e: "updateQueue"): void;
+ (e: "playThis"): void;
}>();
function emitUpdate(track: Track) {
- emit("updateQueue");
+ emit("playThis");
}
function showMenu(e: Event) {
@@ -118,7 +121,7 @@ function showMenu(e: Event) {
.song-album {
max-width: max-content;
- cursor: pointer;
+ cursor: pointer !important;
&:hover {
text-decoration: underline;
@@ -128,10 +131,6 @@ function showMenu(e: Event) {
.song-artists {
width: fit-content;
max-width: 100%;
-
- .artist {
- cursor: pointer;
- }
}
.index {
@@ -158,7 +157,6 @@ function showMenu(e: Event) {
svg {
transition: all 0.2s ease-in;
- // transform: rotate(90deg);
stroke: $track-btn-svg;
circle {
@@ -196,10 +194,6 @@ function showMenu(e: Event) {
left: $small;
top: $small;
}
-
- .title {
- cursor: pointer;
- }
}
td {
diff --git a/src/components/shared/TrackItem.vue b/src/components/shared/TrackItem.vue
index 20230d6..d94982a 100644
--- a/src/components/shared/TrackItem.vue
+++ b/src/components/shared/TrackItem.vue
@@ -24,14 +24,7 @@
-
- {{
- artist
- }}
-
-
- {{ track.albumartist }}
-
+
import { ref } from "vue";
-import { paths } from "@/config";
-import { putCommas } from "@/utils";
-import { Track } from "@/interfaces";
+import DelSvg from "@/assets/icons/delete.svg";
import { showTrackContextMenu as showContext } from "@/composables/context";
-import DelSvg from "@/assets/icons/plus.svg";
+import { paths } from "@/config";
+import { Track } from "@/interfaces";
import useQueueStore from "@/stores/queue";
+import ArtistName from "./ArtistName.vue";
const props = defineProps<{
track: Track;
@@ -70,11 +63,11 @@ function showMenu(e: Event) {
}
const emit = defineEmits<{
- (e: "PlayThis"): void;
+ (e: "playThis"): void;
}>();
const playThis = (track: Track) => {
- emit("PlayThis");
+ emit("playThis");
};
@@ -103,7 +96,7 @@ const playThis = (track: Track) => {
.remove-track {
opacity: 0;
transition: all 0.25s ease;
- transform: translateX(1rem) rotate(45deg);
+ transform: scale(0.75) translateY(1rem);
&:hover {
opacity: 1 !important;
@@ -113,10 +106,9 @@ const playThis = (track: Track) => {
&:hover {
.remove-track {
opacity: 0.5;
- transform: translateX(0) rotate(45deg);
+ transform: scale(1) translateY(0);
}
- cursor: pointer;
background: linear-gradient(37deg, $gray4, $gray3, $gray3);
}
@@ -146,6 +138,7 @@ const playThis = (track: Track) => {
.artist {
font-size: small;
opacity: 0.67;
+ width: fit-content;
}
}
diff --git a/src/composables/colors/album.ts b/src/composables/colors/album.ts
index 9aaa188..2da394a 100644
--- a/src/composables/colors/album.ts
+++ b/src/composables/colors/album.ts
@@ -25,8 +25,14 @@ interface BtnColor {
* @returns {BtnColor} A color to use as the play button background
*/
export function getButtonColor(colors: string[]): BtnColor {
+ const def = {
+ color: "#fff",
+ isDark: true,
+ };
+
+ if (!colors || colors.length === 0) return def;
+
const base_color = colors[0];
- if (colors.length === 0) return { color: "#fff", isDark: true };
for (let i = 0; i < colors.length; i++) {
if (theyContrast(base_color, colors[i])) {
@@ -37,10 +43,7 @@ export function getButtonColor(colors: string[]): BtnColor {
}
}
- return {
- color: "#fff",
- isDark: true,
- };
+ return def;
}
/**
diff --git a/src/composables/enums.ts b/src/composables/enums.ts
index d2b706b..b56dc7c 100644
--- a/src/composables/enums.ts
+++ b/src/composables/enums.ts
@@ -37,3 +37,12 @@ export enum Routes {
search = "SearchView",
queue = "QueueView",
}
+
+export const FuseTrackOptions = {
+ keys: [
+ { name: "title", weight: 1 },
+ { name: "album", weight: 0.7 },
+ { name: "artists", weight: 0.5 },
+ { name: "albumartist", weight: 0.25 },
+ ],
+};
diff --git a/src/composables/fetch/album.ts b/src/composables/fetch/album.ts
index 234e7e7..8e79b37 100644
--- a/src/composables/fetch/album.ts
+++ b/src/composables/fetch/album.ts
@@ -21,11 +21,7 @@ const getAlbumData = async (hash: string, ToastStore: typeof useNotifStore) => {
if (status == 204) {
ToastStore().showNotification("Album not created yet!", NotifType.Error);
return {
- info: {
- album: "",
- artist: "",
- colors: []
- },
+ info: {} as AlbumInfo,
tracks: [],
};
}
diff --git a/src/composables/useKeyboard.ts b/src/composables/useKeyboard.ts
index 0a28788..d4c3cbc 100644
--- a/src/composables/useKeyboard.ts
+++ b/src/composables/useKeyboard.ts
@@ -2,8 +2,8 @@ import useQStore from "@/stores/queue";
let key_down_fired = false;
-function focusSearchBox() {
- const elem = document.getElementById("globalsearch");
+function focusPageSearchBox() {
+ const elem = document.getElementById("page-search") as HTMLInputElement;
elem.focus();
}
@@ -66,16 +66,11 @@ export default function (queue: typeof useQStore) {
if (!key_down_fired) {
if (!ctrlKey) return;
e.preventDefault();
+ focusPageSearchBox();
key_down_fired = true;
}
}
- case "/": {
- {
- e.preventDefault();
- focusSearchBox();
- }
- }
}
});
}
diff --git a/src/composables/usePlayFrom.ts b/src/composables/usePlayFrom.ts
index c39580b..9bf7cc4 100644
--- a/src/composables/usePlayFrom.ts
+++ b/src/composables/usePlayFrom.ts
@@ -24,7 +24,7 @@ export default function play(
store = store as typeof folder;
const f = store();
- useQueue.playFromFolder(f.path, f.tracks);
+ useQueue.playFromFolder(f.path, f.allTracks);
useQueue.play();
break;
case playSources.album:
@@ -35,7 +35,7 @@ export default function play(
a_store.info.title,
a_store.info.artist,
a_store.info.hash,
- a_store.tracks
+ a_store.allTracks
);
useQueue.play();
break;
diff --git a/src/interfaces.ts b/src/interfaces.ts
index 83ab1d4..a070e8b 100644
--- a/src/interfaces.ts
+++ b/src/interfaces.ts
@@ -13,9 +13,9 @@ export interface Track {
bitrate?: number;
genre?: string;
image: string;
- tracknumber?: number;
- discnumber?: number;
- index?: number;
+ tracknumber: number;
+ discnumber: number;
+ index: number;
hash: string;
copyright?: string;
}
@@ -110,3 +110,10 @@ export interface FetchProps {
put?: boolean;
headers?: {};
}
+
+export interface FuseResult {
+ item: Track;
+ refIndex: number;
+}
+
+
diff --git a/src/interfaces/settings.ts b/src/interfaces/settings.ts
index ca6e433..76ccf0b 100644
--- a/src/interfaces/settings.ts
+++ b/src/interfaces/settings.ts
@@ -20,7 +20,7 @@ export interface Setting {
}
export interface SettingGroup {
- title?: string;
+ name?: string;
desc?: string;
settings: Setting[];
}
diff --git a/src/router/index.ts b/src/router/index.ts
index 9ee8933..a222d53 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -81,7 +81,6 @@ const routes = [
await store
.fetchTracksAndArtists(to.params.hash)
- .then(() => store.fetchBio(to.params.hash))
.then(() => {
state.loading.value = false;
});
diff --git a/src/settings/general/index.ts b/src/settings/general/index.ts
index 8a2f108..9f9459d 100644
--- a/src/settings/general/index.ts
+++ b/src/settings/general/index.ts
@@ -1,11 +1,12 @@
import { SettingCategory } from "@/interfaces/settings";
import nowPlaying from "./now-playing";
+import sidebarSettings from "./sidebar";
export default {
title: "General",
groups: [
{
- settings: [...nowPlaying],
+ settings: [...sidebarSettings, ...nowPlaying],
},
],
} as SettingCategory;
diff --git a/src/settings/general/now-playing.ts b/src/settings/general/now-playing.ts
index 5776ddd..32347bc 100644
--- a/src/settings/general/now-playing.ts
+++ b/src/settings/general/now-playing.ts
@@ -10,11 +10,5 @@ const use_alt_np: Setting = {
inactive: () => settings().disable_show_alt_np,
action: () => settings().toggleUseRightNP(),
};
-const use_sidebar: Setting = {
- title: "Use right sidebar",
- type: SettingType.switch,
- source: () => settings().use_sidebar,
- action: () => settings().toggleDisableSidebar(),
-};
-export default [use_sidebar, use_alt_np];
+export default [use_alt_np];
diff --git a/src/settings/general/sidebar.ts b/src/settings/general/sidebar.ts
new file mode 100644
index 0000000..b62cd29
--- /dev/null
+++ b/src/settings/general/sidebar.ts
@@ -0,0 +1,13 @@
+import { Setting, SettingType } from "@/interfaces/settings";
+import useSettingsStore from "@/stores/settings";
+
+const settings = useSettingsStore;
+
+const use_sidebar: Setting = {
+ title: "Use right sidebar",
+ type: SettingType.switch,
+ source: () => settings().use_sidebar,
+ action: () => settings().toggleDisableSidebar(),
+};
+
+export default [use_sidebar];
diff --git a/src/stores/loader.ts b/src/stores/loader.ts
index 3366477..dfc5bbe 100644
--- a/src/stores/loader.ts
+++ b/src/stores/loader.ts
@@ -4,20 +4,32 @@ export default defineStore("Loader", {
state: () => ({
loading: false,
duration: 0,
+ page:
null,
}),
actions: {
startLoading() {
this.loading = true;
this.duration = new Date().getTime();
+
+ if (!this.page) {
+ this.page = document.getElementsByTagName("html")[0] as HTMLHtmlElement;
+ }
+
+ this.page.classList.add("loading");
},
stopLoading() {
const diff = new Date().getTime() - this.duration;
+ const resetCursor = () => {
+ this.page ? this.page.classList.remove("loading") : null;
+ };
if (diff <= 250) {
setTimeout(() => {
+ resetCursor();
this.loading = false;
}, 250 - diff);
} else {
+ resetCursor();
this.loading = false;
}
},
diff --git a/src/stores/pages/album.ts b/src/stores/pages/album.ts
index 665340a..6d34049 100644
--- a/src/stores/pages/album.ts
+++ b/src/stores/pages/album.ts
@@ -1,11 +1,12 @@
+import { useFuse } from "@/utils";
import { defineStore } from "pinia";
+import { ComputedRef } from "vue";
+
+import { FuseTrackOptions } from "@/composables/enums";
+
+import { getAlbumBio, getAlbumTracks } from "../../composables/fetch/album";
+import { AlbumInfo, Artist, FuseResult, Track } from "../../interfaces";
import { useNotifStore } from "../notification";
-import { Track, Artist, AlbumInfo } from "../../interfaces";
-import {
- getAlbumTracks,
- getAlbumArtists,
- getAlbumBio,
-} from "../../composables/fetch/album";
function sortTracks(tracks: Track[]) {
return tracks.sort((a, b) => {
@@ -32,9 +33,9 @@ function createDiscs(tracks: Track[]): Discs {
export default defineStore("album", {
state: () => ({
+ query: "",
info: {},
- tracks: