@@ -2,7 +2,6 @@ package com.cornellappdev.uplift.ui.components.profile.workouts
22
33import androidx.compose.foundation.Image
44import androidx.compose.foundation.layout.Arrangement
5- import androidx.compose.foundation.layout.Box
65import androidx.compose.foundation.layout.Column
76import androidx.compose.foundation.layout.Row
87import androidx.compose.foundation.layout.Spacer
@@ -18,7 +17,6 @@ import androidx.compose.material3.Text
1817import androidx.compose.runtime.Composable
1918import androidx.compose.ui.Alignment
2019import androidx.compose.ui.Modifier
21- import androidx.compose.ui.focus.focusModifier
2220import androidx.compose.ui.graphics.Color
2321import androidx.compose.ui.res.painterResource
2422import androidx.compose.ui.text.font.FontWeight
@@ -28,16 +26,17 @@ import androidx.compose.ui.unit.sp
2826import com.cornellappdev.uplift.R
2927import com.cornellappdev.uplift.ui.components.profile.SectionTitleText
3028import com.cornellappdev.uplift.util.GRAY01
29+ import com.cornellappdev.uplift.util.GRAY04
30+ import com.cornellappdev.uplift.util.PRIMARY_BLACK
3131import com.cornellappdev.uplift.util.montserratFamily
32- import com.cornellappdev.uplift.util.timeAgoString
33- import java.util.Calendar
3432
3533data class HistoryItem (
3634 val gymName : String ,
3735 val time : String ,
3836 val date : String ,
3937 val timestamp : Long ,
40- val ago : String
38+ val ago : String ,
39+ val shortDate : String
4140)
4241
4342@Composable
@@ -68,22 +67,22 @@ fun HistorySection(
6867}
6968
7069@Composable
71- private fun HistoryList (
70+ fun HistoryList (
7271 historyItems : List <HistoryItem >,
7372 modifier : Modifier = Modifier
7473) {
7574 Column (modifier = modifier) {
7675 historyItems.take(5 ).forEachIndexed { index, historyItem ->
7776 HistoryItemRow (historyItem = historyItem)
7877 if (index != historyItems.size - 1 ) {
79- HorizontalDivider (color = GRAY01 )
78+ HorizontalDivider (color = GRAY01 , thickness = 1 .dp )
8079 }
8180 }
8281 }
8382}
8483
8584@Composable
86- private fun HistoryItemRow (
85+ fun HistoryItemRow (
8786 historyItem : HistoryItem
8887) {
8988 val gymName = historyItem.gymName
@@ -94,23 +93,28 @@ private fun HistoryItemRow(
9493 Row (
9594 modifier = Modifier
9695 .fillMaxWidth()
96+ .height(60 .dp)
9797 .padding(vertical = 12 .dp),
98- horizontalArrangement = Arrangement .SpaceBetween
98+ horizontalArrangement = Arrangement .SpaceBetween ,
99+ verticalAlignment = Alignment .Bottom
99100 ) {
100- Column (){
101+ Column (
102+ modifier = Modifier .weight(1f ),
103+ verticalArrangement = Arrangement .spacedBy(4 .dp)
104+ ){
101105 Text (
102106 text = gymName,
103107 fontFamily = montserratFamily,
104- fontSize = 14 .sp,
108+ fontSize = 12 .sp,
105109 fontWeight = FontWeight .Medium ,
106- color = Color . Black
110+ color = PRIMARY_BLACK
107111 )
108112 Text (
109113 text = " $date · $time " ,
110114 fontFamily = montserratFamily,
111115 fontSize = 12 .sp,
112- fontWeight = FontWeight .Light ,
113- color = Color . Gray
116+ fontWeight = FontWeight .Medium ,
117+ color = GRAY04
114118 )
115119 }
116120 Text (
@@ -124,7 +128,7 @@ private fun HistoryItemRow(
124128}
125129
126130@Composable
127- private fun EmptyHistorySection (){
131+ fun EmptyHistorySection (){
128132 Column (
129133 modifier = Modifier .fillMaxSize(),
130134 verticalArrangement = Arrangement .Center ,
@@ -161,11 +165,11 @@ private fun EmptyHistorySection(){
161165private fun HistorySectionPreview () {
162166 val now = System .currentTimeMillis()
163167 val historyItems = listOf (
164- HistoryItem (" Morrison" , " 11:00 PM" , " March 29, 2024" , now - (1 * 24 * 60 * 60 * 1000 ), " 1 day ago" ),
165- HistoryItem (" Noyes" , " 1:00 PM" , " March 29, 2024" , now - (3 * 24 * 60 * 60 * 1000 ), " 2 days ago" ),
166- HistoryItem (" Teagle Up" , " 2:00 PM" , " March 29, 2024" , now - (7 * 24 * 60 * 60 * 1000 ), " 1 day ago" ),
167- HistoryItem (" Teagle Down" , " 12:00 PM" , " March 29, 2024" , now - (15 * 24 * 60 * 60 * 1000 ), " 1 day ago" ),
168- HistoryItem (" Helen Newman" , " 10:00 AM" , " March 29, 2024" , now, " Today" ),
168+ HistoryItem (" Morrison" , " 11:00 PM" , " March 29, 2024" , now - (1 * 24 * 60 * 60 * 1000 ), " 1 day ago" , " Mar 28 " ),
169+ HistoryItem (" Noyes" , " 1:00 PM" , " March 29, 2024" , now - (3 * 24 * 60 * 60 * 1000 ), " 2 days ago" , " Mar 26 " ),
170+ HistoryItem (" Teagle Up" , " 2:00 PM" , " March 29, 2024" , now - (7 * 24 * 60 * 60 * 1000 ), " 1 week ago" , " Mar 22 " ),
171+ HistoryItem (" Teagle Down" , " 12:00 PM" , " March 29, 2024" , now - (15 * 24 * 60 * 60 * 1000 ), " 2 weeks ago" , " Mar 14 " ),
172+ HistoryItem (" Helen Newman" , " 10:00 AM" , " March 29, 2024" , now, " Today" , " Mar 29 " ),
169173 )
170174 Column (
171175 modifier = Modifier
@@ -178,4 +182,4 @@ private fun HistorySectionPreview() {
178182 )
179183 }
180184
181- }
185+ }
0 commit comments