71 lines
2.3 KiB
Kotlin
71 lines
2.3 KiB
Kotlin
package com.radiola.ui.components
|
|
|
|
import androidx.compose.foundation.background
|
|
import androidx.compose.foundation.clickable
|
|
import androidx.compose.foundation.layout.*
|
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
import androidx.compose.material3.Icon
|
|
import androidx.compose.material3.IconButton
|
|
import androidx.compose.material3.MaterialTheme
|
|
import androidx.compose.material3.Text
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.ui.Alignment
|
|
import androidx.compose.ui.Modifier
|
|
import androidx.compose.ui.draw.clip
|
|
import androidx.compose.ui.graphics.Color
|
|
import androidx.compose.ui.unit.dp
|
|
import coil.compose.AsyncImage
|
|
import com.composables.icons.lucide.Lucide
|
|
import com.composables.icons.lucide.Pause
|
|
import com.composables.icons.lucide.Play
|
|
import com.radiola.domain.model.Track
|
|
|
|
@Composable
|
|
fun MiniPlayer(
|
|
stationName: String,
|
|
track: Track?,
|
|
isPlaying: Boolean,
|
|
onClick: () -> Unit,
|
|
onPlayPause: () -> Unit,
|
|
modifier: Modifier = Modifier
|
|
) {
|
|
Row(
|
|
modifier = modifier
|
|
.fillMaxWidth()
|
|
.height(64.dp)
|
|
.background(Color(0xFF1E1E1E))
|
|
.clickable(onClick = onClick)
|
|
.padding(horizontal = 16.dp),
|
|
verticalAlignment = Alignment.CenterVertically
|
|
) {
|
|
AsyncImage(
|
|
model = track?.coverUrl,
|
|
contentDescription = null,
|
|
modifier = Modifier
|
|
.size(48.dp)
|
|
.clip(RoundedCornerShape(6.dp))
|
|
)
|
|
Spacer(modifier = Modifier.width(12.dp))
|
|
Column(modifier = Modifier.weight(1f)) {
|
|
Text(
|
|
text = stationName,
|
|
style = MaterialTheme.typography.bodyMedium,
|
|
maxLines = 1
|
|
)
|
|
Text(
|
|
text = track?.let { "${it.artist} — ${it.song}" } ?: "",
|
|
style = MaterialTheme.typography.labelMedium,
|
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f),
|
|
maxLines = 1
|
|
)
|
|
}
|
|
IconButton(onClick = onPlayPause) {
|
|
Icon(
|
|
imageVector = if (isPlaying) Lucide.Pause else Lucide.Play,
|
|
contentDescription = if (isPlaying) "Pause" else "Play",
|
|
tint = Color.White
|
|
)
|
|
}
|
|
}
|
|
}
|