Skip to content

Commit 986a702

Browse files
committed
Move event search navigation to bottom scaffold and move navigation icon into EventRow
1 parent 3804e61 commit 986a702

File tree

3 files changed

+98
-92
lines changed

3 files changed

+98
-92
lines changed

app/src/main/java/com/sunkensplashstudios/VRCRoboScout/FavoritesView.kt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -251,18 +251,7 @@ fun FavoritesView(favoritesViewModel: FavoritesViewModel = viewModels["favorites
251251
}
252252
) {
253253
val event = favoritesViewModel.eventSKUMap[sku] ?: Event(sku, false)
254-
Row(
255-
verticalAlignment = Alignment.CenterVertically
256-
) {
257-
EventRow(navController, event)
258-
}
259-
Spacer(modifier = Modifier.weight(1.0f))
260-
Icon(
261-
Icons.AutoMirrored.Filled.ArrowForwardIos,
262-
modifier = Modifier.size(15.dp),
263-
tint = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.3f),
264-
contentDescription = "Show Event"
265-
)
254+
EventRow(navController, event)
266255
}
267256
if (favoriteEvents.sortedBy {
268257
favoritesViewModel.eventSKUMap[it]?.startDate

app/src/main/java/com/sunkensplashstudios/VRCRoboScout/LookupView.kt

Lines changed: 50 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,56 @@ fun LookupView(lookupViewModel: LookupViewModel = viewModels["lookup_view"] as L
202202
Text("Lookup", fontWeight = FontWeight.Bold)
203203
}
204204
)
205+
},
206+
bottomBar = {
207+
if (lookupViewModel.lookupType.value != "Teams") {
208+
Row(
209+
horizontalArrangement = Arrangement.Center,
210+
verticalAlignment = Alignment.CenterVertically,
211+
modifier = Modifier
212+
.padding(horizontal = 20.dp)
213+
.fillMaxWidth()
214+
) {
215+
IconButton(
216+
enabled = lookupViewModel.page.intValue != 1,
217+
onClick = {
218+
lookupViewModel.page.intValue -= 1
219+
lookupViewModel.fetchEvents(
220+
name = lookupViewModel.eventName.value,
221+
page = lookupViewModel.page.intValue
222+
)
223+
}) {
224+
Icon(
225+
Icons.AutoMirrored.Filled.ArrowBackIos,
226+
contentDescription = "Previous Page",
227+
modifier = Modifier.width(30.dp),
228+
tint = if (lookupViewModel.page.intValue != 1) MaterialTheme.colorScheme.button else Color.Gray
229+
)
230+
}
231+
Text(
232+
"${lookupViewModel.page.intValue}",
233+
modifier = Modifier.padding(horizontal = 20.dp),
234+
fontSize = 25.sp,
235+
textAlign = TextAlign.Center
236+
)
237+
IconButton(
238+
enabled = lookupViewModel.events.value.size == 20,
239+
onClick = {
240+
lookupViewModel.page.intValue += 1
241+
lookupViewModel.fetchEvents(
242+
name = lookupViewModel.eventName.value,
243+
page = lookupViewModel.page.intValue
244+
)
245+
}) {
246+
Icon(
247+
Icons.AutoMirrored.Filled.ArrowForwardIos,
248+
contentDescription = "Next Page",
249+
modifier = Modifier.width(30.dp),
250+
tint = if (lookupViewModel.events.value.size == 20) MaterialTheme.colorScheme.button else Color.Gray
251+
)
252+
}
253+
}
254+
}
205255
}
206256
) { padding ->
207257
Column(
@@ -720,52 +770,6 @@ fun EventLookup(lookupViewModel: LookupViewModel, navController: NavController)
720770
}
721771
}
722772
}
723-
Row(
724-
horizontalArrangement = Arrangement.Center,
725-
verticalAlignment = Alignment.CenterVertically,
726-
modifier = Modifier
727-
.padding(horizontal = 20.dp)
728-
.fillMaxWidth()
729-
) {
730-
IconButton(
731-
enabled = lookupViewModel.page.intValue != 1,
732-
onClick = {
733-
lookupViewModel.page.intValue -= 1
734-
lookupViewModel.fetchEvents(
735-
name = lookupViewModel.eventName.value,
736-
page = lookupViewModel.page.intValue
737-
)
738-
}) {
739-
Icon(
740-
Icons.AutoMirrored.Filled.ArrowBackIos,
741-
contentDescription = "Previous Page",
742-
modifier = Modifier.size(30.dp),
743-
tint = if (lookupViewModel.page.intValue != 1) MaterialTheme.colorScheme.button else Color.Gray
744-
)
745-
}
746-
Text(
747-
"${lookupViewModel.page.intValue}",
748-
modifier = Modifier.padding(horizontal = 20.dp),
749-
fontSize = 25.sp,
750-
textAlign = TextAlign.Center
751-
)
752-
IconButton(
753-
enabled = lookupViewModel.events.value.size == 20,
754-
onClick = {
755-
lookupViewModel.page.intValue += 1
756-
lookupViewModel.fetchEvents(
757-
name = lookupViewModel.eventName.value,
758-
page = lookupViewModel.page.intValue
759-
)
760-
}) {
761-
Icon(
762-
Icons.AutoMirrored.Filled.ArrowForwardIos,
763-
contentDescription = "Next Page",
764-
modifier = Modifier.size(30.dp),
765-
tint = if (lookupViewModel.events.value.size == 20) MaterialTheme.colorScheme.button else Color.Gray
766-
)
767-
}
768-
}
769773
}
770774
}
771775
}

app/src/main/java/com/sunkensplashstudios/VRCRoboScout/helperviews/EventRow.kt

Lines changed: 47 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import androidx.compose.material3.Icon
1313
import androidx.compose.material3.MaterialTheme
1414
import androidx.compose.material3.Text
1515
import androidx.compose.runtime.Composable
16+
import androidx.compose.ui.Alignment
1617
import androidx.compose.ui.Modifier
1718
import androidx.compose.ui.text.style.TextOverflow
1819
import androidx.compose.ui.unit.dp
@@ -25,47 +26,59 @@ import com.sunkensplashstudios.VRCRoboScout.Team
2526

2627
@Composable
2728
fun EventRow(navController: NavController, event: Event, team: Team? = null, ) {
28-
Column(
29-
verticalArrangement = Arrangement.SpaceBetween,
30-
modifier = Modifier
31-
.padding(5.dp)
32-
.clickable {
33-
navController.navigate(
34-
if (team != null) com.sunkensplashstudios.VRCRoboScout.destinations.EventViewDestination(event, team)
35-
else com.sunkensplashstudios.VRCRoboScout.destinations.EventViewDestination(event)
36-
)
37-
}
29+
30+
Row(
31+
verticalAlignment = Alignment.CenterVertically
3832
) {
39-
Row(
40-
verticalAlignment = androidx.compose.ui.Alignment.CenterVertically
33+
Column(
34+
verticalArrangement = Arrangement.SpaceBetween,
35+
modifier = Modifier
36+
.padding(5.dp)
37+
.clickable {
38+
navController.navigate(
39+
if (team != null) com.sunkensplashstudios.VRCRoboScout.destinations.EventViewDestination(event, team)
40+
else com.sunkensplashstudios.VRCRoboScout.destinations.EventViewDestination(event)
41+
)
42+
}
4143
) {
42-
Column(
43-
modifier = Modifier.weight(1.0f)
44+
Row(
45+
verticalAlignment = Alignment.CenterVertically
4446
) {
45-
Text(
46-
event.name,
47-
maxLines = 1,
48-
overflow = TextOverflow.Ellipsis
49-
)
50-
Row {
51-
Text(
52-
event.location.toString(),
53-
fontSize = 13.sp
54-
)
55-
Spacer(modifier = Modifier.weight(1.0f))
47+
Column(
48+
modifier = Modifier.weight(1.0f)
49+
) {
5650
Text(
57-
RoboScoutAPI.formatDate(event.startDate),
58-
fontSize = 13.sp
51+
event.name,
52+
maxLines = 1,
53+
overflow = TextOverflow.Ellipsis
5954
)
55+
Row {
56+
Text(
57+
event.location.toString(),
58+
fontSize = 11.sp
59+
)
60+
Spacer(modifier = Modifier.weight(1.0f))
61+
Text(
62+
RoboScoutAPI.formatDate(event.startDate),
63+
fontSize = 11.sp
64+
)
65+
}
6066
}
67+
Spacer(modifier = Modifier.padding(horizontal = 5.dp))
68+
Icon(
69+
Icons.AutoMirrored.Filled.ArrowForwardIos,
70+
modifier = Modifier.size(15.dp),
71+
tint = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.3f),
72+
contentDescription = "Show Events"
73+
)
6174
}
62-
Spacer(modifier = Modifier.padding(horizontal = 5.dp))
63-
Icon(
64-
Icons.AutoMirrored.Filled.ArrowForwardIos,
65-
modifier = Modifier.size(15.dp),
66-
tint = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.3f),
67-
contentDescription = "Show Events"
68-
)
6975
}
76+
Spacer(modifier = Modifier.weight(1.0f))
77+
Icon(
78+
Icons.AutoMirrored.Filled.ArrowForwardIos,
79+
modifier = Modifier.size(15.dp),
80+
tint = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.3f),
81+
contentDescription = "Show Event"
82+
)
7083
}
7184
}

0 commit comments

Comments
 (0)