Skip to content

Commit

Permalink
Merge pull request #51 from TimerTiTi/50-log-screen
Browse files Browse the repository at this point in the history
close #50 log screen
  • Loading branch information
koreatlwls authored Feb 9, 2024
2 parents d4ac1f0 + 3fb0255 commit d9dedd5
Show file tree
Hide file tree
Showing 32 changed files with 1,938 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fun TdsCircularProgressIndicator(
text = sumTime.toString(),
textStyle = TdsTextStyle.SEMI_BOLD_TEXT_STYLE,
fontSize = fontSize,
color = TdsColor.BACKGROUND,
color = TdsColor.TEXT,
textAlign = TextAlign.Center,
overflow = TextOverflow.Ellipsis,
maxLines = 1,
Expand All @@ -71,7 +71,7 @@ private fun TdsCircularProgressIndicatorPreview() {
TdsCircularProgressIndicator(
modifier = Modifier
.size(110.dp)
.background(Color.Black),
.background(TdsColor.BACKGROUND.getColor()),
sumTime = 500,
maxTime = 1000,
color = TdsColor.D1.getColor(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.titi.app.core.designsystem.component

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.tooling.preview.Preview
import com.titi.app.core.designsystem.theme.TdsColor
import com.titi.app.core.designsystem.theme.TiTiTheme

@Composable
fun TdsColorRow(modifier: Modifier = Modifier, onClick: (Int) -> Unit) {
val tdsColors = listOf(
TdsColor.D1,
TdsColor.D2,
TdsColor.D3,
TdsColor.D4,
TdsColor.D5,
TdsColor.D6,
TdsColor.D7,
TdsColor.D8,
TdsColor.D9,
TdsColor.D11,
TdsColor.D12,
)

BoxWithConstraints(modifier = modifier) {
val width = maxWidth / 16

Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
) {
tdsColors.forEachIndexed { index, tdsColor ->
Box(
modifier = Modifier
.size(width)
.clip(RoundedCornerShape(width / 8))
.background(tdsColor.getColor())
.clickable { onClick(index) },
)
}
}
}
}

@Preview
@Composable
private fun TdsColorRowPreview() {
TiTiTheme {
TdsColorRow(modifier = Modifier.fillMaxWidth()) {
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package com.titi.app.core.designsystem.component

import android.content.res.Configuration
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.OutlinedCard
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.titi.app.core.designsystem.theme.TdsColor
import com.titi.app.core.designsystem.theme.TiTiTheme

@Composable
fun TdsFilledCard(modifier: Modifier = Modifier, content: @Composable () -> Unit) {
BoxWithConstraints(
modifier = modifier.padding(vertical = 10.dp),
contentAlignment = Alignment.Center,
) {
val width = if (maxWidth >= 365.dp) 345.dp else maxWidth - 20.dp

OutlinedCard(
modifier = Modifier
.width(width)
.wrapContentHeight(),
shape = RoundedCornerShape(25.dp),
colors = CardDefaults.cardColors(
containerColor = TdsColor.BACKGROUND.getColor(),
),
elevation = CardDefaults.outlinedCardElevation(
defaultElevation = 5.dp,
),
border = BorderStroke(
width = 3.dp,
TdsColor.SHADOW.getColor(),
),
) {
content()
}
}
}

@Composable
fun TdsCard(modifier: Modifier = Modifier, content: @Composable () -> Unit) {
OutlinedCard(
modifier = modifier,
shape = RoundedCornerShape(25.dp),
colors = CardDefaults.cardColors(
containerColor = TdsColor.BACKGROUND.getColor(),
),
elevation = CardDefaults.outlinedCardElevation(
defaultElevation = 5.dp,
),
border = BorderStroke(
width = 3.dp,
TdsColor.SHADOW.getColor(),
),
) {
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center,
) {
content()
}
}
}

@Preview
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun TdsFilledCardPreview() {
TiTiTheme {
TdsFilledCard(modifier = Modifier.fillMaxSize()) {
Box(modifier = Modifier.size(100.dp))
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.titi.app.core.designsystem.component

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
Expand All @@ -13,14 +14,15 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.OutlinedCard
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
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 com.titi.app.core.designsystem.extension.times
import com.titi.app.core.designsystem.model.TdsTaskData
import com.titi.app.core.designsystem.theme.TdsColor
import com.titi.app.core.designsystem.theme.TdsTextStyle
Expand All @@ -30,25 +32,32 @@ import com.titi.app.core.designsystem.util.getSumTime

@Composable
fun TdsStandardDailyGraph(
modifier: Modifier = Modifier,
todayDate: String,
todayDayOfTheWeek: Int,
tdsColors: List<TdsColor>,
timeLines: List<Int>,
taskData: List<TdsTaskData>,
) {
Box(
modifier = Modifier.size(365.dp),
BoxWithConstraints(
modifier = modifier.padding(vertical = 10.dp),
contentAlignment = Alignment.Center,
) {
Card(
val size = if (maxWidth >= 365.dp) 345.dp else maxWidth - 20.dp

OutlinedCard(
modifier = Modifier
.size(345.dp),
.size(size),
shape = RoundedCornerShape(25.dp),
colors = CardDefaults.cardColors(containerColor = TdsColor.BACKGROUND.getColor()),
elevation = CardDefaults.outlinedCardElevation(defaultElevation = 10.dp),
elevation = CardDefaults.outlinedCardElevation(defaultElevation = 5.dp),
border = BorderStroke(
width = 3.dp,
TdsColor.SHADOW.getColor(),
),
) {
Column(
modifier = Modifier.padding(10.dp),
modifier = Modifier.padding(13.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Row(
Expand Down Expand Up @@ -103,7 +112,7 @@ fun TdsStandardDailyGraph(
TdsTaskResultList(
modifier = Modifier
.fillMaxHeight()
.width(215.dp)
.width(size * 0.6)
.border(
width = 2.dp,
color = TdsColor.GRAPH_BORDER.getColor(),
Expand Down Expand Up @@ -201,6 +210,7 @@ private fun TdsStandardDailyGraphPreview() {

TiTiTheme {
TdsStandardDailyGraph(
modifier = Modifier.fillMaxWidth(),
todayDate = "2024.02.04",
todayDayOfTheWeek = 6,
tdsColors = listOf(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.titi.app.core.designsystem.component

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
Expand All @@ -14,8 +15,8 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.OutlinedCard
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand All @@ -24,6 +25,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.titi.app.core.designsystem.extension.getTimeString
import com.titi.app.core.designsystem.extension.getWeekInformation
import com.titi.app.core.designsystem.extension.times
import com.titi.app.core.designsystem.model.TdsTaskData
import com.titi.app.core.designsystem.model.TdsWeekLineChartData
import com.titi.app.core.designsystem.theme.TdsColor
Expand All @@ -36,26 +38,33 @@ import org.threeten.bp.ZonedDateTime

@Composable
fun TdsStandardWeekGraph(
modifier: Modifier = Modifier,
todayDateTime: ZonedDateTime,
weekLineChardData: List<TdsWeekLineChartData>,
tdsColors: List<TdsColor>,
taskData: List<TdsTaskData>,
) {
val weekInformation = todayDateTime.getWeekInformation()

Box(
modifier = Modifier.size(365.dp),
BoxWithConstraints(
modifier = modifier.padding(vertical = 10.dp),
contentAlignment = Alignment.Center,
) {
Card(
val size = if (maxWidth >= 365.dp) 345.dp else maxWidth - 20.dp

OutlinedCard(
modifier = Modifier
.size(345.dp),
.size(size),
shape = RoundedCornerShape(25.dp),
colors = CardDefaults.cardColors(containerColor = TdsColor.BACKGROUND.getColor()),
elevation = CardDefaults.outlinedCardElevation(defaultElevation = 10.dp),
elevation = CardDefaults.outlinedCardElevation(defaultElevation = 5.dp),
border = BorderStroke(
width = 3.dp,
TdsColor.SHADOW.getColor(),
),
) {
Column(
modifier = Modifier.padding(10.dp),
modifier = Modifier.padding(13.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Row(
Expand Down Expand Up @@ -102,7 +111,7 @@ fun TdsStandardWeekGraph(
) {
TdsWeekLineChart(
modifier = Modifier
.width(225.dp)
.width(size * 0.6)
.fillMaxHeight(),
weekLineChardData = weekLineChardData,
startColor = tdsColors.first().getColor(),
Expand Down Expand Up @@ -154,7 +163,7 @@ fun TdsStandardWeekGraph(
TdsTaskResultList(
modifier = Modifier
.fillMaxHeight()
.width(215.dp)
.width(size * 0.6)
.border(
width = 2.dp,
color = TdsColor.GRAPH_BORDER.getColor(),
Expand Down Expand Up @@ -237,6 +246,7 @@ private fun TdsStandardWeekGraphPreview() {

TiTiTheme {
TdsStandardWeekGraph(
modifier = Modifier.fillMaxWidth(),
todayDateTime = ZonedDateTime.now(ZoneOffset.UTC),
weekLineChardData = listOf(
TdsWeekLineChartData(
Expand Down
Loading

0 comments on commit d9dedd5

Please sign in to comment.