Skip to content

Commit

Permalink
Fixes zapraiser progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorpamplona committed Oct 17, 2024
1 parent c0ba6f5 commit cff6ee4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
Expand Down Expand Up @@ -81,6 +80,7 @@ import androidx.compose.ui.Alignment.Companion.CenterStart
import androidx.compose.ui.Alignment.Companion.CenterVertically
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.semantics.Role
Expand Down Expand Up @@ -116,10 +116,11 @@ import com.vitorpamplona.amethyst.ui.note.types.RenderReaction
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
import com.vitorpamplona.amethyst.ui.stringRes
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
import com.vitorpamplona.amethyst.ui.theme.DarkerGreen
import com.vitorpamplona.amethyst.ui.theme.Font14SP
import com.vitorpamplona.amethyst.ui.theme.HalfDoubleVertSpacer
import com.vitorpamplona.amethyst.ui.theme.HalfPadding
import com.vitorpamplona.amethyst.ui.theme.Height24dpFilledModifier
import com.vitorpamplona.amethyst.ui.theme.Height4dpFilledModifier
import com.vitorpamplona.amethyst.ui.theme.ModifierWidth3dp
import com.vitorpamplona.amethyst.ui.theme.NoSoTinyBorders
import com.vitorpamplona.amethyst.ui.theme.ReactionRowExpandButton
Expand All @@ -141,7 +142,7 @@ import com.vitorpamplona.amethyst.ui.theme.TinyBorders
import com.vitorpamplona.amethyst.ui.theme.defaultTweenDuration
import com.vitorpamplona.amethyst.ui.theme.defaultTweenFloatSpec
import com.vitorpamplona.amethyst.ui.theme.defaultTweenIntOffsetSpec
import com.vitorpamplona.amethyst.ui.theme.mediumImportanceLink
import com.vitorpamplona.amethyst.ui.theme.fundraiserProgressColor
import com.vitorpamplona.amethyst.ui.theme.placeholderText
import com.vitorpamplona.amethyst.ui.theme.reactionBox
import com.vitorpamplona.amethyst.ui.theme.ripple24dp
Expand Down Expand Up @@ -348,22 +349,13 @@ fun RenderZapRaiser(
}
}

val color =
if (zapraiserStatus.progress > 0.99) {
DarkerGreen
} else {
MaterialTheme.colorScheme.mediumImportanceLink
}

LinearProgressIndicator(
modifier =
remember(details) {
Modifier
.fillMaxWidth()
.height(if (details) 24.dp else 4.dp)
},
color = color,
modifier = if (details) Height24dpFilledModifier else Height4dpFilledModifier,
color = MaterialTheme.colorScheme.fundraiserProgressColor,
progress = { zapraiserStatus.progress },
gapSize = 0.dp,
strokeCap = StrokeCap.Square,
drawStopIndicator = {},
)

if (details) {
Expand All @@ -380,7 +372,7 @@ fun RenderZapRaiser(
text =
stringRes(id = R.string.sats_to_complete, totalPercentage, zapraiserStatus.left),
modifier = NoSoTinyBorders,
color = MaterialTheme.colorScheme.placeholderText,
// color = MaterialTheme.colorScheme.placeholderText,
fontSize = Font14SP,
maxLines = 1,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@ val DarkWarningColor = Color(0xFFF8DE22)

val LightAllGoodColor = Color(0xFF339900)
val DarkAllGoodColor = Color(0xFF99cc33)

val LightFundraiserProgressColor = Color(0xFF3DB601)
val DarkFundraiserProgressColor = Color(0xFF61A229)
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ val UserNameMaxRowHeight = Modifier.fillMaxWidth()
val Height24dpModifier = Modifier.height(24.dp)
val Height4dpModifier = Modifier.height(4.dp)

val Height24dpFilledModifier = Modifier.fillMaxWidth().height(24.dp)
val Height4dpFilledModifier = Modifier.fillMaxWidth().height(4.dp)

val AccountPictureModifier = Modifier.size(55.dp).clip(shape = CircleShape)
val HeaderPictureModifier = Modifier.size(34.dp).clip(shape = CircleShape)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,9 @@ val ColorScheme.warningColor: Color
val ColorScheme.allGoodColor: Color
get() = if (isLight) LightAllGoodColor else DarkAllGoodColor

val ColorScheme.fundraiserProgressColor: Color
get() = if (isLight) LightFundraiserProgressColor else DarkFundraiserProgressColor

val ColorScheme.markdownStyle: RichTextStyle
get() = if (isLight) MarkDownStyleOnLight else MarkDownStyleOnDark

Expand Down

0 comments on commit cff6ee4

Please sign in to comment.