Skip to content

Commit c5dbae0

Browse files
authored
Some very small fixes and tweaks after beta testing (#1164)
* Only show now playing label on desktop layout * Show Now playing badge only when player is playing * Add option to show the mobile layout even on desktop * Update store.ts
1 parent aec4d98 commit c5dbae0

File tree

11 files changed

+67
-37
lines changed

11 files changed

+67
-37
lines changed

src/App.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ onMounted(() => {
6464
const allowBuiltinPlayer =
6565
localStorage.getItem("frontend.settings.enable_builtin_player") != "false";
6666
67+
const forceMobileLayout =
68+
localStorage.getItem("frontend.settings.force_mobile_layout") == "true";
69+
store.forceMobileLayout = forceMobileLayout;
70+
6771
// set color theme (and listen for color scheme changes from browser)
6872
setTheme();
6973
window

src/components/ItemsListing.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ import {
196196
ItemMapping,
197197
MediaItemTypeOrItemMapping,
198198
MediaType,
199+
PlaybackState,
199200
PodcastEpisode,
200201
Radio,
201202
type Album,
@@ -388,6 +389,7 @@ const isSelected = function (item: MediaItemTypeOrItemMapping) {
388389
};
389390
390391
const isPlaying = function (item: MediaItemType, itemtype: string): boolean {
392+
if (store.activePlayer?.playback_state != PlaybackState.PLAYING) return false;
391393
const current = store.curQueueItem?.media_item as
392394
| Track
393395
| Radio

src/components/ListviewItem.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@
153153
<!-- actions -->
154154
<template #append>
155155
<!-- Now Playing Badge -->
156-
<NowPlayingBadge v-if="isPlaying" />
156+
<NowPlayingBadge
157+
v-if="isPlaying"
158+
:show-badge="getBreakpointValue('bp7')"
159+
/>
157160
<!-- hi res icon -->
158161
<v-img
159162
v-if="HiResDetails"

src/components/LyricsViewer.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ const hasTimestamps = computed(() => {
150150
const plainLyrics = props.mediaItem?.metadata?.lyrics;
151151
152152
// Check lrc_lyrics field
153-
if (syncedLyrics && syncedLyrics.includes('[')) {
153+
if (syncedLyrics && syncedLyrics.includes("[")) {
154154
return true;
155155
}
156156
@@ -229,7 +229,9 @@ const fetchLyrics = () => {
229229
logSync(`Loaded ${lyrics.value.length} synchronized lyrics lines`, false);
230230
} else if (lyricsToProcess) {
231231
// For plain text lyrics without timestamps
232-
const lyricsLines = lyricsToProcess.split("\n").filter((line) => line.trim());
232+
const lyricsLines = lyricsToProcess
233+
.split("\n")
234+
.filter((line) => line.trim());
233235
234236
lyrics.value = lyricsLines
235237
.map((line) => ({

src/components/Toolbar.vue

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<template #title>
1919
<slot name="title">
20-
<div v-if="!getBreakpointValue('bp3') && home" class="mobile-brand">
20+
<div v-if="store.mobileLayout && home" class="mobile-brand">
2121
<img
2222
src="@/assets/icon.svg"
2323
alt="Music Assistant"
@@ -194,6 +194,7 @@
194194
import { ContextMenuItem } from "@/layouts/default/ItemContextMenu.vue";
195195
import { api } from "@/plugins/api";
196196
import { getBreakpointValue } from "../plugins/breakpoint";
197+
import { store } from "@/plugins/store";
197198
198199
// properties
199200
export interface Props {
@@ -268,22 +269,18 @@ export interface ToolBarMenuItem extends ContextMenuItem {
268269
}
269270
270271
/* Mobile branding on the left */
271-
@media (max-width: 575px) {
272-
.mobile-brand {
273-
display: flex;
274-
align-items: center;
275-
gap: 1rem;
276-
}
277-
278-
.mobile-brand-logo {
279-
height: 30px;
280-
width: 30px;
281-
}
282-
283-
.mobile-brand-text {
284-
font-weight: 600;
285-
letter-spacing: 0.5px;
286-
margin-top: 4px;
287-
}
272+
.mobile-brand {
273+
display: flex;
274+
align-items: center;
275+
gap: 1rem;
276+
}
277+
.mobile-brand-logo {
278+
height: 30px;
279+
width: 30px;
280+
}
281+
.mobile-brand-text {
282+
font-weight: 600;
283+
letter-spacing: 0.5px;
284+
margin-top: 4px;
288285
}
289286
</style>

src/layouts/default/Footer.vue

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<!-- gradient background panel to make the footer player more elevated (and hide content behind it)-->
33
<div
4-
v-if="getBreakpointValue({ breakpoint: 'tablet' })"
4+
v-if="store.mobileLayout"
55
:class="$vuetify.theme.current.dark ? 'gradient-dark' : 'gradient-light'"
66
:style="`
77
position: fixed;
@@ -11,22 +11,17 @@
1111
z-index: 999;
1212
`"
1313
></div>
14-
<BottomNavigation
15-
v-if="getBreakpointValue({ breakpoint: 'tablet' })"
16-
:height="bottomNavHeight"
17-
/>
14+
<BottomNavigation v-if="store.mobileLayout" :height="bottomNavHeight" />
1815
<v-footer
1916
app
2017
color="default"
2118
:class="`py-0 px-0 ${
22-
getBreakpointValue({ breakpoint: 'tablet' })
19+
store.mobileLayout
2320
? 'mediacontrols-player-float'
2421
: 'mediacontrols-player-default'
2522
}`"
2623
>
27-
<Player
28-
:use-floating-player="getBreakpointValue({ breakpoint: 'tablet' })"
29-
/>
24+
<Player :use-floating-player="store.mobileLayout" />
3025
</v-footer>
3126
</template>
3227

@@ -36,6 +31,7 @@ import Player from "./PlayerOSD/Player.vue";
3631
import { store } from "@/plugins/store";
3732
import { computed } from "vue";
3833
import BottomNavigation from "@/components/navigation/BottomNavigation.vue";
34+
import { parseBool } from "@/helpers/utils";
3935
4036
const bottomNavHeight = computed(() => {
4137
if (store.isInStandaloneMode) {

src/layouts/default/PlayerOSD/PlayerFullscreen.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,11 @@
398398
<NowPlayingBadge
399399
v-if="
400400
item.queue_item_id ===
401-
store.curQueueItem?.queue_item_id
401+
store.curQueueItem?.queue_item_id &&
402+
store.activePlayer?.playback_state !=
403+
PlaybackState.IDLE
402404
"
405+
:show-badge="getBreakpointValue('bp4')"
403406
/>
404407
<v-icon v-if="!item.available">mdi-alert</v-icon>
405408
</template>
@@ -622,6 +625,7 @@ import {
622625
QueueOption,
623626
Track,
624627
PLAYER_CONTROL_NONE,
628+
PlaybackState,
625629
} from "@/plugins/api/interfaces";
626630
import { getBreakpointValue } from "@/plugins/breakpoint";
627631
import { eventbus } from "@/plugins/eventbus";

src/layouts/default/View.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<template>
22
<v-main id="cont" class="main-layout">
3-
<Navigation
4-
v-if="!getBreakpointValue({ breakpoint: 'tablet' })"
5-
class="nav-section"
6-
/>
3+
<Navigation v-if="!store.mobileLayout" class="nav-section" />
74
<div class="content-section">
85
<router-view v-slot="{ Component }">
96
<component :is="Component" />

src/plugins/store.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import { MediaType, Player, PlayerQueue, QueueItem } from "./api/interfaces";
33

44
import api from "./api";
55
import { StoredState } from "@/components/ItemsListing.vue";
6-
import { isTouchscreenDevice } from "@/helpers/utils";
6+
import { isTouchscreenDevice, parseBool } from "@/helpers/utils";
77

88
import MobileDetect from "mobile-detect";
9+
import { getBreakpointValue } from "./breakpoint";
910

1011
type DeviceType = "desktop" | "phone" | "tablet";
1112
const md = new MobileDetect(window.navigator.userAgent);
@@ -59,6 +60,8 @@ interface Store {
5960
playMenuShown: boolean;
6061
playActionInProgress: boolean;
6162
deviceType: DeviceType;
63+
forceMobileLayout?: boolean;
64+
mobileLayout: boolean;
6265
}
6366

6467
export const store: Store = reactive({
@@ -114,4 +117,10 @@ export const store: Store = reactive({
114117
playMenuShown: false,
115118
playActionInProgress: false,
116119
deviceType: DEVICE_TYPE,
120+
mobileLayout: computed(() => {
121+
return (
122+
getBreakpointValue({ breakpoint: "tablet" }) ||
123+
parseBool(store.forceMobileLayout)
124+
);
125+
}),
117126
});

src/translations/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@
369369
"el_GR": "Greek"
370370
}
371371
},
372+
"force_mobile_layout": {
373+
"label": "Force mobile layout",
374+
"description": "Force the mobile layout (with the menu-navigation at the bottom), even on larger screens."
375+
},
372376
"no_music_providers": "No Music Providers configured",
373377
"no_music_providers_detail": "Start your Music Assistant experience by adding your Music providers.",
374378
"no_player_providers": "No Player Providers configured",
@@ -751,4 +755,4 @@
751755
"radiobrowser_by_votes": "By votes",
752756
"radiobrowser_by_clicks": "By clicks",
753757
"radiobrowser_by_language": "By language"
754-
}
758+
}

0 commit comments

Comments
 (0)