diff --git a/frontend/src/components/AlbumInfo.tsx b/frontend/src/components/AlbumInfo.tsx index 5b7cc87..1c03e6f 100644 --- a/frontend/src/components/AlbumInfo.tsx +++ b/frontend/src/components/AlbumInfo.tsx @@ -211,10 +211,10 @@ export function AlbumInfo({ albumInfo, trackList, searchQuery, sortBy, selectedT {clickableAlbumArtists.length > 0 ? clickableAlbumArtists.map((artist, index) => ( {onArtistClick && artist.external_urls ? ( onArtistClick({ - id: artist.id, - name: artist.name, - external_urls: artist.external_urls, - })}> + id: artist.id, + name: artist.name, + external_urls: artist.external_urls, + })}> {artist.name} ) : (artist.name)} {index < clickableAlbumArtists.length - 1 && artistSeparator} @@ -225,8 +225,8 @@ export function AlbumInfo({ albumInfo, trackList, searchQuery, sortBy, selectedT {showStreamingProgress - ? `${fetchedTrackCount.toLocaleString()} / ${totalTrackCount.toLocaleString()} tracks` - : `${Math.max(totalTrackCount, fetchedTrackCount).toLocaleString()} ${Math.max(totalTrackCount, fetchedTrackCount) === 1 ? "track" : "tracks"}`} + ? `${fetchedTrackCount.toLocaleString()} / ${totalTrackCount.toLocaleString()} tracks` + : `${Math.max(totalTrackCount, fetchedTrackCount).toLocaleString()} ${Math.max(totalTrackCount, fetchedTrackCount) === 1 ? "track" : "tracks"}`} diff --git a/frontend/src/components/AvailabilityLinks.tsx b/frontend/src/components/AvailabilityLinks.tsx index 7cfad6d..58791d9 100644 --- a/frontend/src/components/AvailabilityLinks.tsx +++ b/frontend/src/components/AvailabilityLinks.tsx @@ -2,19 +2,16 @@ import type { ReactNode } from "react"; import type { TrackAvailability } from "@/types/api"; import { openExternal } from "@/lib/utils"; import { AmazonAvailabilityIcon, QobuzAvailabilityIcon, TidalAvailabilityIcon } from "./PlatformIcons"; - interface AvailabilityLinkEntry { id: string; found: boolean; url?: string; icon: ReactNode; } - function getAvailabilityLinkEntries(availability: TrackAvailability): AvailabilityLinkEntry[] { const tidalUrl = availability.tidal_url?.trim() || ""; const qobuzUrl = availability.qobuz_url?.trim() || ""; const amazonUrl = availability.amazon_url?.trim() || ""; - return [ { id: "tidal", @@ -36,48 +33,30 @@ function getAvailabilityLinkEntries(availability: TrackAvailability): Availabili }, ]; } - export function hasAvailabilityLinks(availability?: TrackAvailability): boolean { if (!availability) { return false; } return getAvailabilityLinkEntries(availability).some((entry) => entry.found); } - export function AvailabilityLinks({ availability }: { availability?: TrackAvailability; }) { if (!availability) { return

Check Availability

; } - const entries = getAvailabilityLinkEntries(availability); - return ( -
- {entries.map((entry) => entry.found ? ( - - ) : ( -
+ ) : (
{entry.icon} Not Found -
- ))} -
- ); +
))} + ); } diff --git a/frontend/src/components/PlaylistInfo.tsx b/frontend/src/components/PlaylistInfo.tsx index 02ce2c0..bf5f3ef 100644 --- a/frontend/src/components/PlaylistInfo.tsx +++ b/frontend/src/components/PlaylistInfo.tsx @@ -188,8 +188,8 @@ export function PlaylistInfo({ playlistInfo, trackList, searchQuery, sortBy, sel {showStreamingProgress - ? `${fetchedTrackCount.toLocaleString()} / ${totalTrackCount.toLocaleString()} tracks` - : `${Math.max(totalTrackCount, fetchedTrackCount).toLocaleString()} ${Math.max(totalTrackCount, fetchedTrackCount) === 1 ? "track" : "tracks"}`} + ? `${fetchedTrackCount.toLocaleString()} / ${totalTrackCount.toLocaleString()} tracks` + : `${Math.max(totalTrackCount, fetchedTrackCount).toLocaleString()} ${Math.max(totalTrackCount, fetchedTrackCount) === 1 ? "track" : "tracks"}`} {playlistInfo.followers.total.toLocaleString()} {playlistInfo.followers.total === 1 ? "follower" : "followers"} diff --git a/frontend/src/components/TitleBar.tsx b/frontend/src/components/TitleBar.tsx index f455897..a238eed 100644 --- a/frontend/src/components/TitleBar.tsx +++ b/frontend/src/components/TitleBar.tsx @@ -5,7 +5,6 @@ import { fetchCurrentIPInfo } from "@/lib/api"; import type { CurrentIPInfo } from "@/types/api"; import { openExternal } from "@/lib/utils"; import { useEffect, useRef, useState } from "react"; - const IP_INFO_REFRESH_INTERVAL_MS = 30000; const SPOTIFY_BLOCKED_COUNTRY_CODES = new Set([ "AF", @@ -25,7 +24,6 @@ const SPOTIFY_BLOCKED_COUNTRY_CODES = new Set([ "TM", "YE", ]); - export function TitleBar() { const [currentIPInfo, setCurrentIPInfo] = useState(null); const [isLoadingCurrentIPInfo, setIsLoadingCurrentIPInfo] = useState(false); @@ -117,12 +115,12 @@ export function TitleBar() { {detectedFlagPath ? ({detectedCountryCode}) : ()} {isLoadingCurrentIPInfo - ? "Detecting..." - : currentIPInfo - ? showIPAddress - ? `${currentIPInfo.ip} - ${currentIPInfo.country}${detectedCountryCode ? ` (${detectedCountryCode})` : ""}` - : `${currentIPInfo.country}${detectedCountryCode ? ` (${detectedCountryCode})` : ""}` - : "Unavailable"} + ? "Detecting..." + : currentIPInfo + ? showIPAddress + ? `${currentIPInfo.ip} - ${currentIPInfo.country}${detectedCountryCode ? ` (${detectedCountryCode})` : ""}` + : `${currentIPInfo.country}${detectedCountryCode ? ` (${detectedCountryCode})` : ""}` + : "Unavailable"} {currentIPInfo && !isLoadingCurrentIPInfo && (