style: hearts for loved tracks
This commit is contained in:
@@ -117,9 +117,18 @@ export default async function () {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark listenings that appear in favorites
|
||||||
|
const favSet = new Set(
|
||||||
|
(favorites?.favorites || []).map((f) => `${f.track}\0${f.artist}`)
|
||||||
|
);
|
||||||
|
const enrichedListenings = (listenings?.listenings || []).map((l) => ({
|
||||||
|
...l,
|
||||||
|
favorite: favSet.has(`${l.track}\0${l.artist}`),
|
||||||
|
}));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
nowPlaying: nowPlaying || null,
|
nowPlaying: nowPlaying || null,
|
||||||
listenings: listenings?.listenings || [],
|
listenings: enrichedListenings,
|
||||||
favorites: favorites?.favorites || [],
|
favorites: favorites?.favorites || [],
|
||||||
stats: formattedStats,
|
stats: formattedStats,
|
||||||
instanceUrl: FUNKWHALE_INSTANCE,
|
instanceUrl: FUNKWHALE_INSTANCE,
|
||||||
|
|||||||
@@ -288,6 +288,9 @@ withSidebar: true
|
|||||||
{% else %}
|
{% else %}
|
||||||
{{ listening.track }}
|
{{ listening.track }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if listening.favorite %}
|
||||||
|
<span class="text-purple-500 ml-1" title="Favorite">♥</span>
|
||||||
|
{% endif %}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="text-sm text-surface-600 dark:text-surface-400 truncate">{{ listening.artist }}</p>
|
<p class="text-sm text-surface-600 dark:text-surface-400 truncate">{{ listening.artist }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user