refactor(#82): remove dead SkeletonList/SkeletonCard composables
* ci: prevent concurrency cancellation on rapid main merges The concurrency group used github.ref which is static for main (refs/heads/main). When multiple PRs merged rapidly (~2 min apart), each merge commit cancelled the previous CI run before it could finish. Fix: use github.sha for push events to main (unique per commit) while keeping the ref-based group for PR branches (cancels on new commits to the same PR branch). * refactor(#82): remove dead SkeletonList/SkeletonCard composables --------- Co-authored-by: ronia <ronia@m57> Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
2 files changed
+1
-84
No files matched your search
@@ -1,24 +1,14 @@
|
||||
package com.m57.hermescontrol.ui.common
|
||||
|
||||
import androidx.compose.animation.core.RepeatMode
|
||||
import androidx.compose.animation.core.animateFloat
|
||||
import androidx.compose.animation.core.infiniteRepeatable
|
||||
import androidx.compose.animation.core.rememberInfiniteTransition
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Inbox
|
||||
import androidx.compose.material.icons.filled.Refresh
|
||||
@@ -29,16 +19,12 @@ import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedButton
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
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.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.m57.hermescontrol.theme.LocalSpacing
|
||||
import com.m57.hermescontrol.theme.Motion
|
||||
|
||||
// Unified loading / error / empty / skeleton placeholders so every screen
|
||||
// shares the same visual language.
|
||||
@@ -59,74 +45,6 @@ fun LoadingState(modifier: Modifier = Modifier) {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Skeleton Shimmer ──────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Shimmer placeholder for list-based loading states.
|
||||
* Shows animated placeholder cards while real data loads.
|
||||
*
|
||||
* @param itemCount number of skeleton rows to show
|
||||
*/
|
||||
@Composable
|
||||
fun SkeletonList(
|
||||
itemCount: Int = 6,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val spacing = LocalSpacing.current
|
||||
val infiniteTransition = rememberInfiniteTransition(label = "shimmer")
|
||||
val shimmerAlpha by infiniteTransition.animateFloat(
|
||||
initialValue = 0.3f,
|
||||
targetValue = 0.7f,
|
||||
animationSpec =
|
||||
infiniteRepeatable(
|
||||
animation = tween(Motion.NORMAL * 2),
|
||||
repeatMode = RepeatMode.Reverse,
|
||||
),
|
||||
label = "shimmerAlpha",
|
||||
)
|
||||
val skeletonColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = shimmerAlpha)
|
||||
|
||||
LazyColumn(
|
||||
modifier = modifier.fillMaxSize(),
|
||||
contentPadding = PaddingValues(horizontal = spacing.md, vertical = spacing.sm),
|
||||
verticalArrangement = Arrangement.spacedBy(spacing.sm),
|
||||
) {
|
||||
items(itemCount) {
|
||||
SkeletonCard(skeletonColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SkeletonCard(baseColor: Color) {
|
||||
Column(
|
||||
modifier =
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(12.dp))
|
||||
.background(baseColor)
|
||||
.padding(16.dp),
|
||||
) {
|
||||
Box(
|
||||
modifier =
|
||||
Modifier
|
||||
.width(180.dp)
|
||||
.height(16.dp)
|
||||
.clip(RoundedCornerShape(4.dp))
|
||||
.background(baseColor.copy(alpha = baseColor.alpha + 0.1f)),
|
||||
)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Box(
|
||||
modifier =
|
||||
Modifier
|
||||
.fillMaxWidth(0.7f)
|
||||
.height(12.dp)
|
||||
.clip(RoundedCornerShape(4.dp))
|
||||
.background(baseColor.copy(alpha = baseColor.alpha + 0.05f)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// ── Error ──────────────────────────────────────────────────────────────
|
||||
|
||||
@Composable
|
||||
|
||||
Reference in new issue
Block a user