Skip to content

Commit

Permalink
Fix: Recently played widget
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Jan 14, 2025
1 parent e573245 commit ba8e8e6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/components/HomeWidgetRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import api from "@/plugins/api";
import { itemIsAvailable } from "@/plugins/api/helpers";
import {
BrowseFolder,
ItemMapping,
MediaItemType,
MediaType,
PlayerQueue,
Expand All @@ -67,7 +68,7 @@ export interface WidgetRow {
label: string;
icon: string;
path?: string;
items: MediaItemType[];
items: Array<MediaItemType | ItemMapping>;
count?: number;
queues?: PlayerQueue[];
}
Expand Down
32 changes: 27 additions & 5 deletions src/components/PanelviewItemCompact.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
>
{{ item.owner }}
</v-list-item-subtitle>
<v-list-item-subtitle
v-else-if="!('provider_mappings' in item)"
class="line-clamp-1"
>
{{ $t(item.media_type) }}
</v-list-item-subtitle>
</v-list-item>
</div>
<!-- play button -->
Expand All @@ -81,6 +87,7 @@
import MediaItemThumb from "./MediaItemThumb.vue";
import {
BrowseFolder,
ItemMapping,
type MediaItemType,
MediaType,
} from "@/plugins/api/interfaces";
Expand All @@ -89,7 +96,7 @@ import { store } from "@/plugins/store";
// properties
export interface Props {
item: MediaItemType;
item: MediaItemType | ItemMapping;
size?: number;
isSelected?: boolean;
showCheckboxes?: boolean;
Expand All @@ -106,10 +113,25 @@ const compProps = withDefaults(defineProps<Props>(), {
// emits
const emit = defineEmits<{
(e: "menu", item: MediaItemType, posX: number, posY: number): void;
(e: "click", item: MediaItemType, posX: number, posY: number): void;
(e: "play", item: MediaItemType, posX: number, posY: number): void;
(e: "select", item: MediaItemType, selected: boolean): void;
(
e: "menu",
item: MediaItemType | ItemMapping,
posX: number,
posY: number,
): void;
(
e: "click",
item: MediaItemType | ItemMapping,
posX: number,
posY: number,
): void;
(
e: "play",
item: MediaItemType | ItemMapping,
posX: number,
posY: number,
): void;
(e: "select", item: MediaItemType | ItemMapping, selected: boolean): void;
}>();
const onMenu = function (evt: PointerEvent | TouchEvent) {
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,8 @@ export class MusicAssistantApi {

public async getRecentlyPlayedItems(
limit = 10,
media_types: MediaType[] = [MediaType.TRACK, MediaType.RADIO],
): Promise<MediaItemType[]> {
media_types?: MediaType[],
): Promise<ItemMapping[]> {
return this.sendCommand("music/recently_played_items", {
limit,
media_types,
Expand Down

0 comments on commit ba8e8e6

Please sign in to comment.