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 {
|
||||
nowPlaying: nowPlaying || null,
|
||||
listenings: listenings?.listenings || [],
|
||||
listenings: enrichedListenings,
|
||||
favorites: favorites?.favorites || [],
|
||||
stats: formattedStats,
|
||||
instanceUrl: FUNKWHALE_INSTANCE,
|
||||
|
||||
@@ -288,6 +288,9 @@ withSidebar: true
|
||||
{% else %}
|
||||
{{ listening.track }}
|
||||
{% endif %}
|
||||
{% if listening.favorite %}
|
||||
<span class="text-purple-500 ml-1" title="Favorite">♥</span>
|
||||
{% endif %}
|
||||
</h3>
|
||||
<p class="text-sm text-surface-600 dark:text-surface-400 truncate">{{ listening.artist }}</p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user