refactor: one cover fallback icon on Android, one paged-query type on the web
release / web (push) Successful in 1m19s
release / go (push) Successful in 1m45s
release / govulncheck (push) Successful in 19s
release / integration (push) Successful in 3m56s
release / android (push) Successful in 4m34s
release / Build signed APK (push) Successful in 5m3s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 25s
release / Verify release artifacts (tag releases only) (push) Skipped
release / web (push) Successful in 1m19s
release / go (push) Successful in 1m45s
release / govulncheck (push) Successful in 19s
release / integration (push) Successful in 3m56s
release / android (push) Successful in 4m34s
release / Build signed APK (push) Successful in 5m3s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 25s
release / Verify release artifacts (tag releases only) (push) Skipped
Ten Android covers wrote out the same muted icon for missing artwork; they now call CoverFallbackIcon beside CoverTile, and ShelfPlaylistCards' NoArtIcon wrapper is gone. AlbumDrillDown and AlphaLibrary each declared the infinite-query shape they read; both now take PagedQuery<T> from api/types. Folds the two small copies the M664 DRY close-out found (#8006). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -49,6 +49,7 @@ import com.fabledsword.minstrel.nav.AlbumDetail
|
|||||||
import com.fabledsword.minstrel.nav.ArtistDetail
|
import com.fabledsword.minstrel.nav.ArtistDetail
|
||||||
import com.fabledsword.minstrel.shared.formatDuration
|
import com.fabledsword.minstrel.shared.formatDuration
|
||||||
import com.fabledsword.minstrel.shared.plural
|
import com.fabledsword.minstrel.shared.plural
|
||||||
|
import com.fabledsword.minstrel.shared.widgets.CoverFallbackIcon
|
||||||
import com.fabledsword.minstrel.shared.widgets.CoverTile
|
import com.fabledsword.minstrel.shared.widgets.CoverTile
|
||||||
import com.fabledsword.minstrel.shared.widgets.ShellContentWindowInsets
|
import com.fabledsword.minstrel.shared.widgets.ShellContentWindowInsets
|
||||||
import com.fabledsword.minstrel.shared.widgets.TrackRow
|
import com.fabledsword.minstrel.shared.widgets.TrackRow
|
||||||
@@ -269,14 +270,7 @@ private fun AlbumCover(album: AlbumRef) {
|
|||||||
contentDescription = album.title,
|
contentDescription = album.title,
|
||||||
size = 120.dp,
|
size = 120.dp,
|
||||||
background = MaterialTheme.colorScheme.surfaceVariant,
|
background = MaterialTheme.colorScheme.surfaceVariant,
|
||||||
fallback = {
|
fallback = { CoverFallbackIcon(Lucide.Disc3) },
|
||||||
Icon(
|
|
||||||
imageVector = Lucide.Disc3,
|
|
||||||
contentDescription = null,
|
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
modifier = Modifier.size(56.dp),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import com.fabledsword.minstrel.nav.AlbumDetail
|
|||||||
import com.fabledsword.minstrel.nav.ArtistDetail
|
import com.fabledsword.minstrel.nav.ArtistDetail
|
||||||
import com.fabledsword.minstrel.shared.formatDuration
|
import com.fabledsword.minstrel.shared.formatDuration
|
||||||
import com.fabledsword.minstrel.shared.plural
|
import com.fabledsword.minstrel.shared.plural
|
||||||
|
import com.fabledsword.minstrel.shared.widgets.CoverFallbackIcon
|
||||||
import com.fabledsword.minstrel.shared.widgets.ShellContentWindowInsets
|
import com.fabledsword.minstrel.shared.widgets.ShellContentWindowInsets
|
||||||
import com.fabledsword.minstrel.shared.widgets.ErrorRetry
|
import com.fabledsword.minstrel.shared.widgets.ErrorRetry
|
||||||
import com.fabledsword.minstrel.shared.widgets.HorizontalScrollRow
|
import com.fabledsword.minstrel.shared.widgets.HorizontalScrollRow
|
||||||
@@ -330,14 +331,7 @@ private fun ArtistAvatar(artist: ArtistRef, fallbackAlbumId: String? = null) {
|
|||||||
url = model,
|
url = model,
|
||||||
contentDescription = artist.name,
|
contentDescription = artist.name,
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
) {
|
) { CoverFallbackIcon(Lucide.User, size = 40.dp) }
|
||||||
Icon(
|
|
||||||
imageVector = Lucide.User,
|
|
||||||
contentDescription = null,
|
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
modifier = Modifier.size(40.dp),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ import androidx.compose.ui.unit.Dp
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.composables.icons.lucide.Disc3
|
import com.composables.icons.lucide.Disc3
|
||||||
import com.composables.icons.lucide.Lucide
|
import com.composables.icons.lucide.Lucide
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import com.fabledsword.minstrel.models.AlbumRef
|
import com.fabledsword.minstrel.models.AlbumRef
|
||||||
import com.fabledsword.minstrel.nav.LocalDetailSeedCache
|
import com.fabledsword.minstrel.nav.LocalDetailSeedCache
|
||||||
|
import com.fabledsword.minstrel.shared.widgets.CoverFallbackIcon
|
||||||
import com.fabledsword.minstrel.shared.widgets.CoverTile
|
import com.fabledsword.minstrel.shared.widgets.CoverTile
|
||||||
import com.fabledsword.minstrel.shared.widgets.PlayCircleButton
|
import com.fabledsword.minstrel.shared.widgets.PlayCircleButton
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
@@ -63,14 +63,7 @@ fun AlbumCard(
|
|||||||
contentDescription = album.title,
|
contentDescription = album.title,
|
||||||
size = artSize,
|
size = artSize,
|
||||||
background = MaterialTheme.colorScheme.surfaceVariant,
|
background = MaterialTheme.colorScheme.surfaceVariant,
|
||||||
fallback = {
|
fallback = { CoverFallbackIcon(Lucide.Disc3) },
|
||||||
Icon(
|
|
||||||
imageVector = Lucide.Disc3,
|
|
||||||
contentDescription = null,
|
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
modifier = Modifier.size(56.dp),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
overlay = {
|
overlay = {
|
||||||
if (onPlay != null) {
|
if (onPlay != null) {
|
||||||
PlayCircleButton(
|
PlayCircleButton(
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.padding
|
|||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
@@ -24,6 +23,7 @@ import com.composables.icons.lucide.Lucide
|
|||||||
import com.composables.icons.lucide.User
|
import com.composables.icons.lucide.User
|
||||||
import com.fabledsword.minstrel.models.ArtistRef
|
import com.fabledsword.minstrel.models.ArtistRef
|
||||||
import com.fabledsword.minstrel.nav.LocalDetailSeedCache
|
import com.fabledsword.minstrel.nav.LocalDetailSeedCache
|
||||||
|
import com.fabledsword.minstrel.shared.widgets.CoverFallbackIcon
|
||||||
import com.fabledsword.minstrel.shared.widgets.CoverTile
|
import com.fabledsword.minstrel.shared.widgets.CoverTile
|
||||||
import com.fabledsword.minstrel.shared.widgets.PlayCircleButton
|
import com.fabledsword.minstrel.shared.widgets.PlayCircleButton
|
||||||
|
|
||||||
@@ -67,14 +67,7 @@ fun ArtistCard(
|
|||||||
contentDescription = artist.name,
|
contentDescription = artist.name,
|
||||||
size = artSize,
|
size = artSize,
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
fallback = {
|
fallback = { CoverFallbackIcon(Lucide.User) },
|
||||||
Icon(
|
|
||||||
imageVector = Lucide.User,
|
|
||||||
contentDescription = null,
|
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
modifier = Modifier.size(56.dp),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
overlay = {
|
overlay = {
|
||||||
if (onPlay != null) {
|
if (onPlay != null) {
|
||||||
PlayCircleButton(
|
PlayCircleButton(
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import androidx.compose.foundation.layout.padding
|
|||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
@@ -36,6 +35,7 @@ import com.composables.icons.lucide.Music
|
|||||||
import com.composables.icons.lucide.SkipBack
|
import com.composables.icons.lucide.SkipBack
|
||||||
import com.composables.icons.lucide.SkipForward
|
import com.composables.icons.lucide.SkipForward
|
||||||
import com.fabledsword.minstrel.models.TrackRef
|
import com.fabledsword.minstrel.models.TrackRef
|
||||||
|
import com.fabledsword.minstrel.shared.widgets.CoverFallbackIcon
|
||||||
import com.fabledsword.minstrel.shared.widgets.LikeButton
|
import com.fabledsword.minstrel.shared.widgets.LikeButton
|
||||||
import com.fabledsword.minstrel.shared.widgets.ServerImage
|
import com.fabledsword.minstrel.shared.widgets.ServerImage
|
||||||
import com.fabledsword.minstrel.shared.widgets.trackactions.TrackActionsViewModel
|
import com.fabledsword.minstrel.shared.widgets.trackactions.TrackActionsViewModel
|
||||||
@@ -67,13 +67,7 @@ private fun MiniCover(coverUrl: String, contentDescription: String) {
|
|||||||
url = url,
|
url = url,
|
||||||
contentDescription = contentDescription,
|
contentDescription = contentDescription,
|
||||||
modifier = Modifier.size(COVER_SIZE_DP.dp),
|
modifier = Modifier.size(COVER_SIZE_DP.dp),
|
||||||
) {
|
) { CoverFallbackIcon(Lucide.Music, size = 24.dp) }
|
||||||
Icon(
|
|
||||||
imageVector = Lucide.Music,
|
|
||||||
contentDescription = null,
|
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ import com.fabledsword.minstrel.player.output.OutputPickerSheet
|
|||||||
import com.fabledsword.minstrel.player.output.OutputPickerViewModel
|
import com.fabledsword.minstrel.player.output.OutputPickerViewModel
|
||||||
import com.fabledsword.minstrel.player.output.OutputRoute
|
import com.fabledsword.minstrel.player.output.OutputRoute
|
||||||
import com.fabledsword.minstrel.player.output.RouteSnapshot
|
import com.fabledsword.minstrel.player.output.RouteSnapshot
|
||||||
|
import com.fabledsword.minstrel.shared.widgets.CoverFallbackIcon
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import com.fabledsword.minstrel.nav.AlbumDetail
|
import com.fabledsword.minstrel.nav.AlbumDetail
|
||||||
import com.fabledsword.minstrel.nav.ArtistDetail
|
import com.fabledsword.minstrel.nav.ArtistDetail
|
||||||
@@ -547,14 +548,7 @@ private fun NowPlayingCover(coverUrl: String, contentDescription: String) {
|
|||||||
url = coverUrl,
|
url = coverUrl,
|
||||||
contentDescription = contentDescription,
|
contentDescription = contentDescription,
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
) {
|
) { CoverFallbackIcon(Lucide.Music, size = 96.dp) }
|
||||||
Icon(
|
|
||||||
imageVector = Lucide.Music,
|
|
||||||
contentDescription = null,
|
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
modifier = Modifier.size(96.dp),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-8
@@ -86,6 +86,7 @@ import com.fabledsword.minstrel.playlists.data.withoutEntry
|
|||||||
import com.fabledsword.minstrel.shared.formatDuration
|
import com.fabledsword.minstrel.shared.formatDuration
|
||||||
import com.fabledsword.minstrel.shared.plural
|
import com.fabledsword.minstrel.shared.plural
|
||||||
import com.fabledsword.minstrel.shared.widgets.ConfirmDestructiveDialog
|
import com.fabledsword.minstrel.shared.widgets.ConfirmDestructiveDialog
|
||||||
|
import com.fabledsword.minstrel.shared.widgets.CoverFallbackIcon
|
||||||
import com.fabledsword.minstrel.shared.widgets.CoverTile
|
import com.fabledsword.minstrel.shared.widgets.CoverTile
|
||||||
import com.fabledsword.minstrel.shared.widgets.NameDialog
|
import com.fabledsword.minstrel.shared.widgets.NameDialog
|
||||||
import com.fabledsword.minstrel.shared.widgets.ReorderHandles
|
import com.fabledsword.minstrel.shared.widgets.ReorderHandles
|
||||||
@@ -679,14 +680,7 @@ private fun PlaylistCover(playlist: PlaylistRef) {
|
|||||||
contentDescription = playlist.name,
|
contentDescription = playlist.name,
|
||||||
size = 120.dp,
|
size = 120.dp,
|
||||||
background = MaterialTheme.colorScheme.surfaceVariant,
|
background = MaterialTheme.colorScheme.surfaceVariant,
|
||||||
fallback = {
|
fallback = { CoverFallbackIcon(Lucide.ListMusic) },
|
||||||
Icon(
|
|
||||||
imageVector = Lucide.ListMusic,
|
|
||||||
contentDescription = null,
|
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
modifier = Modifier.size(56.dp),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-9
@@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.padding
|
|||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
@@ -24,6 +23,7 @@ import com.composables.icons.lucide.Lucide
|
|||||||
import com.fabledsword.minstrel.models.PlaylistRef
|
import com.fabledsword.minstrel.models.PlaylistRef
|
||||||
import com.fabledsword.minstrel.nav.LocalDetailSeedCache
|
import com.fabledsword.minstrel.nav.LocalDetailSeedCache
|
||||||
import com.fabledsword.minstrel.shared.plural
|
import com.fabledsword.minstrel.shared.plural
|
||||||
|
import com.fabledsword.minstrel.shared.widgets.CoverFallbackIcon
|
||||||
import com.fabledsword.minstrel.shared.widgets.CoverTile
|
import com.fabledsword.minstrel.shared.widgets.CoverTile
|
||||||
import com.fabledsword.minstrel.shared.widgets.PlayCircleButton
|
import com.fabledsword.minstrel.shared.widgets.PlayCircleButton
|
||||||
import com.fabledsword.minstrel.theme.FabledSwordFlatTokens
|
import com.fabledsword.minstrel.theme.FabledSwordFlatTokens
|
||||||
@@ -106,14 +106,7 @@ private fun PlaylistCardCover(
|
|||||||
url = playlist.coverUrl,
|
url = playlist.coverUrl,
|
||||||
contentDescription = playlist.name,
|
contentDescription = playlist.name,
|
||||||
size = 144.dp,
|
size = 144.dp,
|
||||||
fallback = {
|
fallback = { CoverFallbackIcon(Lucide.ListMusic) },
|
||||||
Icon(
|
|
||||||
imageVector = Lucide.ListMusic,
|
|
||||||
contentDescription = null,
|
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
modifier = Modifier.size(56.dp),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
overlay = {
|
overlay = {
|
||||||
if (playlist.isSystem) {
|
if (playlist.isSystem) {
|
||||||
VariantPill(
|
VariantPill(
|
||||||
|
|||||||
+4
-13
@@ -16,7 +16,6 @@ import androidx.compose.foundation.layout.width
|
|||||||
import androidx.compose.foundation.layout.widthIn
|
import androidx.compose.foundation.layout.widthIn
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -46,6 +45,7 @@ import com.fabledsword.minstrel.playlists.Rgb
|
|||||||
import com.fabledsword.minstrel.playlists.songsLikeArtist
|
import com.fabledsword.minstrel.playlists.songsLikeArtist
|
||||||
import com.fabledsword.minstrel.playlists.washTone
|
import com.fabledsword.minstrel.playlists.washTone
|
||||||
import com.fabledsword.minstrel.shared.plural
|
import com.fabledsword.minstrel.shared.plural
|
||||||
|
import com.fabledsword.minstrel.shared.widgets.CoverFallbackIcon
|
||||||
import com.fabledsword.minstrel.shared.widgets.CoverTile
|
import com.fabledsword.minstrel.shared.widgets.CoverTile
|
||||||
import com.fabledsword.minstrel.shared.widgets.PlayCircleButton
|
import com.fabledsword.minstrel.shared.widgets.PlayCircleButton
|
||||||
import com.fabledsword.minstrel.shared.widgets.ServerImage
|
import com.fabledsword.minstrel.shared.widgets.ServerImage
|
||||||
@@ -145,7 +145,7 @@ fun SongsLikeCard(
|
|||||||
size = ROUND_SIZE,
|
size = ROUND_SIZE,
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
background = MaterialTheme.colorScheme.surfaceVariant,
|
background = MaterialTheme.colorScheme.surfaceVariant,
|
||||||
fallback = { NoArtIcon() },
|
fallback = { CoverFallbackIcon(Lucide.ListMusic, size = NO_ART_ICON_SIZE) },
|
||||||
overlay = {
|
overlay = {
|
||||||
PlayCircleButton(
|
PlayCircleButton(
|
||||||
onPlay = onPlay,
|
onPlay = onPlay,
|
||||||
@@ -267,21 +267,11 @@ internal fun LeadArt(url: String?, modifier: Modifier) {
|
|||||||
url = url,
|
url = url,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
fallback = { NoArtIcon() },
|
fallback = { CoverFallbackIcon(Lucide.ListMusic, size = NO_ART_ICON_SIZE) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
|
||||||
internal fun NoArtIcon() {
|
|
||||||
Icon(
|
|
||||||
imageVector = Lucide.ListMusic,
|
|
||||||
contentDescription = null,
|
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
modifier = Modifier.size(40.dp),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun Modifier.stashingClick(playlist: PlaylistRef, onClick: () -> Unit): Modifier {
|
internal fun Modifier.stashingClick(playlist: PlaylistRef, onClick: () -> Unit): Modifier {
|
||||||
val seedCache = LocalDetailSeedCache.current
|
val seedCache = LocalDetailSeedCache.current
|
||||||
@@ -354,6 +344,7 @@ private val ROUND_WIDTH = 136.dp
|
|||||||
private val ROUND_SIZE = 120.dp
|
private val ROUND_SIZE = 120.dp
|
||||||
internal val CARD_RADIUS = 12.dp
|
internal val CARD_RADIUS = 12.dp
|
||||||
private val FAN_COVER = 95.dp
|
private val FAN_COVER = 95.dp
|
||||||
|
private val NO_ART_ICON_SIZE = 40.dp
|
||||||
private val MICRO_LABEL_TRACKING = 0.9.sp
|
private val MICRO_LABEL_TRACKING = 0.9.sp
|
||||||
|
|
||||||
private const val FAN_SPAN = 0.8f
|
private const val FAN_SPAN = 0.8f
|
||||||
|
|||||||
@@ -6,13 +6,17 @@ import androidx.compose.foundation.layout.BoxScope
|
|||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.Shape
|
import androidx.compose.ui.graphics.Shape
|
||||||
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
import com.fabledsword.minstrel.theme.FabledSwordFlatTokens
|
import com.fabledsword.minstrel.theme.FabledSwordFlatTokens
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,3 +67,19 @@ fun CoverTile(
|
|||||||
overlay()
|
overlay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What a cover shows when it has no artwork, or its artwork fails to load:
|
||||||
|
* the kind of thing it is (an album's disc, an artist's figure, a
|
||||||
|
* playlist's list) drawn in the muted on-surface colour. 56dp suits the
|
||||||
|
* library's cards; smaller and larger covers pass their own [size].
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
fun CoverFallbackIcon(icon: ImageVector, size: Dp = 56.dp) {
|
||||||
|
Icon(
|
||||||
|
imageVector = icon,
|
||||||
|
contentDescription = null,
|
||||||
|
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
modifier = Modifier.size(size),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
+1
-9
@@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.Box
|
|||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
@@ -47,14 +46,7 @@ fun TrackCoverThumb(
|
|||||||
url = coverUrl,
|
url = coverUrl,
|
||||||
contentDescription = contentDescription,
|
contentDescription = contentDescription,
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
) {
|
) { CoverFallbackIcon(Lucide.Music, size = size / 2) }
|
||||||
Icon(
|
|
||||||
imageVector = Lucide.Music,
|
|
||||||
contentDescription = null,
|
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
modifier = Modifier.size(size / 2),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,24 @@ export type Page<T> = {
|
|||||||
offset: number;
|
offset: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What a paged list's component reads from a TanStack infinite query of
|
||||||
|
* Pages: the loaded pages, the first page's state, the next page's state,
|
||||||
|
* and the two ways to ask again. Typed structurally so a page can pass its
|
||||||
|
* createInfiniteQuery result straight in.
|
||||||
|
*/
|
||||||
|
export type PagedQuery<T> = {
|
||||||
|
data?: { pages: Page<T>[] };
|
||||||
|
isPending: boolean;
|
||||||
|
isError: boolean;
|
||||||
|
error: unknown;
|
||||||
|
hasNextPage: boolean;
|
||||||
|
isFetchingNextPage: boolean;
|
||||||
|
isFetchNextPageError: boolean;
|
||||||
|
fetchNextPage: () => unknown;
|
||||||
|
refetch: () => unknown;
|
||||||
|
};
|
||||||
|
|
||||||
export type ArtistRef = {
|
export type ArtistRef = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -4,21 +4,11 @@
|
|||||||
import AlbumCard from './AlbumCard.svelte';
|
import AlbumCard from './AlbumCard.svelte';
|
||||||
import EmptyState from './EmptyState.svelte';
|
import EmptyState from './EmptyState.svelte';
|
||||||
import ListContinuation from './ListContinuation.svelte';
|
import ListContinuation from './ListContinuation.svelte';
|
||||||
import type { AlbumRef, Page } from '#lib/api/types.js';
|
import type { AlbumRef, PagedQuery } from '#lib/api/types.js';
|
||||||
|
|
||||||
// One browse axis's albums (a genre, a year): a back link to the axis, the
|
// One browse axis's albums (a genre, a year): a back link to the axis, the
|
||||||
// count, and the paged grid. A failed first page offers Try again; a failed
|
// count, and the paged grid. A failed first page offers Try again; a failed
|
||||||
// later page keeps the grid and offers it at the end.
|
// later page keeps the grid and offers it at the end.
|
||||||
type AlbumPages = {
|
|
||||||
data?: { pages: Page<AlbumRef>[] };
|
|
||||||
isPending: boolean;
|
|
||||||
isError: boolean;
|
|
||||||
hasNextPage: boolean;
|
|
||||||
isFetchingNextPage: boolean;
|
|
||||||
isFetchNextPageError: boolean;
|
|
||||||
fetchNextPage: () => unknown;
|
|
||||||
refetch: () => unknown;
|
|
||||||
};
|
|
||||||
|
|
||||||
let {
|
let {
|
||||||
query,
|
query,
|
||||||
@@ -30,7 +20,7 @@
|
|||||||
emptyHint,
|
emptyHint,
|
||||||
endLabel
|
endLabel
|
||||||
}: {
|
}: {
|
||||||
query: AlbumPages | null;
|
query: PagedQuery<AlbumRef> | null;
|
||||||
backHref: string;
|
backHref: string;
|
||||||
backLabel: string;
|
backLabel: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
|||||||
@@ -8,23 +8,12 @@
|
|||||||
import EmptyState from './EmptyState.svelte';
|
import EmptyState from './EmptyState.svelte';
|
||||||
import { user } from '#lib/auth/user.svelte.js';
|
import { user } from '#lib/auth/user.svelte.js';
|
||||||
import { useDelayed } from '#lib/utils/useDelayed.svelte.js';
|
import { useDelayed } from '#lib/utils/useDelayed.svelte.js';
|
||||||
import type { Page } from '#lib/api/types.js';
|
import type { PagedQuery } from '#lib/api/types.js';
|
||||||
|
|
||||||
// A whole-library A–Z page (Library › Albums, Library › Artists): the
|
// A whole-library A–Z page (Library › Albums, Library › Artists): the
|
||||||
// count, a filter over what has loaded, the lettered grid paged as you
|
// count, a filter over what has loaded, the lettered grid paged as you
|
||||||
// scroll, and the empty states. A filter that matches nothing loaded links
|
// scroll, and the empty states. A filter that matches nothing loaded links
|
||||||
// to the full search, since the rest of the library may not have loaded.
|
// to the full search, since the rest of the library may not have loaded.
|
||||||
type Pages = {
|
|
||||||
data?: { pages: Page<T>[] };
|
|
||||||
isPending: boolean;
|
|
||||||
isError: boolean;
|
|
||||||
error: unknown;
|
|
||||||
hasNextPage: boolean;
|
|
||||||
isFetchingNextPage: boolean;
|
|
||||||
isFetchNextPageError: boolean;
|
|
||||||
fetchNextPage: () => unknown;
|
|
||||||
refetch: () => unknown;
|
|
||||||
};
|
|
||||||
|
|
||||||
let {
|
let {
|
||||||
query,
|
query,
|
||||||
@@ -36,7 +25,7 @@
|
|||||||
searchPath,
|
searchPath,
|
||||||
item
|
item
|
||||||
}: {
|
}: {
|
||||||
query: Pages;
|
query: PagedQuery<T>;
|
||||||
title: string;
|
title: string;
|
||||||
/** The noun for one and for many: 'album', 'albums'. */
|
/** The noun for one and for many: 'album', 'albums'. */
|
||||||
one: string;
|
one: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user