Add AllInColorToken to provide colors instead of AllInTheme
continuous-integration/drone/push Build is passing Details

pull/5/head
avalin 9 months ago
parent 9bf19b70a2
commit fda26944d3

@ -7,7 +7,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.data.model.bet.BetStatus
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.theme.AllInColorToken
@StringRes
fun BetStatus.getTitleId(): Int {
@ -39,20 +39,20 @@ fun BetStatus.getDateEndLabelId(): Int {
@Composable
fun BetStatus.getColor(): Color {
return when (this) {
BetStatus.FINISHED -> AllInTheme.colors.allInBetFinish
BetStatus.IN_PROGRESS -> AllInTheme.colors.allInBetInProgress
BetStatus.WAITING -> AllInTheme.colors.allInBetWaiting
else -> AllInTheme.colors.allInBetFinish // TODO
BetStatus.FINISHED -> AllInColorToken.allInBetFinish
BetStatus.IN_PROGRESS -> AllInColorToken.allInBetInProgress
BetStatus.WAITING -> AllInColorToken.allInBetWaiting
else -> AllInColorToken.allInBetFinish // TODO
}
}
@Composable
fun BetStatus.getTextColor(): Color {
return when (this) {
BetStatus.FINISHED -> AllInTheme.colors.allInBetFinishText
BetStatus.IN_PROGRESS -> AllInTheme.colors.allInBetInProgressText
BetStatus.WAITING -> AllInTheme.colors.allInBetWaitingText
else -> AllInTheme.colors.allInBetFinishText // TODO
BetStatus.FINISHED -> AllInColorToken.allInBetFinishText
BetStatus.IN_PROGRESS -> AllInColorToken.allInBetInProgressText
BetStatus.WAITING -> AllInColorToken.allInBetWaitingText
else -> AllInColorToken.allInBetFinishText // TODO
}
}
@ -70,8 +70,8 @@ fun BetStatus.getBetHistoryPhrase(won: Boolean): Int {
fun BetStatus.getBetHistoryStatusColor(won: Boolean): Brush {
return when (this) {
BetStatus.FINISHED ->
if (won) AllInTheme.colors.allInMainGradient else AllInTheme.colors.allInDarkGradient
if (won) AllInColorToken.allInMainGradient else AllInColorToken.allInDarkGradient
else -> SolidColor(AllInTheme.colors.allInDarkGrey100)
else -> SolidColor(AllInColorToken.allInDarkGrey100)
}
}

@ -2,91 +2,12 @@ package fr.iut.alldev.allin.theme
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
@Immutable
data class AllInColors(
val allInDark: Color,
val allInDarkGrey300: Color,
val allInDarkGrey200: Color,
val allInDarkGrey100: Color,
val allInDarkGrey50: Color,
val allInGrey: Color,
val allInLightGrey300: Color,
val allInLightGrey200: Color,
val allInLightGrey100: Color,
val allInLightGrey50: Color,
val allInWhite: Color,
val white: Color,
val black: Color,
val allInPink: Color,
val allInMint: Color,
val allInPurple: Color,
val allInLoginPurple: Color,
val allInBlue: Color,
val allInDarkBlue: Color,
val allInBarPurple: Color,
val allInBarPink: Color,
val allInBarViolet: Color,
val allInBetFinish: Color,
val allInBetInProgress: Color,
val allInBetWaiting: Color,
val allInBetFinishText: Color,
val allInBetInProgressText: Color,
val allInBetWaitingText: Color,
val allInMainGradient: Brush,
val allInMainGradientReverse: Brush,
val allInBar1stGradient: Brush,
val allInBar2ndGradient: Brush,
val allInTextGradient: Brush,
val allInLoginGradient: Brush,
val allInDarkGradient: Brush,
)
internal val LocalColors = staticCompositionLocalOf {
AllInColors(
allInDark = Color.Unspecified,
allInDarkGrey300 = Color.Unspecified,
allInDarkGrey200 = Color.Unspecified,
allInDarkGrey100 = Color.Unspecified,
allInDarkGrey50 = Color.Unspecified,
allInGrey = Color.Unspecified,
allInLightGrey300 = Color.Unspecified,
allInLightGrey200 = Color.Unspecified,
allInLightGrey100 = Color.Unspecified,
allInLightGrey50 = Color.Unspecified,
allInWhite = Color.Unspecified,
white = Color.Unspecified,
black = Color.Unspecified,
allInPink = Color.Unspecified,
allInPurple = Color.Unspecified,
allInLoginPurple = Color.Unspecified,
allInBarPurple = Color.Unspecified,
allInBarPink = Color.Unspecified,
allInBarViolet = Color.Unspecified,
allInBlue = Color.Unspecified,
allInMint = Color.Unspecified,
allInDarkBlue = Color.Unspecified,
allInBetFinish = Color.Unspecified,
allInBetInProgress = Color.Unspecified,
allInBetWaiting = Color.Unspecified,
allInBetFinishText = Color.Unspecified,
allInBetInProgressText = Color.Unspecified,
allInBetWaitingText = Color.Unspecified,
allInMainGradient = SolidColor(Color.Unspecified),
allInMainGradientReverse = SolidColor(Color.Unspecified),
allInBar1stGradient = SolidColor(Color.Unspecified),
allInBar2ndGradient = SolidColor(Color.Unspecified),
allInTextGradient = SolidColor(Color.Unspecified),
allInLoginGradient = SolidColor(Color.Unspecified),
allInDarkGradient = SolidColor(Color.Unspecified)
)
}
@Immutable
data class AllInThemeColors(
val mainSurface: Color,
val onMainSurface: Color,
val background: Color,
@ -99,8 +20,8 @@ data class AllInThemeColors(
val disabledBorder: Color,
)
internal val LocalThemeColors = staticCompositionLocalOf {
AllInThemeColors(
internal val LocalColors = staticCompositionLocalOf {
AllInColors(
mainSurface = Color.Unspecified,
onMainSurface = Color.Unspecified,
background = Color.Unspecified,
@ -112,4 +33,76 @@ internal val LocalThemeColors = staticCompositionLocalOf {
disabled = Color.Unspecified,
disabledBorder = Color.Unspecified
)
}
internal object AllInColorToken {
val black = Color(0xFF000000)
val allInDark = Color(0xFF2A2A2A)
val allInDarkGrey300 = Color(0xFF1c1c1c)
val allInDarkGrey200 = Color(0xFF262626)
val allInDarkGrey100 = Color(0xFF393939)
val allInDarkGrey50 = Color(0xFF454545)
val allInGrey = Color(0xFF525252)
val allInLightGrey300 = Color(0XFFAAAAAA)
val allInLightGrey200 = Color(0XFFC5C5C5)
val allInLightGrey100 = Color(0XFFEBEBEB)
val allInLightGrey50 = Color(0XFFF7F7F7)
val allInWhite = Color(0xFFEBEBF6)
val white = Color(0xFFFFFFFF)
val allInDarkBlue = Color(0xFF323078)
val allInBlue = Color(0xFF6a89fa)
val allInPurple = Color(0xFF7D79FF)
val allInLoginPurple = Color(0xFF7F7BFB)
val allInBarPurple = Color(0xFF846AC9)
val allInPink = Color(0xFFFF2A89)
val allInBarPink = Color(0xFFFE2B8A)
val allInBarViolet = Color(0xFFC249A8)
val allInMint = Color(0xFFC4DEE9)
val allInBetFinish = Color(0xFF353535)
val allInBetInProgress = Color(0xFF604BDB)
val allInBetWaiting = Color(0xFFDF3B9A)
val allInBetFinishText = Color(0xFFA7A7A7)
val allInBetInProgressText = Color(0xFF4636A3)
val allInBetWaitingText = Color(0xFF852E6C)
val allInMainGradient = Brush.linearGradient(
0.0f to Color(0xFFf951a8),
0.5f to Color(0xFFaa7ef3),
1.0f to Color(0xFF199fee),
start = Offset(0f, Float.POSITIVE_INFINITY),
end = Offset(Float.POSITIVE_INFINITY, 0f)
)
val allInMainGradientReverse = Brush.linearGradient(
0.0f to Color(0xFF199fee),
0.5f to Color(0xFFaa7ef3),
1.0f to Color(0xFFf951a8),
start = Offset(0f, Float.POSITIVE_INFINITY),
end = Offset(Float.POSITIVE_INFINITY, 0f)
)
val allInBar1stGradient = Brush.horizontalGradient(
0.0f to Color(0xFF2599F8),
1.0f to Color(0xFF846AC9)
)
val allInBar2ndGradient = Brush.horizontalGradient(
0.0f to Color(0xFFFE2B8A),
1.0f to Color(0xFFC249A8)
)
val allInTextGradient = Brush.horizontalGradient(
0.0f to Color(0xFFF876C1),
1.0f to Color(0xFF2399F8)
)
val allInLoginGradient = Brush.linearGradient(
0.0f to Color(0xFFEC1794),
0.5f to Color(0xFFaa7ef3),
1.0f to Color(0xFF00EEEE),
start = Offset(0f, Float.POSITIVE_INFINITY),
end = Offset(Float.POSITIVE_INFINITY, 0f)
)
val allInDarkGradient = Brush.horizontalGradient(
0.0f to Color(0xFF595959),
1.0f to Color(0xFF000000)
)
}

@ -6,8 +6,6 @@ import androidx.compose.material.ripple.RippleTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle
@ -19,75 +17,6 @@ import fr.iut.alldev.allin.R
fun AllInTheme(
content: @Composable () -> Unit,
) {
val customColors = AllInColors(
allInDark = Color(0xFF2A2A2A),
allInDarkGrey300 = Color(0xFF1c1c1c),
allInDarkGrey200 = Color(0xFF262626),
allInDarkGrey100 = Color(0xFF393939),
allInDarkGrey50 = Color(0xFF454545),
allInGrey = Color(0xFF525252),
allInLightGrey300 = Color(0XFFAAAAAA),
allInLightGrey200 = Color(0XFFC5C5C5),
allInLightGrey100 = Color(0XFFEBEBEB),
allInLightGrey50 = Color(0XFFF7F7F7),
allInWhite = Color(0xFFEBEBF6),
white = Color(0xFFFFFFFF),
black = Color(0xFF000000),
allInPink = Color(0xFFFF2A89),
allInPurple = Color(0xFF7D79FF),
allInLoginPurple = Color(0xFF7F7BFB),
allInBarPurple = Color(0xFF846AC9),
allInBarPink = Color(0xFFFE2B8A),
allInBarViolet = Color(0xFFC249A8),
allInBlue = Color(0xFF6a89fa),
allInMint = Color(0xFFC4DEE9),
allInDarkBlue = Color(0xFF323078),
allInBetFinish = Color(0xFF353535),
allInBetInProgress = Color(0xFF604BDB),
allInBetWaiting = Color(0xFFDF3B9A),
allInBetFinishText = Color(0xFFA7A7A7),
allInBetInProgressText = Color(0xFF4636A3),
allInBetWaitingText = Color(0xFF852E6C),
allInMainGradient = Brush.linearGradient(
0.0f to Color(0xFFf951a8),
0.5f to Color(0xFFaa7ef3),
1.0f to Color(0xFF199fee),
start = Offset(0f, Float.POSITIVE_INFINITY),
end = Offset(Float.POSITIVE_INFINITY, 0f)
),
allInMainGradientReverse = Brush.linearGradient(
0.0f to Color(0xFF199fee),
0.5f to Color(0xFFaa7ef3),
1.0f to Color(0xFFf951a8),
start = Offset(0f, Float.POSITIVE_INFINITY),
end = Offset(Float.POSITIVE_INFINITY, 0f)
),
allInBar1stGradient = Brush.horizontalGradient(
0.0f to Color(0xFF2599F8),
1.0f to Color(0xFF846AC9)
),
allInBar2ndGradient = Brush.horizontalGradient(
0.0f to Color(0xFFFE2B8A),
1.0f to Color(0xFFC249A8)
),
allInTextGradient = Brush.horizontalGradient(
0.0f to Color(0xFFF876C1),
1.0f to Color(0xFF2399F8)
),
allInLoginGradient = Brush.linearGradient(
0.0f to Color(0xFFEC1794),
0.5f to Color(0xFFaa7ef3),
1.0f to Color(0xFF00EEEE),
start = Offset(0f, Float.POSITIVE_INFINITY),
end = Offset(Float.POSITIVE_INFINITY, 0f)
),
allInDarkGradient = Brush.horizontalGradient(
0.0f to Color(0xFF595959),
1.0f to Color(0xFF000000)
)
)
val customTypography = AllInTypography(
h1 = TextStyle(
fontFamily = fontFamilyPlusJakartaSans,
@ -120,30 +49,30 @@ fun AllInTheme(
)
val customTheme = if (isSystemInDarkTheme()) {
AllInThemeColors(
mainSurface = customColors.allInDarkGrey300,
onMainSurface = customColors.allInWhite,
background = customColors.allInDarkGrey200,
onBackground = customColors.white,
tint1 = customColors.white,
background2 = customColors.allInDark,
onBackground2 = customColors.allInLightGrey200,
border = customColors.allInDarkGrey100,
disabled = customColors.allInDarkGrey200,
disabledBorder = customColors.allInDarkGrey100
AllInColors(
mainSurface = AllInColorToken.allInDarkGrey300,
onMainSurface = AllInColorToken.allInWhite,
background = AllInColorToken.allInDarkGrey200,
onBackground = AllInColorToken.white,
tint1 = AllInColorToken.white,
background2 = AllInColorToken.allInDark,
onBackground2 = AllInColorToken.allInLightGrey200,
border = AllInColorToken.allInDarkGrey100,
disabled = AllInColorToken.allInDarkGrey200,
disabledBorder = AllInColorToken.allInDarkGrey100
)
} else {
AllInThemeColors(
mainSurface = customColors.allInWhite,
onMainSurface = customColors.allInDark,
background = customColors.white,
onBackground = customColors.allInDarkBlue,
tint1 = customColors.allInLoginPurple,
background2 = customColors.allInLightGrey50,
onBackground2 = customColors.allInLightGrey300,
border = customColors.allInLightGrey100,
disabled = customColors.allInLightGrey100,
disabledBorder = customColors.allInLightGrey200
AllInColors(
mainSurface = AllInColorToken.allInWhite,
onMainSurface = AllInColorToken.allInDark,
background = AllInColorToken.white,
onBackground = AllInColorToken.allInDarkBlue,
tint1 = AllInColorToken.allInLoginPurple,
background2 = AllInColorToken.allInLightGrey50,
onBackground2 = AllInColorToken.allInLightGrey300,
border = AllInColorToken.allInLightGrey100,
disabled = AllInColorToken.allInLightGrey100,
disabledBorder = AllInColorToken.allInLightGrey200
)
}
@ -154,21 +83,15 @@ fun AllInTheme(
)
CompositionLocalProvider(
LocalColors provides customColors,
LocalIcons provides customIcons,
LocalTypography provides customTypography,
LocalThemeColors provides customTheme
LocalColors provides customTheme
) {
content()
}
}
object AllInTheme {
val colors: AllInColors
@Composable
@ReadOnlyComposable
get() = LocalColors.current
val icons: AllInIcons
@Composable
@ReadOnlyComposable
@ -179,10 +102,10 @@ object AllInTheme {
@ReadOnlyComposable
get() = LocalTypography.current
val themeColors: AllInThemeColors
val colors: AllInColors
@Composable
@ReadOnlyComposable
get() = LocalThemeColors.current
get() = LocalColors.current
}

@ -90,7 +90,7 @@ fun BetScreen(
modifier = Modifier
.background(
Brush.verticalGradient(
0.5f to AllInTheme.themeColors.mainSurface,
0.5f to AllInTheme.colors.mainSurface,
1f to Color.Transparent
)
)

@ -59,11 +59,11 @@ fun BetScreenCard(
}
HorizontalDivider(
thickness = 1.dp,
color = AllInTheme.themeColors.border
color = AllInTheme.colors.border
)
Column(
Modifier
.background(AllInTheme.themeColors.background2)
.background(AllInTheme.colors.background2)
) {
Row(
modifier = Modifier
@ -80,7 +80,7 @@ fun BetScreenCard(
players.size
),
style = AllInTheme.typography.sm2,
color = AllInTheme.themeColors.onBackground2
color = AllInTheme.colors.onBackground2
)
}
RainbowButton(

@ -24,6 +24,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.ext.shadow
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInCard
import fr.iut.alldev.allin.ui.core.HighlightedText
@ -43,8 +44,8 @@ fun BetScreenPopularCard(
if (isSystemInDarkTheme()) {
it.shadow(
colors = listOf(
AllInTheme.colors.allInPink,
AllInTheme.colors.allInBlue
AllInColorToken.allInPink,
AllInColorToken.allInBlue
),
blurRadius = 10.dp,
alpha = .5f,
@ -60,9 +61,9 @@ fun BetScreenPopularCard(
}
}
.fillMaxWidth(),
backgroundColor = AllInTheme.colors.allInDark,
backgroundColor = AllInColorToken.allInDark,
borderWidth = 2.dp,
borderBrush = AllInTheme.colors.allInMainGradient
borderBrush = AllInColorToken.allInMainGradient
) {
Column(modifier = Modifier.padding(13.dp)) {
Row(verticalAlignment = Alignment.CenterVertically) {
@ -70,19 +71,19 @@ fun BetScreenPopularCard(
painter = painterResource(id = R.drawable.allin_fire),
modifier = Modifier.size(15.dp),
contentDescription = null,
tint = AllInTheme.colors.allInPink
tint = AllInColorToken.allInPink
)
Spacer(modifier = Modifier.width(3.dp))
Text(
text = stringResource(id = R.string.Popular),
color = AllInTheme.colors.allInPink,
color = AllInColorToken.allInPink,
fontSize = 17.sp,
style = AllInTheme.typography.h2
)
}
Text(
text = title,
color = AllInTheme.colors.white,
color = AllInColorToken.white,
fontSize = 20.sp,
style = AllInTheme.typography.h1,
modifier = Modifier.padding(vertical = 22.dp)
@ -97,15 +98,15 @@ fun BetScreenPopularCard(
query = nbPlayers.toString(),
highlightStyle = SpanStyle(
fontWeight = FontWeight.Bold,
color = AllInTheme.colors.allInPink
color = AllInColorToken.allInPink
),
color = AllInTheme.colors.white,
color = AllInColorToken.white,
style = AllInTheme.typography.p1,
fontSize = 15.sp
)
Text(
text = " - ",
color = AllInTheme.colors.white,
color = AllInColorToken.white,
style = AllInTheme.typography.p1,
fontSize = 15.sp
)
@ -123,9 +124,9 @@ fun BetScreenPopularCard(
query = pointsText,
highlightStyle = SpanStyle(
fontWeight = FontWeight.Bold,
color = AllInTheme.colors.allInPink
color = AllInColorToken.allInPink
),
color = AllInTheme.colors.white,
color = AllInColorToken.white,
style = AllInTheme.typography.p1,
fontSize = 15.sp
)

@ -50,6 +50,7 @@ import fr.iut.alldev.allin.data.model.bet.YesNoBet
import fr.iut.alldev.allin.data.model.bet.vo.BetAnswerDetail
import fr.iut.alldev.allin.data.model.bet.vo.BetDetail
import fr.iut.alldev.allin.ext.formatToSimple
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInBottomSheet
import fr.iut.alldev.allin.ui.core.AllInButton
@ -89,13 +90,13 @@ fun BetConfirmationBottomSheetAnswer(
text: String,
odds: Float,
modifier: Modifier = Modifier,
color: Color = AllInTheme.colors.allInBlue,
color: Color = AllInColorToken.allInBlue,
isSelected: Boolean,
locale: Locale,
onClick: () -> Unit
) {
val backColor = if (isSelected) AllInTheme.colors.allInPurple else AllInTheme.colors.white
val contentColor = if (isSelected) AllInTheme.colors.white else null
val backColor = if (isSelected) AllInColorToken.allInPurple else AllInColorToken.white
val contentColor = if (isSelected) AllInColorToken.white else null
AllInCard(
backgroundColor = backColor,
@ -117,7 +118,7 @@ fun BetConfirmationBottomSheetAnswer(
AllInCard(
radius = 50.dp,
backgroundColor = contentColor ?: AllInTheme.colors.allInPurple,
backgroundColor = contentColor ?: AllInColorToken.allInPurple,
modifier = Modifier.align(Alignment.CenterEnd)
) {
Box(Modifier.padding(vertical = 4.dp, horizontal = 8.dp)) {
@ -191,7 +192,7 @@ fun ConfirmationAnswers(
BetConfirmationBottomSheetAnswer(
text = it.response,
color = AllInTheme.colors.allInBarPink,
color = AllInColorToken.allInBarPink,
odds = it.odds,
locale = locale,
onClick = { onClick(it.response) },
@ -240,7 +241,7 @@ fun ConfirmationAnswers(
BetConfirmationBottomSheetAnswer(
text = it.response,
color = AllInTheme.colors.allInBarPink,
color = AllInColorToken.allInBarPink,
odds = it.odds,
locale = locale,
onClick = { onClick(it.response) },
@ -264,7 +265,7 @@ fun BetConfirmationBottomSheetContent(
) {
var selectedAnswer by remember { mutableStateOf<String?>(null) }
AllInMarqueeBox(backgroundColor = AllInTheme.colors.allInDarkGrey300) {
AllInMarqueeBox(backgroundColor = AllInColorToken.allInDarkGrey300) {
Box(
modifier = Modifier
.fillMaxSize()
@ -279,7 +280,7 @@ fun BetConfirmationBottomSheetContent(
) {
Icon(
imageVector = Icons.Default.Close,
tint = AllInTheme.colors.white,
tint = AllInColorToken.white,
contentDescription = null,
modifier = Modifier.size(24.dp)
)
@ -288,7 +289,7 @@ fun BetConfirmationBottomSheetContent(
Icon(
painter = AllInTheme.icons.logo(),
contentDescription = null,
tint = AllInTheme.colors.white,
tint = AllInColorToken.white,
modifier = Modifier
.size(40.dp)
.align(Alignment.TopCenter)
@ -310,14 +311,14 @@ fun BetConfirmationBottomSheetContent(
Row(
modifier = Modifier
.fillMaxWidth()
.background(AllInTheme.colors.allInMainGradient)
.background(AllInColorToken.allInMainGradient)
.padding(16.dp),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = stringResource(id = R.string.Finished),
color = AllInTheme.colors.white,
color = AllInColorToken.white,
style = AllInTheme.typography.h1,
fontSize = 24.sp
)
@ -325,7 +326,7 @@ fun BetConfirmationBottomSheetContent(
}
Text(
text = "Ce bet est arrivé à la date de fin. Vous devez à présent distribuer les gains en validant le pari gagnant.",
color = AllInTheme.colors.allInLightGrey200,
color = AllInColorToken.allInLightGrey200,
style = AllInTheme.typography.p2,
textAlign = TextAlign.Center
)
@ -335,7 +336,7 @@ fun BetConfirmationBottomSheetContent(
Text(
text = "Veuillez choisir la réponse finale :",
fontSize = 20.sp,
color = AllInTheme.colors.white,
color = AllInColorToken.white,
style = AllInTheme.typography.h1,
modifier = Modifier.fillMaxWidth()
)
@ -346,9 +347,9 @@ fun BetConfirmationBottomSheetContent(
}
if (selectedAnswer != null) {
AllInButton(
color = AllInTheme.colors.allInPurple,
color = AllInColorToken.allInPurple,
text = stringResource(id = R.string.Validate),
textColor = AllInTheme.colors.white,
textColor = AllInColorToken.white,
radius = 5.dp,
onClick = { selectedAnswer?.let(onConfirm) },
modifier = Modifier.align(Alignment.BottomCenter)

@ -8,6 +8,7 @@ import androidx.compose.ui.draw.alpha
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -17,7 +18,7 @@ fun BetCreationScreenBottomText(
) {
Text(
text = text,
color = AllInTheme.colors.allInPurple,
color = AllInColorToken.allInPurple,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center,
style = AllInTheme.typography.h2,

@ -102,7 +102,7 @@ fun BetCreationScreenContent(
.background(
Brush.verticalGradient(
0f to Color.Transparent,
0.50f to AllInTheme.themeColors.mainSurface
0.50f to AllInTheme.colors.mainSurface
)
),
) {

@ -8,6 +8,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInCard
@ -24,7 +25,7 @@ fun BetCreationScreenDateTimeButton(
) {
Text(
text = text,
color = AllInTheme.colors.allInPurple,
color = AllInColorToken.allInPurple,
style = AllInTheme.typography.h2,
fontSize = 16.sp,
modifier = Modifier.padding(horizontal = 23.dp, vertical = 9.dp)

@ -16,6 +16,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInCoinCount
import fr.iut.alldev.allin.ui.core.AllInRadioButton
@ -33,8 +34,8 @@ fun BetCreationScreenFriendLine(
.fillMaxWidth()
.clickable(onClick = onClick)
.background(
if (isSelected) AllInTheme.colors.allInPurple.copy(alpha = .13f)
else AllInTheme.themeColors.background
if (isSelected) AllInColorToken.allInPurple.copy(alpha = .13f)
else AllInTheme.colors.background
)
.padding(15.dp),
horizontalArrangement = Arrangement.spacedBy(7.dp),
@ -49,14 +50,14 @@ fun BetCreationScreenFriendLine(
text = username,
fontWeight = FontWeight.Bold,
style = AllInTheme.typography.h2,
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f)
)
AllInCoinCount(
amount = allCoinsAmount,
color = AllInTheme.colors.allInPurple
color = AllInColorToken.allInPurple
)
}
}

@ -116,7 +116,7 @@ fun QuestionTabPrivacySection(
}
if (idx != 0) {
HorizontalDivider(color = AllInTheme.themeColors.border)
HorizontalDivider(color = AllInTheme.colors.border)
}
BetCreationScreenFriendLine(
username = "Dave",

@ -14,7 +14,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.ui.core.AllInTextField
import fr.iut.alldev.allin.ui.core.AllInTitleInfo
@ -44,7 +44,7 @@ internal fun QuestionTabThemePhraseSection(
placeholderFontSize = 13.sp,
onValueChange = setBetTheme,
errorText = betThemeError,
borderColor = AllInTheme.colors.white
borderColor = AllInColorToken.white
)
Spacer(modifier = Modifier.height(10.dp))
AllInTitleInfo(
@ -65,6 +65,6 @@ internal fun QuestionTabThemePhraseSection(
multiLine = true,
onValueChange = setBetPhrase,
errorText = betPhraseError,
borderColor = AllInTheme.colors.white
borderColor = AllInColorToken.white
)
}

@ -24,6 +24,7 @@ import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.data.model.bet.BetStatus
import fr.iut.alldev.allin.ext.getBetHistoryPhrase
import fr.iut.alldev.allin.ext.getBetHistoryStatusColor
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.preview.BetStatusPreviewProvider
@ -40,7 +41,7 @@ val betHistoryStatusInlineContent = mapOf(
) {
Icon(
painter = AllInTheme.icons.allCoins(),
tint = AllInTheme.colors.white,
tint = AllInColorToken.white,
contentDescription = null,
modifier = Modifier.size(24.dp)
)
@ -70,7 +71,7 @@ fun BetHistoryBetStatus(
appendInlineContent(betHistoryStatusModId, "[icon]")
append(betHistoryPhrase.substringAfter("[icon]"))
},
color = AllInTheme.colors.white,
color = AllInColorToken.white,
inlineContent = betHistoryStatusInlineContent,
style = AllInTheme.typography.h1,
fontSize = 24.sp

@ -15,6 +15,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.data.model.bet.BetStatus
import fr.iut.alldev.allin.ext.asPaddingValues
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -39,7 +40,7 @@ fun <T> GenericHistory(
Text(
text = title,
style = AllInTheme.typography.h1,
color = AllInTheme.colors.allInGrey,
color = AllInColorToken.allInGrey,
fontSize = 24.sp,
textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth()

@ -22,6 +22,7 @@ import fr.iut.alldev.allin.data.ext.formatToTime
import fr.iut.alldev.allin.data.model.bet.Bet
import fr.iut.alldev.allin.data.model.bet.BetStatus
import fr.iut.alldev.allin.data.model.bet.YesNoBet
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.betResult.components.BetResultBottomSheetBetCard
import fr.iut.alldev.allin.ui.betResult.components.BetResultBottomSheetContentCoinAmount
@ -70,7 +71,7 @@ fun BetResultBottomSheetContent(
odds: Float,
onClose: () -> Unit
) {
AllInMarqueeBox(backgroundBrush = AllInTheme.colors.allInMainGradientReverse) {
AllInMarqueeBox(backgroundBrush = AllInColorToken.allInMainGradientReverse) {
Box(
modifier = Modifier
.fillMaxSize()
@ -85,7 +86,7 @@ fun BetResultBottomSheetContent(
) {
Icon(
imageVector = Icons.Default.Close,
tint = AllInTheme.colors.white,
tint = AllInColorToken.white,
contentDescription = null,
modifier = Modifier.size(24.dp)
)
@ -94,7 +95,7 @@ fun BetResultBottomSheetContent(
Icon(
painter = AllInTheme.icons.logo(),
contentDescription = null,
tint = AllInTheme.colors.white,
tint = AllInColorToken.white,
modifier = Modifier
.size(40.dp)
.align(Alignment.TopCenter)

@ -16,6 +16,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInCard
import fr.iut.alldev.allin.ui.core.AllInCoinCount
@ -30,7 +31,7 @@ fun BetResultBottomSheetBetCardStats(
Column(
Modifier
.fillMaxWidth()
.background(AllInTheme.themeColors.background2)
.background(AllInTheme.colors.background2)
.padding(horizontal = 19.dp, vertical = 11.dp),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
@ -42,12 +43,12 @@ fun BetResultBottomSheetBetCardStats(
Text(
text = stringResource(id = R.string.bet_result_stake),
style = AllInTheme.typography.sm2,
color = AllInTheme.themeColors.onMainSurface
color = AllInTheme.colors.onMainSurface
)
AllInCoinCount(
amount = stake,
color = AllInTheme.colors.allInPurple,
color = AllInColorToken.allInPurple,
textStyle = AllInTheme.typography.sm1,
position = IconPosition.TRAILING
)
@ -60,12 +61,12 @@ fun BetResultBottomSheetBetCardStats(
Text(
text = stringResource(id = R.string.bet_result_winnings),
style = AllInTheme.typography.sm2,
color = AllInTheme.colors.allInPurple
color = AllInColorToken.allInPurple
)
AllInCoinCount(
amount = winnings,
textStyle = AllInTheme.typography.sm1,
brush = AllInTheme.colors.allInMainGradient,
brush = AllInColorToken.allInMainGradient,
position = IconPosition.TRAILING
)
}
@ -78,17 +79,17 @@ fun BetResultBottomSheetBetCardStats(
Text(
text = stringResource(id = R.string.bet_result_odds),
style = AllInTheme.typography.sm2,
color = AllInTheme.themeColors.onBackground2
color = AllInTheme.colors.onBackground2
)
AllInCard(
radius = 8.dp,
backgroundBrush = AllInTheme.colors.allInMainGradient
backgroundBrush = AllInColorToken.allInMainGradient
) {
Box(Modifier.padding(vertical = 4.dp, horizontal = 8.dp)) {
Text(
text = "$odds",
style = AllInTheme.typography.sm1,
color = AllInTheme.colors.white
color = AllInColorToken.white
)
}
}

@ -19,6 +19,7 @@ import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -54,18 +55,18 @@ fun BetResultBottomSheetContentCongratulations(
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(
text= stringResource(id = R.string.bet_result_congratulations),
text = stringResource(id = R.string.bet_result_congratulations),
style = AllInTheme.typography.h1,
fontSize = 25.sp,
fontStyle = FontStyle.Italic,
color = AllInTheme.colors.white
color = AllInColorToken.white
)
Text(
text = "${username.uppercase()} !",
style = AllInTheme.typography.h1,
fontSize = 30.sp,
fontStyle = FontStyle.Italic,
color = AllInTheme.colors.white
color = AllInColorToken.white
)
}
}

@ -17,6 +17,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInCoinCount
import fr.iut.alldev.allin.ui.core.IconPosition
@ -33,7 +34,7 @@ fun BetResultBottomSheetContentCoinAmount(
Text(
text = stringResource(id = R.string.bet_result_you_win),
style = AllInTheme.typography.sm2,
color = AllInTheme.colors.white,
color = AllInColorToken.white,
fontSize = 20.sp
)
@ -42,7 +43,7 @@ fun BetResultBottomSheetContentCoinAmount(
.border(
width = 2.dp,
shape = RoundedCornerShape(100.dp),
color = AllInTheme.colors.white
color = AllInColorToken.white
)
.padding(vertical = 22.dp, horizontal = 33.dp)
@ -51,7 +52,7 @@ fun BetResultBottomSheetContentCoinAmount(
amount = amount,
textStyle = AllInTheme.typography.h1,
position = IconPosition.TRAILING,
color = AllInTheme.colors.white,
color = AllInColorToken.white,
size = 60,
modifier = Modifier
.align(Alignment.Center)
@ -61,7 +62,7 @@ fun BetResultBottomSheetContentCoinAmount(
amount = amount,
textStyle = AllInTheme.typography.h1,
position = IconPosition.TRAILING,
color = AllInTheme.colors.white.copy(alpha = .32f),
color = AllInColorToken.white.copy(alpha = .32f),
size = 60,
modifier = Modifier.align(Alignment.Center)
)

@ -19,6 +19,7 @@ import fr.iut.alldev.allin.data.model.bet.BetStatus
import fr.iut.alldev.allin.ext.getColor
import fr.iut.alldev.allin.ext.getTextColor
import fr.iut.alldev.allin.ext.getTitleId
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.betStatus.SHEET_HEIGHT
import fr.iut.alldev.allin.ui.preview.BetStatusPreviewProvider
@ -50,7 +51,7 @@ fun BetStatusBottomSheetBack(
)
Icon(
painter = painterResource(id = R.drawable.allin_exit),
tint = AllInTheme.colors.white,
tint = AllInColorToken.white,
contentDescription = null
)
}

@ -28,6 +28,7 @@ import fr.iut.alldev.allin.data.model.bet.YES_VALUE
import fr.iut.alldev.allin.data.model.bet.YesNoBet
import fr.iut.alldev.allin.data.model.bet.vo.BetDetail
import fr.iut.alldev.allin.ext.formatToSimple
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInCard
import fr.iut.alldev.allin.ui.preview.BetDetailPreviewProvider
@ -68,7 +69,7 @@ fun BetDetail.getParticipationAnswers(): List<@Composable RowScope.() -> Unit> {
this@getParticipationAnswers.getAnswerOfResponse(bet.nameTeam2)?.let {
ParticipationAnswerLine(
text = it.response,
color = AllInTheme.colors.allInBarPink,
color = AllInColorToken.allInBarPink,
odds = it.odds,
locale = locale
)
@ -90,7 +91,7 @@ fun BetDetail.getParticipationAnswers(): List<@Composable RowScope.() -> Unit> {
this@getParticipationAnswers.getAnswerOfResponse(NO_VALUE)?.let {
ParticipationAnswerLine(
text = it.response,
color = AllInTheme.colors.allInBarPink,
color = AllInColorToken.allInBarPink,
odds = it.odds,
locale = locale
)
@ -103,7 +104,7 @@ fun BetDetail.getParticipationAnswers(): List<@Composable RowScope.() -> Unit> {
@Composable
private fun ParticipationAnswerLine(
text: String,
color: Color = AllInTheme.colors.allInBlue,
color: Color = AllInColorToken.allInBlue,
locale: Locale,
odds: Float
) {
@ -121,12 +122,12 @@ private fun ParticipationAnswerLine(
AllInCard(
radius = 50.dp,
backgroundColor = AllInTheme.colors.allInPurple
backgroundColor = AllInColorToken.allInPurple
) {
Box(Modifier.padding(vertical = 4.dp, horizontal = 8.dp)) {
Text(
text = "x${odds.formatToSimple(locale)}",
color = AllInTheme.colors.white,
color = AllInColorToken.white,
style = AllInTheme.typography.h2
)
}

@ -26,6 +26,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInBottomSheet
import fr.iut.alldev.allin.ui.core.AllInButton
@ -58,7 +59,7 @@ fun BetStatusParticipationBottomSheet(
sheetVisibility = sheetVisibility,
onDismiss = onDismiss,
state = state,
containerColor = AllInTheme.themeColors.background2
containerColor = AllInTheme.colors.background2
) {
BetStatusParticipationBottomSheetContent(
betPhrase = betPhrase,
@ -103,15 +104,15 @@ private fun BetStatusParticipationBottomSheetContent(
Text(
text = stringResource(id = R.string.place_your_bets),
style = AllInTheme.typography.h2,
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
fontSize = 20.sp,
modifier = Modifier.padding(start = 18.dp)
)
AllInTopBarCoinCounter(
amount = coinAmount,
backgroundColor = AllInTheme.colors.allInBlue,
textColor = AllInTheme.colors.white,
iconColor = AllInTheme.colors.white,
backgroundColor = AllInColorToken.allInBlue,
textColor = AllInColorToken.white,
iconColor = AllInColorToken.white,
)
}
Column(
@ -120,7 +121,7 @@ private fun BetStatusParticipationBottomSheetContent(
Text(
text = betPhrase,
style = AllInTheme.typography.p2,
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
modifier = Modifier.padding(vertical = 30.dp)
)
AllInSelectionBox(
@ -137,7 +138,7 @@ private fun BetStatusParticipationBottomSheetContent(
setValue = setStake,
textStyle = AllInTheme.typography.h1.copy(
fontSize = 20.sp,
color = AllInTheme.themeColors.onBackground
color = AllInTheme.colors.onBackground
),
placeholder = stringResource(id = R.string.bet_result_stake),
trailingIcon = AllInTheme.icons.allCoins(),
@ -146,10 +147,10 @@ private fun BetStatusParticipationBottomSheetContent(
)
}
Spacer(modifier = Modifier.height(100.dp))
HorizontalDivider(color = AllInTheme.themeColors.border)
HorizontalDivider(color = AllInTheme.colors.border)
Column(
modifier = Modifier
.background(AllInTheme.themeColors.background)
.background(AllInTheme.colors.background)
.padding(7.dp),
verticalArrangement = Arrangement.spacedBy(7.dp)
) {
@ -161,18 +162,18 @@ private fun BetStatusParticipationBottomSheetContent(
Text(
text = stringResource(id = R.string.Possible_winnings),
style = AllInTheme.typography.p1,
color = AllInTheme.themeColors.onBackground
color = AllInTheme.colors.onBackground
)
AllInCoinCount(
amount = stake?.let { (it + (it * odds)).roundToInt() } ?: 0,
color = AllInTheme.themeColors.onBackground
color = AllInTheme.colors.onBackground
)
}
AllInButton(
enabled = enabled,
color = AllInTheme.colors.allInPurple,
color = AllInColorToken.allInPurple,
text = stringResource(id = R.string.Participate),
textColor = AllInTheme.colors.white,
textColor = AllInColorToken.white,
radius = 5.dp,
onClick = onButtonClick,
modifier = Modifier.navigationBarsPadding()

@ -29,7 +29,7 @@ fun BetStatusWinner(
coinAmount: Int,
username: String,
multiplier: Float,
color: Color = AllInTheme.themeColors.onMainSurface,
color: Color = AllInTheme.colors.onMainSurface,
) {
Column {
HorizontalDivider(color = color.copy(alpha = .4f))

@ -8,6 +8,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.tooling.preview.Preview
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInTextIcon
import fr.iut.alldev.allin.ui.core.IconPosition
@ -24,7 +25,7 @@ fun BinaryDetailsLine(
) {
AllInTextIcon(
text = yesText,
color = AllInTheme.colors.allInBlue,
color = AllInColorToken.allInBlue,
icon = icon,
position = IconPosition.LEADING,
size = 15,
@ -32,7 +33,7 @@ fun BinaryDetailsLine(
)
AllInTextIcon(
text = noText,
color = AllInTheme.colors.allInBarPink,
color = AllInColorToken.allInBarPink,
icon = icon,
position = IconPosition.TRAILING,
size = 15,

@ -11,6 +11,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.data.ext.toPercentageString
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.PercentagePositionnedElement
import fr.iut.alldev.allin.ui.core.StatBar
@ -26,7 +27,7 @@ fun BinaryStatBar(
Row {
Text(
text = response1,
color = AllInTheme.colors.allInBlue,
color = AllInColorToken.allInBlue,
style = AllInTheme.typography.h1,
fontStyle = FontStyle.Italic,
fontSize = 30.sp,
@ -37,7 +38,7 @@ fun BinaryStatBar(
style = AllInTheme.typography.h1,
fontStyle = FontStyle.Italic,
fontSize = 30.sp,
color = AllInTheme.colors.allInBarPink,
color = AllInColorToken.allInBarPink,
textAlign = TextAlign.End,
modifier = Modifier.weight(1f)
)
@ -49,7 +50,7 @@ fun BinaryStatBar(
Text(
text = response1Percentage.toPercentageString(),
style = AllInTheme.typography.sm1,
color = AllInTheme.colors.allInBarPurple
color = AllInColorToken.allInBarPurple
)
}
}

@ -7,6 +7,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.tooling.preview.Preview
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInTextIcon
import fr.iut.alldev.allin.ui.core.IconPosition
@ -24,9 +25,9 @@ fun SimpleDetailsLine(
AllInTextIcon(
text = text,
color = if (isWin) {
AllInTheme.colors.allInBarViolet
AllInColorToken.allInBarViolet
} else {
AllInTheme.colors.allInBlue
AllInColorToken.allInBlue
},
icon = icon,
position = IconPosition.TRAILING,

@ -21,6 +21,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.data.ext.toPercentageString
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -34,9 +35,9 @@ fun SimpleStatBar(
Text(
text = response,
color = if (isWin) {
AllInTheme.colors.allInBarPink
AllInColorToken.allInBarPink
} else {
AllInTheme.colors.allInBlue
AllInColorToken.allInBlue
},
style = AllInTheme.typography.sm2,
fontStyle = FontStyle.Italic,
@ -60,9 +61,9 @@ fun SimpleStatBar(
)
.background(
if (isWin) {
AllInTheme.colors.allInBar2ndGradient
AllInColorToken.allInBar2ndGradient
} else {
AllInTheme.colors.allInBar1stGradient
AllInColorToken.allInBar1stGradient
}
)
)
@ -70,12 +71,14 @@ fun SimpleStatBar(
Icon(
painter = painterResource(id = R.drawable.fire_solid),
tint = if (isWin) {
AllInTheme.colors.allInBarViolet
AllInColorToken.allInBarViolet
} else {
AllInTheme.colors.allInBarPurple
AllInColorToken.allInBarPurple
},
contentDescription = null,
modifier = Modifier.size(32.dp).offset((-7).dp)
modifier = Modifier
.size(32.dp)
.offset((-7).dp)
)
Text(
modifier = Modifier.let { itModifier ->
@ -87,9 +90,9 @@ fun SimpleStatBar(
fontSize = if (isWin) 24.sp else 16.sp
),
color = if (isWin) {
AllInTheme.colors.allInBarViolet
AllInColorToken.allInBarViolet
} else {
AllInTheme.colors.allInBarPurple
AllInColorToken.allInBarPurple
}
)
}

@ -50,6 +50,7 @@ import androidx.core.os.ConfigurationCompat
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.data.ext.formatToMediumDateNoYear
import fr.iut.alldev.allin.data.ext.formatToTime
import fr.iut.alldev.allin.data.model.User
import fr.iut.alldev.allin.data.model.bet.BetStatus
import fr.iut.alldev.allin.data.model.bet.CustomBet
import fr.iut.alldev.allin.data.model.bet.MatchBet
@ -60,6 +61,7 @@ import fr.iut.alldev.allin.ext.asPaddingValues
import fr.iut.alldev.allin.ext.formatToSimple
import fr.iut.alldev.allin.ext.getDateEndLabelId
import fr.iut.alldev.allin.ext.getDateStartLabelId
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.betStatus.components.BetStatusWinner
import fr.iut.alldev.allin.ui.betStatus.components.BinaryDetailsLine
@ -82,6 +84,7 @@ class BetStatusBottomSheetBetDisplayer(
@Composable
private fun DisplayBet(
betDetail: BetDetail,
currentUser: User,
statBar: LazyListScope.() -> Unit
) {
Box(Modifier) {
@ -116,18 +119,18 @@ class BetStatusBottomSheetBetDisplayer(
if (betDetail.bet.betStatus == BetStatus.FINISHED) {
BetStatusWinner(
answer = YES_VALUE,
color = AllInTheme.colors.allInBlue,
color = AllInColorToken.allInBlue,
coinAmount = 442,
username = "Imri",
multiplier = 1.2f
)
} else {
HorizontalDivider(color = AllInTheme.themeColors.border)
HorizontalDivider(color = AllInTheme.colors.border)
}
LazyColumn(
modifier = Modifier
.fillMaxHeight()
.background(AllInTheme.themeColors.background2)
.background(AllInTheme.colors.background2)
.nestedScroll(object : NestedScrollConnection {
override fun onPostScroll(
consumed: Offset,
@ -145,7 +148,7 @@ class BetStatusBottomSheetBetDisplayer(
Text(
text = stringResource(id = R.string.bet_status_participants_list),
fontSize = 20.sp,
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
style = AllInTheme.typography.h1,
modifier = Modifier.padding(vertical = 36.dp)
)
@ -159,7 +162,7 @@ class BetStatusBottomSheetBetDisplayer(
allCoinsAmount = it.stake
)
HorizontalDivider(
color = AllInTheme.themeColors.border,
color = AllInTheme.colors.border,
modifier = Modifier.padding(vertical = 8.dp, horizontal = 25.dp)
)
}
@ -181,14 +184,18 @@ class BetStatusBottomSheetBetDisplayer(
}
}
}
if (betDetail.bet.betStatus != BetStatus.FINISHED && betDetail.userParticipation == null) {
if (
betDetail.bet.betStatus != BetStatus.FINISHED &&
betDetail.userParticipation == null &&
betDetail.bet.creator != currentUser.username
) {
RainbowButton(
modifier = Modifier
.align(Alignment.BottomCenter)
.background(
Brush.verticalGradient(
.2f to Color.Transparent,
.5f to AllInTheme.themeColors.background2
.5f to AllInTheme.colors.background2
)
)
.padding(7.dp)
@ -249,7 +256,8 @@ class BetStatusBottomSheetBetDisplayer(
private fun LazyListScope.displayMultiStatBar(
betDetail: BetDetail,
responses: List<String>
responses: List<String>,
locale: Locale
) {
val responsesWithDetail = responses.mapNotNull {
betDetail.getAnswerOfResponse(it)
@ -260,9 +268,6 @@ class BetStatusBottomSheetBetDisplayer(
itemsIndexed(responsesWithDetail.toList().sortedByDescending { it.second }) { idx, (answer, percentage) ->
val isWin = remember { idx == 0 }
val configuration = LocalConfiguration.current
val locale = remember { ConfigurationCompat.getLocales(configuration).get(0) ?: Locale.getDefault() }
SimpleStatBar(
percentage = percentage,
response = answer.response,
@ -295,8 +300,8 @@ class BetStatusBottomSheetBetDisplayer(
}
@Composable
override fun DisplayYesNoBet(betDetail: BetDetail) {
DisplayBet(betDetail = betDetail) {
override fun DisplayYesNoBet(betDetail: BetDetail, currentUser: User) {
DisplayBet(betDetail = betDetail, currentUser = currentUser) {
displayBinaryStatBar(
betDetail = betDetail,
response1 = YES_VALUE,
@ -308,10 +313,10 @@ class BetStatusBottomSheetBetDisplayer(
}
@Composable
override fun DisplayMatchBet(betDetail: BetDetail) {
override fun DisplayMatchBet(betDetail: BetDetail, currentUser: User) {
val matchBet = remember { betDetail.bet as MatchBet }
DisplayBet(betDetail = betDetail) {
DisplayBet(betDetail = betDetail, currentUser = currentUser) {
displayBinaryStatBar(
betDetail = betDetail,
response1 = matchBet.nameTeam1,
@ -321,10 +326,12 @@ class BetStatusBottomSheetBetDisplayer(
}
@Composable
override fun DisplayCustomBet(betDetail: BetDetail) {
override fun DisplayCustomBet(betDetail: BetDetail, currentUser: User) {
val customBet = remember { betDetail.bet as CustomBet }
val configuration = LocalConfiguration.current
val locale = remember { ConfigurationCompat.getLocales(configuration).get(0) ?: Locale.getDefault() }
DisplayBet(betDetail = betDetail) {
DisplayBet(betDetail = betDetail, currentUser = currentUser) {
if (customBet.possibleAnswers.size == 2) {
displayBinaryStatBar(
betDetail = betDetail,
@ -334,7 +341,8 @@ class BetStatusBottomSheetBetDisplayer(
} else {
displayMultiStatBar(
betDetail = betDetail,
responses = customBet.getResponses()
responses = customBet.getResponses(),
locale = locale
)
}
}
@ -356,14 +364,14 @@ fun BetStatusParticipant(
text = username,
fontWeight = FontWeight.Bold,
style = AllInTheme.typography.h2,
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f)
)
AllInCoinCount(
amount = allCoinsAmount,
color = AllInTheme.colors.allInPurple
color = AllInColorToken.allInPurple
)
}
}
@ -375,8 +383,11 @@ private fun BetStatusBottomSheetPreview(
@PreviewParameter(BetDetailPreviewProvider::class) bet: BetDetail
) {
AllInTheme {
BetStatusBottomSheetBetDisplayer {
}.DisplayBet(bet)
BetStatusBottomSheetBetDisplayer(
openParticipateSheet = {}
).DisplayBet(
betDetail = bet,
currentUser = User(id = "x", username = "aaa", email = "aaa", coins = 150)
)
}
}

@ -9,6 +9,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -43,16 +44,16 @@ fun AllInAlertDialog(
text = confirmText,
fontSize = 15.sp,
style = AllInTheme.typography.h1.copy(
brush = AllInTheme.colors.allInMainGradient
brush = AllInColorToken.allInMainGradient
)
)
}
},
onDismissRequest = onDismiss,
containerColor = AllInTheme.themeColors.mainSurface,
titleContentColor = AllInTheme.themeColors.onMainSurface,
textContentColor = AllInTheme.themeColors.onBackground2,
containerColor = AllInTheme.colors.mainSurface,
titleContentColor = AllInTheme.colors.onMainSurface,
textContentColor = AllInTheme.colors.onBackground2,
)
}
}

@ -14,17 +14,17 @@ import racra.compose.smooth_corner_rect_library.AbsoluteSmoothCornerShape
@Composable
fun AllInBottomSheet(
sheetVisibility: Boolean,
onDismiss: ()->Unit,
onDismiss: () -> Unit,
state: SheetState,
scrimColor: Color = BottomSheetDefaults.ScrimColor,
containerColor: Color = AllInTheme.themeColors.background,
dragHandle: (@Composable ()->Unit)? = { BottomSheetDefaults.DragHandle() },
content: @Composable ColumnScope.()->Unit
containerColor: Color = AllInTheme.colors.background,
dragHandle: (@Composable () -> Unit)? = { BottomSheetDefaults.DragHandle() },
content: @Composable ColumnScope.() -> Unit
) {
val localDensity = LocalDensity.current
val localLayoutDirection = LocalLayoutDirection.current
if(sheetVisibility) {
if (sheetVisibility) {
ModalBottomSheet(
onDismissRequest = onDismiss,
sheetState = state,

@ -11,6 +11,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -34,7 +35,7 @@ fun AllInButton(
text = text,
textAlign = TextAlign.Center,
style = AllInTheme.typography.h2,
color = if(enabled) textColor else AllInTheme.themeColors.disabledBorder,
color = if (enabled) textColor else AllInTheme.colors.disabledBorder,
fontSize = 20.sp,
modifier = Modifier
.padding(vertical = 15.dp)
@ -48,7 +49,7 @@ fun AllInButton(
private fun AllInButtonPreview() {
AllInTheme {
AllInButton(
color = AllInTheme.colors.allInLoginPurple,
color = AllInColorToken.allInLoginPurple,
text = "Connexion",
textColor = Color.White
) {
@ -62,7 +63,7 @@ private fun AllInButtonPreview() {
private fun AllInButtonDisabledPreview() {
AllInTheme {
AllInButton(
color = AllInTheme.colors.allInLoginPurple,
color = AllInColorToken.allInLoginPurple,
text = "Connexion",
textColor = Color.White,
enabled = false

@ -35,12 +35,12 @@ fun AllInCard(
radius: Dp = 15.dp,
shape: Shape? = null,
enabled: Boolean = true,
backgroundColor: Color = AllInTheme.themeColors.background,
disabledBackgroundColor: Color = AllInTheme.themeColors.disabled,
backgroundColor: Color = AllInTheme.colors.background,
disabledBackgroundColor: Color = AllInTheme.colors.disabled,
backgroundBrush: Brush? = null,
borderWidth: Dp? = null,
borderColor: Color = AllInTheme.themeColors.border,
disabledBorderColor: Color = AllInTheme.themeColors.disabledBorder,
borderColor: Color = AllInTheme.colors.border,
disabledBorderColor: Color = AllInTheme.colors.disabledBorder,
borderBrush: Brush? = null,
content: @Composable () -> Unit,
) {
@ -92,12 +92,12 @@ fun AllInBouncyCard(
onClick: (() -> Unit)? = null,
radius: Dp = 15.dp,
enabled: Boolean = true,
backgroundColor: Color = AllInTheme.themeColors.background,
disabledBackgroundColor: Color = AllInTheme.themeColors.disabled,
backgroundColor: Color = AllInTheme.colors.background,
disabledBackgroundColor: Color = AllInTheme.colors.disabled,
backgroundBrush: Brush? = null,
borderWidth: Dp? = null,
borderColor: Color = AllInTheme.themeColors.border,
disabledBorderColor: Color = AllInTheme.themeColors.disabledBorder,
borderColor: Color = AllInTheme.colors.border,
disabledBorderColor: Color = AllInTheme.colors.disabledBorder,
borderBrush: Brush? = null,
content: @Composable () -> Unit,
) {

@ -13,6 +13,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import racra.compose.smooth_corner_rect_library.AbsoluteSmoothCornerShape
@ -24,14 +25,14 @@ fun AllInChip(
isSelected: Boolean = false,
onClick: () -> Unit = {},
radius: Dp = 50.dp,
selectedColor: Color = AllInTheme.colors.allInPurple,
unselectedColor: Color = AllInTheme.themeColors.background,
selectedColor: Color = AllInColorToken.allInPurple,
unselectedColor: Color = AllInTheme.colors.background,
) {
Card(
modifier = modifier,
shape = AbsoluteSmoothCornerShape(radius, 100),
onClick = onClick,
border = if (!isSelected) BorderStroke(1.dp, AllInTheme.themeColors.border) else null,
border = if (!isSelected) BorderStroke(1.dp, AllInTheme.colors.border) else null,
colors = CardDefaults.cardColors(
containerColor = if (isSelected) selectedColor else unselectedColor
)
@ -45,7 +46,7 @@ fun AllInChip(
.alpha(if (isSelected) 0f else 1f),
textAlign = TextAlign.Center,
style = AllInTheme.typography.p1,
color = AllInTheme.themeColors.onBackground2
color = AllInTheme.colors.onBackground2
)
if (isSelected) {
Text(
@ -53,7 +54,7 @@ fun AllInChip(
modifier = modifier.align(Alignment.Center),
textAlign = TextAlign.Center,
style = AllInTheme.typography.h1,
color = AllInTheme.colors.white
color = AllInColorToken.white
)
}
}

@ -7,6 +7,7 @@ import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -36,6 +37,6 @@ fun AllInCoinCount(
@Composable
private fun AllInCoinCountPreview() {
AllInTheme {
AllInCoinCount(amount = 542, color = AllInTheme.colors.allInPurple)
AllInCoinCount(amount = 542, color = AllInColorToken.allInPurple)
}
}

@ -6,6 +6,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import java.time.ZonedDateTime
import java.util.*
@ -41,7 +42,7 @@ fun AllInDatePicker(
Text(
text = stringResource(id = R.string.Validate),
style = AllInTheme.typography.h1.copy(
brush = AllInTheme.colors.allInMainGradient
brush = AllInColorToken.allInMainGradient
)
)
}
@ -50,36 +51,36 @@ fun AllInDatePicker(
TextButton(onClick = onDismiss) {
Text(
text = stringResource(id = R.string.Cancel),
color = AllInTheme.themeColors.onBackground2,
color = AllInTheme.colors.onBackground2,
style = AllInTheme.typography.sm1
)
}
},
colors = DatePickerDefaults.colors(
containerColor = AllInTheme.themeColors.mainSurface
containerColor = AllInTheme.colors.mainSurface
)
) {
DatePicker(
state = datePickerState,
colors = DatePickerDefaults.colors(
todayDateBorderColor = AllInTheme.colors.allInBlue,
selectedDayContainerColor = AllInTheme.colors.allInBlue,
todayContentColor = AllInTheme.colors.allInBlue,
dayContentColor = AllInTheme.colors.allInBlue,
dividerColor = AllInTheme.themeColors.border,
containerColor = AllInTheme.themeColors.background,
titleContentColor = AllInTheme.themeColors.onMainSurface,
headlineContentColor = AllInTheme.themeColors.onMainSurface,
subheadContentColor = AllInTheme.themeColors.onBackground2,
todayDateBorderColor = AllInColorToken.allInBlue,
selectedDayContainerColor = AllInColorToken.allInBlue,
todayContentColor = AllInColorToken.allInBlue,
dayContentColor = AllInColorToken.allInBlue,
dividerColor = AllInTheme.colors.border,
containerColor = AllInTheme.colors.background,
titleContentColor = AllInTheme.colors.onMainSurface,
headlineContentColor = AllInTheme.colors.onMainSurface,
subheadContentColor = AllInTheme.colors.onBackground2,
dateTextFieldColors = OutlinedTextFieldDefaults.colors(
focusedContainerColor = AllInTheme.themeColors.mainSurface,
unfocusedContainerColor = AllInTheme.themeColors.mainSurface,
focusedBorderColor = AllInTheme.colors.allInPurple,
unfocusedBorderColor = AllInTheme.themeColors.border,
focusedTextColor = AllInTheme.themeColors.onMainSurface,
unfocusedTextColor = AllInTheme.themeColors.onMainSurface,
focusedLabelColor = AllInTheme.colors.allInPurple,
unfocusedLabelColor = AllInTheme.themeColors.onMainSurface,
focusedContainerColor = AllInTheme.colors.mainSurface,
unfocusedContainerColor = AllInTheme.colors.mainSurface,
focusedBorderColor = AllInColorToken.allInPurple,
unfocusedBorderColor = AllInTheme.colors.border,
focusedTextColor = AllInTheme.colors.onMainSurface,
unfocusedTextColor = AllInTheme.colors.onMainSurface,
focusedLabelColor = AllInColorToken.allInPurple,
unfocusedLabelColor = AllInTheme.colors.onMainSurface,
)
)
)

@ -33,7 +33,7 @@ import fr.iut.alldev.allin.theme.AllInTheme
@Composable
fun AllInDetailsDrawer(
text: String = stringResource(id = R.string.Details),
textColor: Color = AllInTheme.themeColors.onBackground2,
textColor: Color = AllInTheme.colors.onBackground2,
content: @Composable ColumnScope.() -> Unit,
) {
val interactionSource = remember { MutableInteractionSource() }

@ -10,6 +10,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.ext.shadow
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -23,8 +24,8 @@ fun AllInGradientButton(
modifier = modifier
.shadow(
colors = listOf(
AllInTheme.colors.allInPink,
AllInTheme.colors.allInBlue
AllInColorToken.allInPink,
AllInColorToken.allInBlue
),
blurRadius = 20.dp,
alpha = .5f,
@ -32,13 +33,13 @@ fun AllInGradientButton(
)
.fillMaxWidth(),
radius = 10.dp,
backgroundBrush = AllInTheme.colors.allInMainGradient
backgroundBrush = AllInColorToken.allInMainGradient
) {
Text(
text = text,
textAlign = TextAlign.Center,
style = AllInTheme.typography.h2,
color = AllInTheme.colors.white,
color = AllInColorToken.white,
fontSize = 20.sp,
modifier = Modifier
.padding(vertical = 15.dp)

@ -18,6 +18,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import racra.compose.smooth_corner_rect_library.AbsoluteSmoothCornerShape
@ -28,16 +29,16 @@ fun AllInIconChip(
isSelected: Boolean = false,
onClick: () -> Unit = {},
radius: Dp = 15.dp,
selectedColor: Color = AllInTheme.colors.allInPurple,
unselectedColor: Color = AllInTheme.themeColors.background,
selectedColor: Color = AllInColorToken.allInPurple,
unselectedColor: Color = AllInTheme.colors.background,
leadingIcon: ImageVector,
) {
val contentColor = if (isSelected) AllInTheme.colors.white else selectedColor
val contentColor = if (isSelected) AllInColorToken.white else selectedColor
Card(
modifier = modifier,
shape = AbsoluteSmoothCornerShape(radius, 100),
onClick = onClick,
border = if (!isSelected) BorderStroke(1.dp, AllInTheme.themeColors.border) else null,
border = if (!isSelected) BorderStroke(1.dp, AllInTheme.colors.border) else null,
colors = CardDefaults.cardColors(
containerColor = if (isSelected) selectedColor else unselectedColor
)

@ -41,6 +41,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import androidx.compose.ui.window.DialogWindowProvider
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import kotlin.math.PI
import kotlin.math.abs
@ -50,7 +51,7 @@ import kotlin.math.max
fun AllInLoading(
modifier: Modifier = Modifier,
visible: Boolean,
brush: Brush = AllInTheme.colors.allInMainGradient,
brush: Brush = AllInColorToken.allInMainGradient,
) {
val interactionSource = remember { MutableInteractionSource() }
AnimatedVisibility(
@ -76,7 +77,7 @@ fun AllInLoading(
indication = null,
onClick = {}
)
.background(AllInTheme.themeColors.mainSurface.copy(alpha = .4f))
.background(AllInTheme.colors.mainSurface.copy(alpha = .4f))
) {
AllInCircularProgressIndicator(
modifier = Modifier
@ -93,7 +94,7 @@ fun AllInLoading(
@Composable
fun AllInCircularProgressIndicator(
modifier: Modifier = Modifier,
brush: Brush = AllInTheme.colors.allInMainGradient,
brush: Brush = AllInColorToken.allInMainGradient,
strokeWidth: Dp = ProgressIndicatorDefaults.CircularStrokeWidth,
strokeCap: StrokeCap = ProgressIndicatorDefaults.CircularIndeterminateStrokeCap,
) {

@ -19,18 +19,20 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
fun AllInMarqueeBox(
backgroundColor: Color = AllInTheme.themeColors.mainSurface,
backgroundColor: Color = AllInTheme.colors.mainSurface,
backgroundBrush: Brush? = null,
content: @Composable BoxScope.() -> Unit
) {
Box(
modifier = Modifier
.fillMaxSize().let { itModifier ->
.fillMaxSize()
.let { itModifier ->
backgroundBrush?.let {
itModifier.background(it)
} ?: itModifier.background(backgroundColor)
@ -45,7 +47,7 @@ fun AllInMarqueeBox(
.scale(1.2f)
.rotate(11f)
.basicMarquee(spacing = MarqueeSpacing(0.dp)),
tint = AllInTheme.colors.white.copy(alpha = .05f)
tint = AllInColorToken.white.copy(alpha = .05f)
)
content()
}
@ -57,7 +59,7 @@ fun AllInMarqueeBox(
private fun AllInMarqueeBoxPreview() {
AllInTheme {
AllInMarqueeBox(
backgroundBrush = AllInTheme.colors.allInMainGradient,
backgroundBrush = AllInColorToken.allInMainGradient,
) {
Text("CONTENT")
}

@ -6,6 +6,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -16,9 +17,9 @@ fun AllInRadioButton(
) {
AllInCard(
radius = 100.dp,
borderColor = AllInTheme.colors.allInMint,
borderColor = AllInColorToken.allInMint,
borderWidth = if (!checked) 1.dp else null,
backgroundColor = if (checked) AllInTheme.colors.allInPurple else unCheckedColor,
backgroundColor = if (checked) AllInColorToken.allInPurple else unCheckedColor,
modifier = modifier.size(12.dp)
) {}
}
@ -35,7 +36,7 @@ private fun AllInRadioButtonNotCheckedPreview() {
@Composable
private fun AllInRadioButtonNotCheckedFilledPreview() {
AllInTheme {
AllInRadioButton(checked = false, unCheckedColor = AllInTheme.colors.allInMint)
AllInRadioButton(checked = false, unCheckedColor = AllInColorToken.allInMint)
}
}

@ -23,6 +23,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -39,7 +40,7 @@ fun AllInRetractableCard(
AllInCard(
modifier = modifier.fillMaxWidth(),
borderWidth = borderWidth,
borderColor = AllInTheme.colors.allInPurple.copy(.5f)
borderColor = AllInColorToken.allInPurple.copy(.5f)
) {
Column(
Modifier.animateContentSize()
@ -60,10 +61,10 @@ fun AllInRetractableCard(
query = boldText,
highlightStyle = SpanStyle(
fontWeight = FontWeight.Bold,
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
fontStyle = AllInTheme.typography.h2.fontStyle
),
color = AllInTheme.themeColors.onBackground2,
color = AllInTheme.colors.onBackground2,
style = AllInTheme.typography.p1,
fontSize = 16.sp,
modifier = Modifier.weight(1f)
@ -73,13 +74,13 @@ fun AllInRetractableCard(
if (isOpen) ExpandLess else ExpandMore
},
contentDescription = null,
tint = AllInTheme.colors.allInPurple,
tint = AllInColorToken.allInPurple,
modifier = Modifier.size(30.dp)
)
}
AnimatedVisibility(isOpen) {
Column {
HorizontalDivider(color = AllInTheme.themeColors.border)
HorizontalDivider(color = AllInTheme.colors.border)
content()
}
}

@ -21,14 +21,14 @@ fun AllInSectionButton(
) {
val style = if (isSelected) {
AllInTheme.typography.sm1.copy(
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
fontSize = 15.sp,
textAlign = TextAlign.Center,
fontWeight = FontWeight.ExtraBold
)
} else {
AllInTheme.typography.sm1.copy(
color = AllInTheme.themeColors.onBackground2,
color = AllInTheme.colors.onBackground2,
fontSize = 15.sp,
textAlign = TextAlign.Center,
fontWeight = FontWeight.SemiBold

@ -63,7 +63,7 @@ fun AllInSections(
.fillMaxWidth()
.background(
Brush.verticalGradient(
0.75f to AllInTheme.themeColors.mainSurface,
0.75f to AllInTheme.colors.mainSurface,
1f to Color.Transparent
)
),

@ -34,6 +34,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@ -66,13 +67,13 @@ private fun AllInSelectionLine(
Icon(
imageVector = it,
contentDescription = null,
tint = AllInTheme.colors.allInPurple,
tint = AllInColorToken.allInPurple,
modifier = Modifier.size(20.dp)
)
}
Text(
text = text,
color = AllInTheme.colors.allInPurple,
color = AllInColorToken.allInPurple,
style = AllInTheme.typography.h2,
fontWeight = FontWeight.Bold,
modifier = Modifier.weight(1f)
@ -81,7 +82,7 @@ private fun AllInSelectionLine(
Icon(
imageVector = trailingIcon,
contentDescription = null,
tint = AllInTheme.colors.allInPurple,
tint = AllInColorToken.allInPurple,
modifier = Modifier
.size(30.dp)
)
@ -105,7 +106,7 @@ fun AllInSelectionBox(
modifier = modifier.fillMaxWidth(),
radius = 10.dp,
borderWidth = borderWidth,
borderColor = AllInTheme.colors.allInPurple.copy(alpha = .42f)
borderColor = AllInColorToken.allInPurple.copy(alpha = .42f)
) {
Column(
Modifier.animateContentSize()
@ -125,7 +126,7 @@ fun AllInSelectionBox(
)
AnimatedVisibility(isOpen) {
Column {
HorizontalDivider(color = AllInTheme.themeColors.border)
HorizontalDivider(color = AllInTheme.colors.border)
elements.filter { it != selected }.forEach { element ->
AllInSelectionLine(
text = stringResource(id = element.textId),
@ -188,7 +189,7 @@ private fun AllInSelectionLine(
Icon(
imageVector = trailingIcon,
contentDescription = null,
tint = AllInTheme.colors.allInPurple,
tint = AllInColorToken.allInPurple,
modifier = Modifier
.size(30.dp)
)
@ -211,7 +212,7 @@ fun AllInSelectionBox(
modifier = modifier.fillMaxWidth(),
radius = 10.dp,
borderWidth = borderWidth,
borderColor = AllInTheme.colors.allInPurple.copy(alpha = .42f)
borderColor = AllInColorToken.allInPurple.copy(alpha = .42f)
) {
Column(Modifier.animateContentSize()) {
AllInSelectionLine(
@ -224,7 +225,7 @@ fun AllInSelectionBox(
)
AnimatedVisibility(isOpen) {
Column {
HorizontalDivider(color = AllInTheme.themeColors.border)
HorizontalDivider(color = AllInTheme.colors.border)
elements.filter { it != selected }.forEach { element ->
AllInSelectionLine(
element = element,

@ -25,6 +25,7 @@ import androidx.core.text.isDigitsOnly
import fr.iut.alldev.allin.ext.formatToSimple
import fr.iut.alldev.allin.ext.toFloatOrNull
import fr.iut.alldev.allin.ext.verifyIsFloat
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import racra.compose.smooth_corner_rect_library.AbsoluteSmoothCornerShape
import java.util.Locale
@ -46,10 +47,10 @@ fun AllInTextField(
keyboardType: KeyboardType = KeyboardType.Text,
imeAction: ImeAction = ImeAction.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
borderColor: Color = AllInTheme.themeColors.onBackground2,
containerColor: Color = AllInTheme.themeColors.background,
textColor: Color = AllInTheme.themeColors.onMainSurface,
placeholderColor: Color = AllInTheme.themeColors.onBackground2,
borderColor: Color = AllInTheme.colors.onBackground2,
containerColor: Color = AllInTheme.colors.background,
textColor: Color = AllInTheme.colors.onMainSurface,
placeholderColor: Color = AllInTheme.colors.onBackground2,
onValueChange: (String) -> Unit,
) {
OutlinedTextField(
@ -83,7 +84,7 @@ fun AllInTextField(
Icon(
painter = it,
contentDescription = null,
tint = AllInTheme.colors.allInLightGrey300
tint = AllInColorToken.allInLightGrey300
)
}
},
@ -131,7 +132,7 @@ fun AllInPasswordField(
Icon(
imageVector = if (hidden) Icons.Default.VisibilityOff else Icons.Default.Visibility,
contentDescription = null,
tint = AllInTheme.colors.allInLightGrey300
tint = AllInColorToken.allInLightGrey300
)
}
},

@ -21,6 +21,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@ -77,7 +78,7 @@ private fun AllInTextIconPreview() {
AllInTextIcon(
text = "value",
icon = rememberVectorPainter(image = Icons.Default.Fireplace),
color = AllInTheme.colors.allInBlue
color = AllInColorToken.allInBlue
)
}
}
@ -89,8 +90,8 @@ private fun AllInTextIconReversePreview() {
AllInTextIcon(
text = "value",
icon = AllInTheme.icons.allCoins(),
color = AllInTheme.colors.allInBlue,
brush = AllInTheme.colors.allInMainGradient,
color = AllInColorToken.allInBlue,
brush = AllInColorToken.allInMainGradient,
position = IconPosition.LEADING
)
}

@ -6,6 +6,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import java.util.*
@ -36,7 +37,7 @@ fun AllInTimePicker(
Text(
text = stringResource(id = R.string.Validate),
style = AllInTheme.typography.h1.copy(
brush = AllInTheme.colors.allInMainGradient
brush = AllInColorToken.allInMainGradient
)
)
}
@ -45,7 +46,7 @@ fun AllInTimePicker(
TextButton(onClick = onDismiss) {
Text(
text = stringResource(id = R.string.Cancel),
color = AllInTheme.themeColors.onBackground2,
color = AllInTheme.colors.onBackground2,
style = AllInTheme.typography.sm1
)
}
@ -54,16 +55,16 @@ fun AllInTimePicker(
TimePicker(
state = timePickerState,
colors = TimePickerDefaults.colors(
selectorColor = AllInTheme.colors.allInPurple,
containerColor = AllInTheme.themeColors.background,
clockDialColor = AllInTheme.themeColors.background2,
clockDialUnselectedContentColor = AllInTheme.themeColors.onMainSurface,
clockDialSelectedContentColor = AllInTheme.themeColors.background2,
selectorColor = AllInColorToken.allInPurple,
containerColor = AllInTheme.colors.background,
clockDialColor = AllInTheme.colors.background2,
clockDialUnselectedContentColor = AllInTheme.colors.onMainSurface,
clockDialSelectedContentColor = AllInTheme.colors.background2,
)
)
},
containerColor = AllInTheme.themeColors.mainSurface
containerColor = AllInTheme.colors.mainSurface
)
}

@ -66,14 +66,14 @@ fun AllInTitleInfo(
style = AllInTheme.typography.h2,
fontWeight = FontWeight.Bold,
fontSize = 15.sp,
color = AllInTheme.themeColors.onMainSurface
color = AllInTheme.colors.onMainSurface
)
Spacer(modifier = Modifier.width(5.dp))
AllInTooltip(text = tooltipText, state = tooltipState) {
Icon(
imageVector = icon,
contentDescription = null,
tint = AllInTheme.themeColors.onMainSurface,
tint = AllInTheme.colors.onMainSurface,
modifier = Modifier
.size(15.dp)
.alpha(.8f)

@ -13,6 +13,7 @@ import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.*
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import racra.compose.smooth_corner_rect_library.AbsoluteSmoothCornerShape
@ -30,7 +31,7 @@ fun AllInTooltip(
AllInPlainTooltip {
Text(
text = text,
color = AllInTheme.colors.allInLightGrey200,
color = AllInColorToken.allInLightGrey200,
style = AllInTheme.typography.p1,
fontSize = 12.sp
)
@ -60,9 +61,9 @@ private val AllInPlainTooltipContentPadding =
@Composable
fun AllInPlainTooltip(
modifier: Modifier = Modifier,
containerColor: Color = AllInTheme.colors.allInDark,
containerColor: Color = AllInColorToken.allInDark,
borderWidth: Dp = 1.dp,
borderColor: Color = AllInTheme.colors.allInDarkGrey100,
borderColor: Color = AllInColorToken.allInDarkGrey100,
shape: Shape = AbsoluteSmoothCornerShape(10.dp, 100),
content: @Composable () -> Unit,
) {
@ -120,7 +121,7 @@ private fun AllInTooltipPreview() {
AllInPlainTooltip(content = {
Text(
text = "Généralement une question qui sera répondu par les utilisateurs.",
color = AllInTheme.colors.allInLightGrey200,
color = AllInColorToken.allInLightGrey200,
style = AllInTheme.typography.p1,
fontSize = 10.sp
)

@ -21,6 +21,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -34,8 +35,8 @@ fun ProfilePicture(
Card(
modifier = modifier.size(size),
shape = shape,
colors = CardDefaults.cardColors(containerColor = AllInTheme.colors.allInDarkGrey100),
border = borderWidth?.let { BorderStroke(it, AllInTheme.colors.allInDarkGrey50) }
colors = CardDefaults.cardColors(containerColor = AllInColorToken.allInDarkGrey100),
border = borderWidth?.let { BorderStroke(it, AllInColorToken.allInDarkGrey50) }
) {
Box(Modifier.fillMaxSize()) {
image?.let {
@ -50,7 +51,7 @@ fun ProfilePicture(
} ?: run {
Icon(
imageVector = Icons.Default.PhotoCamera,
tint = AllInTheme.colors.white,
tint = AllInColorToken.white,
contentDescription = null,
modifier = Modifier
.align(Alignment.Center)

@ -11,6 +11,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -19,7 +20,7 @@ fun RainbowButton(
text: String,
onClick: () -> Unit,
enabled: Boolean = true,
rippleColor: Color = AllInTheme.colors.allInBlue,
rippleColor: Color = AllInColorToken.allInBlue,
) {
AllInRipple(rippleColor) {
AllInCard(
@ -32,11 +33,11 @@ fun RainbowButton(
with(AllInTheme.typography.h2) {
if (enabled) {
copy(
brush = AllInTheme.colors.allInTextGradient
brush = AllInColorToken.allInTextGradient
)
} else {
copy(
color = AllInTheme.themeColors.disabledBorder
color = AllInTheme.colors.disabledBorder
)
}
}

@ -19,14 +19,15 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
fun StatBar(
percentage: Float,
modifier: Modifier = Modifier,
leadingBrush: Brush = AllInTheme.colors.allInBar1stGradient,
trailingBrush: Brush = AllInTheme.colors.allInBar2ndGradient,
leadingBrush: Brush = AllInColorToken.allInBar1stGradient,
trailingBrush: Brush = AllInColorToken.allInBar2ndGradient,
icon: (@Composable () -> Unit)? = null,
) {
Box(modifier = modifier) {
@ -70,14 +71,14 @@ fun StatBar(
icon?.invoke() ?: when (percentage) {
0f -> Icon(
painter = painterResource(id = R.drawable.fire_solid),
tint = AllInTheme.colors.allInPink,
tint = AllInColorToken.allInPink,
contentDescription = null,
modifier = Modifier.size(32.dp)
)
1f -> Icon(
painter = painterResource(id = R.drawable.fire_solid),
tint = AllInTheme.colors.allInPurple,
tint = AllInColorToken.allInPurple,
contentDescription = null,
modifier = Modifier.size(32.dp)
)

@ -51,7 +51,7 @@ fun BetCard(
}
HorizontalDivider(
thickness = 1.dp,
color = AllInTheme.themeColors.border
color = AllInTheme.colors.border
)
content()
}

@ -13,6 +13,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -23,15 +24,15 @@ fun BetDateTimeChip(
Card(
modifier = modifier.wrapContentSize(),
shape = RoundedCornerShape(50),
border = BorderStroke(1.dp, AllInTheme.themeColors.border),
colors = CardDefaults.cardColors(containerColor = AllInTheme.themeColors.background)
border = BorderStroke(1.dp, AllInTheme.colors.border),
colors = CardDefaults.cardColors(containerColor = AllInTheme.colors.background)
) {
Text(
text = text,
modifier = Modifier.padding(vertical = 8.dp, horizontal = 16.dp),
style = AllInTheme.typography.sm1,
textAlign = TextAlign.Center,
color = AllInTheme.colors.allInPurple
color = AllInColorToken.allInPurple
)
}
}

@ -28,7 +28,7 @@ fun BetDateTimeRow(
text = label,
fontSize = 15.sp,
style = AllInTheme.typography.sm2,
color = AllInTheme.themeColors.onBackground2
color = AllInTheme.colors.onBackground2
)
BetDateTimeChip(date)
BetDateTimeChip(time)

@ -35,24 +35,24 @@ fun BetTitleHeader(
query = creator,
highlightStyle = SpanStyle(
fontWeight = FontWeight.Bold,
color = AllInTheme.themeColors.onMainSurface
color = AllInTheme.colors.onMainSurface
),
fontSize = 12.sp,
style = AllInTheme.typography.p2,
color = AllInTheme.themeColors.onBackground2
color = AllInTheme.colors.onBackground2
)
}
Spacer(modifier = Modifier.height(11.dp))
Text(
text = category,
fontSize = 15.sp,
color = AllInTheme.themeColors.onBackground2,
color = AllInTheme.colors.onBackground2,
style = AllInTheme.typography.sm2
)
Text(
text = title,
fontSize = 20.sp,
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
style = AllInTheme.typography.h1
)
}

@ -4,6 +4,7 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
@ -30,6 +31,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import androidx.compose.ui.unit.dp
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@OptIn(ExperimentalMaterial3Api::class)
@ -53,7 +55,9 @@ fun AllInSnackbar(
SwipeToDismissBox(
state = dismissState,
backgroundContent = {},
modifier = Modifier.padding(8.dp)
modifier = Modifier
.padding(vertical = 8.dp)
.navigationBarsPadding()
) {
val snackbarType = remember {
if (snackbarData.visuals is AllInSnackbarVisualsImpl) {
@ -65,7 +69,7 @@ fun AllInSnackbar(
AllInSnackbarContent(
backgroundColor = snackbarType.getBackgroundColor(),
contentColor = AllInTheme.colors.white,
contentColor = AllInColorToken.white,
text = snackbarData.visuals.message,
icon = snackbarType.getIcon(),
dismiss = { snackbarState.currentSnackbarData?.dismiss() }
@ -86,6 +90,7 @@ fun AllInSnackbarContent(
Surface(
shape = RoundedCornerShape(16.dp),
shadowElevation = 4.dp,
modifier = Modifier.padding(horizontal = 8.dp)
) {
Row(
verticalAlignment = Alignment.CenterVertically,
@ -138,7 +143,7 @@ private fun AllInSnackbarContentPreview(
AllInTheme {
AllInSnackbarContent(
backgroundColor = snackbarType.getBackgroundColor(),
contentColor = AllInTheme.colors.white,
contentColor = AllInColorToken.white,
text = "Lorem Ipsum",
icon = snackbarType.getIcon(),
dismiss = {}

@ -7,7 +7,7 @@ import androidx.compose.material.icons.filled.Info
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.ui.core.snackbar.SnackbarType.ERROR
import fr.iut.alldev.allin.ui.core.snackbar.SnackbarType.STANDARD
import fr.iut.alldev.allin.ui.core.snackbar.SnackbarType.SUCCESS
@ -21,9 +21,9 @@ enum class SnackbarType {
@Composable
fun SnackbarType.getBackgroundColor(): Color =
when (this) {
STANDARD -> AllInTheme.colors.allInDark
SUCCESS -> AllInTheme.colors.allInPurple
ERROR -> AllInTheme.colors.allInBetWaiting
STANDARD -> AllInColorToken.allInDark
SUCCESS -> AllInColorToken.allInPurple
ERROR -> AllInColorToken.allInBetWaiting
}
@Composable

@ -17,6 +17,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -25,7 +26,7 @@ fun AllInTopBar(
coinAmount: Int,
) {
TopAppBar(
modifier = Modifier.background(AllInTheme.colors.allInMainGradient),
modifier = Modifier.background(AllInColorToken.allInMainGradient),
colors = TopAppBarDefaults.topAppBarColors(
containerColor = Color.Transparent
),
@ -50,7 +51,7 @@ fun AllInTopBar(
Icon(
painter = AllInTheme.icons.logo(),
contentDescription = null,
tint = AllInTheme.colors.white,
tint = AllInColorToken.white,
modifier = Modifier
.size(40.dp)
.align(Alignment.Center)

@ -16,15 +16,16 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
fun AllInTopBarCoinCounter(
amount: Int,
modifier: Modifier = Modifier,
backgroundColor: Color = AllInTheme.colors.white,
textColor: Color = AllInTheme.colors.allInDark,
iconColor: Color = AllInTheme.colors.allInBlue,
backgroundColor: Color = AllInColorToken.white,
textColor: Color = AllInColorToken.allInDark,
iconColor: Color = AllInColorToken.allInBlue,
) {
Card(
modifier = modifier.wrapContentSize(),

@ -34,6 +34,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.hilt.navigation.compose.hiltViewModel
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInAlertDialog
import fr.iut.alldev.allin.ui.core.AllInGradientButton
@ -70,7 +71,7 @@ fun LoginScreen(
Box(
Modifier
.fillMaxSize()
.background(AllInTheme.themeColors.mainSurface)
.background(AllInTheme.colors.mainSurface)
.padding(horizontal = 44.dp)
.safeContentPadding()
.verticalScroll(rememberScrollState())
@ -81,7 +82,7 @@ fun LoginScreen(
Text(
modifier = Modifier.fillMaxWidth(),
text = stringResource(id = R.string.Login_title),
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
style = AllInTheme.typography.sm1,
textAlign = TextAlign.Center,
fontSize = 40.sp
@ -90,7 +91,7 @@ fun LoginScreen(
Text(
modifier = Modifier.fillMaxWidth(),
text = stringResource(id = R.string.Login_subtitle),
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
style = AllInTheme.typography.p1,
textAlign = TextAlign.Center,
fontSize = 23.sp
@ -120,7 +121,7 @@ fun LoginScreen(
ClickableText(
text = AnnotatedString(stringResource(id = R.string.forgot_password)),
style = AllInTheme.typography.sm2.copy(
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
fontSize = 15.sp,
),
modifier = Modifier
@ -151,7 +152,7 @@ fun LoginScreen(
) {
Text(
text = stringResource(id = R.string.no_account),
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
fontSize = 15.sp,
style = AllInTheme.typography.p1,
modifier = Modifier.padding(end = 5.dp)
@ -159,7 +160,7 @@ fun LoginScreen(
ClickableText(
text = AnnotatedString(stringResource(id = R.string.Register)),
style = AllInTheme.typography.p1.copy(
color = AllInTheme.colors.allInPurple,
color = AllInColorToken.allInPurple,
fontSize = 15.sp,
fontWeight = FontWeight.Bold
)

@ -26,6 +26,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import fr.iut.alldev.allin.data.model.bet.BetStatus
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.betStatus.BetStatusBottomSheet
import fr.iut.alldev.allin.ui.betStatus.vo.BetStatusBottomSheetBetDisplayer
@ -138,15 +139,22 @@ fun MainScreen(
modifier = Modifier
.padding(top = it.calculateTopPadding())
.fillMaxSize()
.background(AllInTheme.themeColors.mainSurface),
.background(AllInTheme.colors.mainSurface),
horizontalAlignment = Alignment.CenterHorizontally
) {
AllInDrawerNavHost(
navController = navController,
selectBet = { bet, participate ->
mainViewModel.openBetDetail(bet)
setParticipateSheetVisibility(participate)
setStatusVisibility(true)
mainViewModel.openBetDetail(bet) { detail ->
setStatusVisibility(true)
if (
detail.bet.betStatus == BetStatus.IN_PROGRESS &&
detail.userParticipation == null &&
detail.bet.creator != currentUser?.username
) {
setParticipateSheetVisibility(participate)
}
}
},
setLoading = setLoading,
putSnackbarContent = { mainViewModel.putSnackbarContent(it) }
@ -175,7 +183,9 @@ fun MainScreen(
sheetBackVisibility = sheetBackVisibility.value,
onDismiss = { setStatusVisibility(false) },
betDetail = selectedBet,
displayBet = { betStatusDisplayer.DisplayBet(it) },
displayBet = { detail ->
currentUser?.let { user -> betStatusDisplayer.DisplayBet(betDetail = detail, currentUser = user) }
},
userCoinAmount = userCoins ?: 0,
onParticipate = { stake, response -> mainViewModel.participateToBet(stake, response) },
participateSheetVisibility = participateSheetVisibility,

@ -76,9 +76,11 @@ class MainViewModel @Inject constructor(
}
}
fun openBetDetail(bet: Bet) {
fun openBetDetail(bet: Bet, onGetBet: (BetDetail) -> Unit) {
viewModelScope.launch {
selectedBet.value = betRepository.getBet(bet.id, keystoreManager.getTokenOrEmpty())
val betDetail = betRepository.getBet(bet.id, keystoreManager.getTokenOrEmpty())
selectedBet.value = betDetail
onGetBet(betDetail)
}
}

@ -83,7 +83,7 @@ fun AllInNavHost(
},
modifier = modifier
.fillMaxSize()
.background(AllInTheme.themeColors.mainSurface),
.background(AllInTheme.colors.mainSurface),
) {
allInSplashScreen(navController)
allInWelcomeScreen(navController)

@ -22,6 +22,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.navigation.TopLevelDestination
import fr.iut.alldev.allin.ui.navigation.drawer.components.DrawerCell
@ -47,7 +48,7 @@ fun AllInDrawer(
drawerContent = {
ModalDrawerSheet(
drawerShape = RectangleShape,
drawerContainerColor = AllInTheme.colors.allInDark
drawerContainerColor = AllInColorToken.allInDark
) {
DrawerHeader(
nbBets = nbBets,
@ -75,7 +76,7 @@ fun AllInDrawer(
Text(
text = stringResource(id = R.string.Logout),
style = AllInTheme.typography.sm1,
color = AllInTheme.colors.allInDarkGrey50,
color = AllInColorToken.allInDarkGrey50,
fontSize = 16.sp
)
}
@ -91,7 +92,7 @@ fun AllInDrawer(
Icon(
imageVector = Icons.Filled.Settings,
modifier = Modifier.size(40.dp),
tint = AllInTheme.colors.allInDarkGrey50,
tint = AllInColorToken.allInDarkGrey50,
contentDescription = null
)
}

@ -17,6 +17,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@OptIn(ExperimentalMaterial3Api::class)
@ -31,9 +32,9 @@ fun DrawerCell(
Card(
onClick = onClick,
modifier = modifier,
border = BorderStroke(width = 1.dp, color = AllInTheme.colors.allInDarkGrey50),
border = BorderStroke(width = 1.dp, color = AllInColorToken.allInDarkGrey50),
shape = RoundedCornerShape(20),
colors = CardDefaults.cardColors(containerColor = AllInTheme.colors.allInDarkGrey100)
colors = CardDefaults.cardColors(containerColor = AllInColorToken.allInDarkGrey100)
) {
Row(
modifier = Modifier.padding(horizontal = 10.dp, vertical = 17.dp),
@ -51,19 +52,19 @@ fun DrawerCell(
text = title,
style = AllInTheme.typography.h2,
fontSize = 13.sp,
color = AllInTheme.colors.white,
color = AllInColorToken.white,
fontWeight = FontWeight.W700
)
Text(
text = subtitle,
style = AllInTheme.typography.p1,
fontSize = 9.sp,
color = AllInTheme.colors.allInLightGrey300,
color = AllInColorToken.allInLightGrey300,
)
}
Icon(
imageVector = Icons.Default.ChevronRight,
tint = AllInTheme.colors.allInDarkGrey50,
tint = AllInColorToken.allInDarkGrey50,
contentDescription = null
)

@ -17,6 +17,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.ProfilePicture
@ -39,7 +40,7 @@ fun DrawerHeader(
Text(
text = username,
fontSize = 20.sp,
color = AllInTheme.colors.allInLightGrey200,
color = AllInColorToken.allInLightGrey200,
textAlign = TextAlign.Center,
style = AllInTheme.typography.h2,
)

@ -5,6 +5,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.tooling.preview.Preview
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -17,12 +18,12 @@ fun DrawerHeaderStat(
) {
Text(
text = value.toString(),
color = AllInTheme.colors.white,
color = AllInColorToken.white,
style = AllInTheme.typography.h1
)
Text(
text = label,
color = AllInTheme.colors.allInLightGrey300,
color = AllInColorToken.allInLightGrey300,
style = AllInTheme.typography.p1
)
}

@ -20,6 +20,7 @@ import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.data.model.User
import fr.iut.alldev.allin.ext.asPaddingValues
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
@Composable
@ -36,7 +37,7 @@ fun RankingScreenContent(
Text(
text = stringResource(id = R.string.ranking_title),
style = AllInTheme.typography.h1,
color = AllInTheme.colors.allInGrey,
color = AllInColorToken.allInGrey,
fontSize = 24.sp,
textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth()

@ -22,6 +22,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.zIndex
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInCard
import fr.iut.alldev.allin.ui.core.AllInCoinCount
@ -58,7 +59,7 @@ fun RankingScreenFirst(
Text(
text = username,
color = AllInTheme.themeColors.onBackground,
color = AllInTheme.colors.onBackground,
style = AllInTheme.typography.h1,
textAlign = TextAlign.Center,
maxLines = 2,
@ -68,18 +69,18 @@ fun RankingScreenFirst(
)
HorizontalDivider(color = AllInTheme.themeColors.border)
HorizontalDivider(color = AllInTheme.colors.border)
Box(
modifier = Modifier
.fillMaxWidth()
.background(AllInTheme.themeColors.background2)
.background(AllInTheme.colors.background2)
.padding(16.dp),
contentAlignment = Alignment.Center
) {
AllInCoinCount(
amount = coins,
color = AllInTheme.colors.allInPurple,
color = AllInColorToken.allInPurple,
size = 20
)
}
@ -97,13 +98,13 @@ fun RankingScreenFirst(
.padding(vertical = 55.dp)
.zIndex(500f)
.clip(CircleShape)
.background(AllInTheme.colors.allInPurple)
.background(AllInColorToken.allInPurple)
.size(30.dp),
contentAlignment = Alignment.Center
) {
Text(
text = "1",
color = AllInTheme.colors.white,
color = AllInColorToken.white,
style = AllInTheme.typography.h1,
fontSize = 20.sp,
modifier = Modifier.padding(4.dp)

@ -15,6 +15,7 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInCard
import fr.iut.alldev.allin.ui.core.AllInCoinCount
@ -40,7 +41,7 @@ fun RankingScreenItem(
Text(
text = "$position",
color = AllInTheme.colors.allInPurple,
color = AllInColorToken.allInPurple,
style = AllInTheme.typography.h1,
fontSize = 15.sp,
softWrap = false,
@ -53,7 +54,7 @@ fun RankingScreenItem(
Text(
text = username,
color = AllInTheme.themeColors.onBackground,
color = AllInTheme.colors.onBackground,
style = AllInTheme.typography.sm2,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
@ -63,7 +64,7 @@ fun RankingScreenItem(
AllInCoinCount(
amount = coins,
color = AllInTheme.colors.allInPurple
color = AllInColorToken.allInPurple
)
}
}

@ -22,6 +22,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.zIndex
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInCard
import fr.iut.alldev.allin.ui.core.AllInCoinCount
@ -58,7 +59,7 @@ fun RankingScreenSecond(
Text(
text = username,
color = AllInTheme.themeColors.onBackground,
color = AllInTheme.colors.onBackground,
style = AllInTheme.typography.h1,
textAlign = TextAlign.Center,
maxLines = 2,
@ -68,18 +69,18 @@ fun RankingScreenSecond(
)
HorizontalDivider(color = AllInTheme.themeColors.border)
HorizontalDivider(color = AllInTheme.colors.border)
Box(
modifier = Modifier
.fillMaxWidth()
.background(AllInTheme.themeColors.background2)
.background(AllInTheme.colors.background2)
.padding(16.dp),
contentAlignment = Alignment.Center
) {
AllInCoinCount(
amount = coins,
color = AllInTheme.colors.allInPurple,
color = AllInColorToken.allInPurple,
size = 20
)
}
@ -97,13 +98,13 @@ fun RankingScreenSecond(
.padding(vertical = 44.dp)
.zIndex(500f)
.clip(CircleShape)
.background(AllInTheme.colors.allInPurple)
.background(AllInColorToken.allInPurple)
.size(25.dp),
contentAlignment = Alignment.Center
) {
Text(
text = "2",
color = AllInTheme.colors.white,
color = AllInColorToken.white,
style = AllInTheme.typography.h1,
fontSize = 15.sp,
modifier = Modifier.padding(4.dp)

@ -34,6 +34,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.ext.asPaddingValues
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInGradientButton
import fr.iut.alldev.allin.ui.core.AllInLoading
@ -65,7 +66,7 @@ fun RegisterScreenContent(
Box(
Modifier
.fillMaxSize()
.background(AllInTheme.themeColors.mainSurface)
.background(AllInTheme.colors.mainSurface)
) {
LazyColumn(
verticalArrangement = Arrangement.Center,
@ -77,7 +78,7 @@ fun RegisterScreenContent(
.padding(top = 16.dp)
.fillMaxWidth(),
text = stringResource(id = R.string.Hello_x, username),
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
style = AllInTheme.typography.sm1,
textAlign = TextAlign.Center,
fontSize = 40.sp,
@ -87,7 +88,7 @@ fun RegisterScreenContent(
Text(
modifier = Modifier.fillMaxWidth(),
text = stringResource(id = R.string.Register_title),
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
style = AllInTheme.typography.sm1,
textAlign = TextAlign.Center,
fontSize = 40.sp
@ -96,7 +97,7 @@ fun RegisterScreenContent(
Text(
modifier = Modifier.fillMaxWidth(),
text = stringResource(id = R.string.Register_subtitle),
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
style = AllInTheme.typography.p1,
textAlign = TextAlign.Center,
fontSize = 23.sp
@ -155,7 +156,7 @@ fun RegisterScreenContent(
.background(
Brush.verticalGradient(
.2f to Color.Transparent,
.5f to AllInTheme.themeColors.background
.5f to AllInTheme.colors.background
)
)
.padding(40.dp)
@ -172,7 +173,7 @@ fun RegisterScreenContent(
) {
Text(
text = stringResource(id = R.string.already_have_account),
color = AllInTheme.themeColors.onMainSurface,
color = AllInTheme.colors.onMainSurface,
fontSize = 15.sp,
style = AllInTheme.typography.p1,
modifier = Modifier.padding(end = 5.dp)
@ -180,7 +181,7 @@ fun RegisterScreenContent(
ClickableText(
text = AnnotatedString(stringResource(id = R.string.Login)),
style = AllInTheme.typography.p1.copy(
color = AllInTheme.colors.allInPurple,
color = AllInColorToken.allInPurple,
fontSize = 15.sp,
fontWeight = FontWeight.Bold
)

@ -7,6 +7,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.Icon
@ -15,13 +16,13 @@ fun SplashScreenContent() {
Box(
modifier = Modifier
.fillMaxSize()
.background(AllInTheme.colors.allInLoginGradient),
.background(AllInColorToken.allInLoginGradient),
contentAlignment = Alignment.Center
) {
Icon(
painter = AllInTheme.icons.logo(),
contentDescription = null,
tint = AllInTheme.colors.white,
tint = AllInColorToken.white,
modifier = Modifier.fillMaxSize(.25f)
)
}

@ -27,6 +27,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import fr.iut.alldev.allin.R
import fr.iut.alldev.allin.theme.AllInColorToken
import fr.iut.alldev.allin.theme.AllInTheme
import fr.iut.alldev.allin.ui.core.AllInButton
@ -39,7 +40,7 @@ fun WelcomeScreenContent(
Modifier
.fillMaxWidth()
.fillMaxHeight(.5f)
.background(AllInTheme.colors.allInLoginGradient)
.background(AllInColorToken.allInLoginGradient)
)
Box(
Modifier
@ -47,7 +48,7 @@ fun WelcomeScreenContent(
.background(
Brush.verticalGradient(
.2f to Color.Transparent,
.5f to AllInTheme.themeColors.background
.5f to AllInTheme.colors.background
)
)
) {
@ -60,7 +61,7 @@ fun WelcomeScreenContent(
) {
Text(
text = stringResource(id = R.string.welcome_title),
color = AllInTheme.themeColors.onBackground,
color = AllInTheme.colors.onBackground,
fontSize = 30.sp,
style = AllInTheme.typography.h1
)
@ -68,22 +69,22 @@ fun WelcomeScreenContent(
text = stringResource(id = R.string.welcome_appname),
fontSize = 60.sp,
style = AllInTheme.typography.h1.copy(
brush = AllInTheme.colors.allInMainGradient
brush = AllInColorToken.allInMainGradient
)
)
Spacer(modifier = Modifier.height(43.dp))
Text(
text = stringResource(id = R.string.welcome_subtitle),
color = AllInTheme.themeColors.onBackground,
color = AllInTheme.colors.onBackground,
fontSize = 15.sp,
style = AllInTheme.typography.p1
)
Spacer(modifier = Modifier.height(78.dp))
AllInButton(
color = AllInTheme.themeColors.tint1,
color = AllInTheme.colors.tint1,
text = stringResource(id = R.string.join),
textColor = AllInTheme.themeColors.background,
textColor = AllInTheme.colors.background,
onClick = navigateToRegister,
modifier = Modifier.padding(bottom = 13.dp)
)
@ -94,7 +95,7 @@ fun WelcomeScreenContent(
) {
Text(
text = stringResource(id = R.string.already_have_account),
color = AllInTheme.themeColors.tint1,
color = AllInTheme.colors.tint1,
fontSize = 15.sp,
style = AllInTheme.typography.p1,
modifier = Modifier.padding(end = 5.dp)
@ -102,7 +103,7 @@ fun WelcomeScreenContent(
ClickableText(
text = AnnotatedString(stringResource(id = R.string.Login)),
style = AllInTheme.typography.p1.copy(
color = AllInTheme.themeColors.tint1,
color = AllInTheme.colors.tint1,
fontSize = 15.sp,
fontWeight = FontWeight.Bold
),

@ -1,6 +1,7 @@
package fr.iut.alldev.allin.vo.bet
import androidx.compose.runtime.Composable
import fr.iut.alldev.allin.data.model.User
import fr.iut.alldev.allin.data.model.bet.CustomBet
import fr.iut.alldev.allin.data.model.bet.MatchBet
import fr.iut.alldev.allin.data.model.bet.YesNoBet
@ -8,20 +9,20 @@ import fr.iut.alldev.allin.data.model.bet.vo.BetDetail
interface BetDisplayer {
@Composable
fun DisplayBet(betDetail: BetDetail) {
fun DisplayBet(betDetail: BetDetail, currentUser: User) {
when (betDetail.bet) {
is CustomBet -> DisplayCustomBet(betDetail)
is MatchBet -> DisplayMatchBet(betDetail)
is YesNoBet -> DisplayYesNoBet(betDetail)
is CustomBet -> DisplayCustomBet(betDetail, currentUser)
is MatchBet -> DisplayMatchBet(betDetail, currentUser)
is YesNoBet -> DisplayYesNoBet(betDetail, currentUser)
}
}
@Composable
fun DisplayYesNoBet(betDetail: BetDetail)
fun DisplayYesNoBet(betDetail: BetDetail, currentUser: User)
@Composable
fun DisplayMatchBet(betDetail: BetDetail)
fun DisplayMatchBet(betDetail: BetDetail, currentUser: User)
@Composable
fun DisplayCustomBet(betDetail: BetDetail)
fun DisplayCustomBet(betDetail: BetDetail, currentUser: User)
}

@ -74,7 +74,7 @@ class MockAllInApi : AllInApi {
response = body.response,
type = BetType.BINARY,
status = BetStatus.WAITING,
createdBy = ""
createdBy = getUserFromToken(token)?.first?.username ?: ""
)
)
}

Loading…
Cancel
Save