From d6b2f8741b915ab28a04dfd5ff406c7fc1a372e1 Mon Sep 17 00:00:00 2001
From: monorail <19031674-monorail@users.noreply.gitlab.com>
Date: Sat, 31 Aug 2024 00:49:35 +0200
Subject: [PATCH] better follow ui
---
webui/src/components/TheSidebar.vue | 2 +-
webui/src/components/pages/Spotify.vue | 102 +++++++++++++++++++------
webui/src/data/sidebar.js | 4 +-
webui/src/lang/en.mjs | 5 +-
webui/src/router.js | 2 +-
5 files changed, 86 insertions(+), 29 deletions(-)
diff --git a/webui/src/components/TheSidebar.vue b/webui/src/components/TheSidebar.vue
index 309241b..2894575 100644
--- a/webui/src/components/TheSidebar.vue
+++ b/webui/src/components/TheSidebar.vue
@@ -109,7 +109,7 @@ export default defineComponent({
left: 30px;
}
-a[aria-label="spotify home"] i {
+a[aria-label="Spotify Feed"] i {
transform: rotate(-90deg);
}
diff --git a/webui/src/components/pages/Spotify.vue b/webui/src/components/pages/Spotify.vue
index 9e6e71f..be97914 100644
--- a/webui/src/components/pages/Spotify.vue
+++ b/webui/src/components/pages/Spotify.vue
@@ -7,9 +7,21 @@
sync
-
-
-
+
+
+
{{ user }}
+
+ launch
+
+
+
+
+
+
+
+
@@ -60,7 +72,7 @@ import CoverContainer from '@/components/globals/CoverContainer.vue';
import PreviewControls from '@/components/globals/PreviewControls.vue';
import { useSpotifyPlaylists } from '@/use/spotifyplaylists';
-import { ref, watch } from 'vue';
+import { computed, ref, watch } from 'vue';
import { toast } from '@/utils/toasts';
import { socket } from '@/utils/socket';
import store from '@/store';
@@ -78,6 +90,12 @@ export default {
setup() {
const lastUser = ref('');
const spotifyUser = ref('');
+ const toBeFollowed = ref('');
+ const followedUsers = computed(() => spotifyUser.value
+ .split(",")
+ .map(user => user.trim())
+ .filter(Boolean)
+ )
const i18n = useI18n();
const {
@@ -114,39 +132,75 @@ export default {
}
};
+ const followUser = () => {
+ if (spotifyUser.value.includes(toBeFollowed.value)) return;
+ spotifyUser.value += `,${toBeFollowed.value}`
+ toBeFollowed.value = ''
+ updateFollowedUsers()
+ }
+
+ const unfollowUser = (user) => {
+ followedUsers.value.splice(followedUsers.value.indexOf(user), 1)
+ spotifyUser.value = followedUsers.value.join(",")
+ updateFollowedUsers()
+ }
+
console.log("ref values", spotifyUser.value, lastUser.value)
return {
+ i18n,
spotifyPlaylists: favoriteSpotifyPlaylists,
isRefreshingSpotifyPlaylists,
refreshSpotifyPlaylists,
spotifyUser,
lastUser,
updateFollowedUsers,
+ followedUsers,
+ toBeFollowed,
+ followUser,
+ unfollowUser
};
},
};
diff --git a/webui/src/data/sidebar.js b/webui/src/data/sidebar.js
index 065b25c..8c96d55 100644
--- a/webui/src/data/sidebar.js
+++ b/webui/src/data/sidebar.js
@@ -30,8 +30,8 @@ export const links = [
},
{
name: 'spotify-home',
- ariaLabel: 'spotify home',
- routerName: 'Spotify Home',
+ ariaLabel: 'Spotify Feed',
+ routerName: 'Spotify Feed',
icon: 'contactless',
label: 'sidebar.spotify',
},
diff --git a/webui/src/lang/en.mjs b/webui/src/lang/en.mjs
index 606a0eb..7fabf60 100644
--- a/webui/src/lang/en.mjs
+++ b/webui/src/lang/en.mjs
@@ -502,7 +502,7 @@ const en = {
charts: 'charts',
favorites: 'favorites',
linkAnalyzer: 'link analyzer',
- spotify: 'spotify home',
+ spotify: 'Spotify Feed',
settings: 'settings',
logs: 'logs',
about: 'about'
@@ -519,6 +519,9 @@ const en = {
p2: `Deemix doesen't currenly implement Spotify Auth, so it can't access private playlists.`,
p3: `Accessing private playlists is not planned.`
},
+ follow: 'Follow',
+ tbfPlaceholder: 'user id to be followed, found here: https://open.spotify.com/user/'
+
}
}
diff --git a/webui/src/router.js b/webui/src/router.js
index 363edb4..9548254 100644
--- a/webui/src/router.js
+++ b/webui/src/router.js
@@ -101,7 +101,7 @@ const routes = [
},
{
path: '/spotify-home',
- name: 'Spotify Home',
+ name: 'Spotify Feed',
component: Spotify
},
{