Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
56670b0
downloaded filter icon, created divider when viewing favorites, creat…
RyanCheung555 Feb 7, 2026
db041a6
Updated filter icon file
RyanCheung555 Feb 7, 2026
e95dbca
Added vector asset for filter icon
RyanCheung555 Feb 7, 2026
892ac11
Added a call to filter button from ecosystem bottom sheet content, an…
RyanCheung555 Feb 7, 2026
074e75b
feat: create simple vers of filter bottom sheet w/ header/footer
RyanCheung555 Feb 8, 2026
a71f3af
refactor: let viewmodel handle state for fav filter button/sheet
RyanCheung555 Feb 8, 2026
3b3d8d1
fix: use correct color for filter button text
RyanCheung555 Feb 9, 2026
1df94ec
feat: Create grid for filters in favorite filter sheet
RyanCheung555 Feb 9, 2026
c90d948
Add border and background changing functionality when filter item is …
RyanCheung555 Feb 10, 2026
74a29ad
fix: rename FilterSheetState to FavoritesFilterSheetState for clarity
RyanCheung555 Feb 11, 2026
ece224d
fix: rename other FilterBottomSheet components to FavoritesFilterShee…
RyanCheung555 Feb 11, 2026
8845964
refactor: rename FavoritesFilterBottomSheet files to reflect the name…
RyanCheung555 Feb 12, 2026
57ed6cd
feat: add correct icons for filter bottom sheet
RyanCheung555 Feb 18, 2026
b1c41ec
feat: create reusable color for highlighted backgrounds
RyanCheung555 Feb 18, 2026
4ac9ec8
fix: use icon instead of image + fix formatting issues to fit designs
RyanCheung555 Feb 18, 2026
b36124e
fix: move clickable modifier in front of padding for more accurate cl…
RyanCheung555 Feb 18, 2026
04f9007
chore: remove unused imports
RyanCheung555 Feb 18, 2026
46a5370
fix: adjust button spacing and sync with main
RyanCheung555 Feb 18, 2026
903c2e1
fix: change padding values to match design, and refactor how padding …
RyanCheung555 Feb 18, 2026
072e774
fix: move filter logic to HomeViewModel and add filter labels
RyanCheung555 Feb 18, 2026
7d807bb
feat: make filter labels on par with design and include close functio…
RyanCheung555 Feb 18, 2026
b182f14
fix: make formatting closer to design
RyanCheung555 Feb 18, 2026
2259ebd
chore: fix formatting and naming, as well as remove unused imports
RyanCheung555 Feb 18, 2026
6924f02
fix: add spacer for separation between filter labels and column of cards
RyanCheung555 Feb 18, 2026
c9a6192
fix: adjust padding value for list of favorites
RyanCheung555 Feb 22, 2026
727a0e0
fix: use correct color for horizontal divider
RyanCheung555 Feb 22, 2026
cb090b2
chore: remove unused line and import
RyanCheung555 Feb 23, 2026
6962eaf
fix: add preview function and adjust how padding is handled
RyanCheung555 Feb 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file modified app/.DS_Store
Binary file not shown.
Binary file added app/src/.DS_Store
Binary file not shown.
Binary file added app/src/main/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.cornellappdev.transit.ui.components.home

import android.R.attr.text
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import is unused and should be removed. The text variable is not referenced anywhere in the file.

Suggested change
import android.R.attr.text

Copilot uses AI. Check for mistakes.
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
Expand Down Expand Up @@ -35,7 +36,7 @@ fun AddFavoritesButton(
),
modifier = modifier
.fillMaxWidth()
.height(40.dp)
.height(40.dp),
) {

Icon(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.cornellappdev.transit.ui.components.home

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
Expand All @@ -12,8 +13,12 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.AnnotatedString
Expand All @@ -22,13 +27,15 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.cornellappdev.transit.R
import com.cornellappdev.transit.models.Place
import com.cornellappdev.transit.models.ecosystem.DayOperatingHours
import com.cornellappdev.transit.models.ecosystem.DetailedEcosystemPlace
import com.cornellappdev.transit.models.ecosystem.Eatery
import com.cornellappdev.transit.models.ecosystem.StaticPlaces
import com.cornellappdev.transit.networking.ApiResponse
import com.cornellappdev.transit.ui.theme.FavoritesDividerGray
import com.cornellappdev.transit.ui.theme.robotoFamily
import com.cornellappdev.transit.ui.viewmodels.FilterState
import com.cornellappdev.transit.ui.viewmodels.HomeViewModel
Expand All @@ -43,6 +50,7 @@ import com.cornellappdev.transit.util.ecosystem.toPlace
* @param staticPlaces Collection of all places to populate filters with
* @param navigateToPlace Function called to navigate to route options
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun EcosystemBottomSheetContent(
filters: List<FilterState>,
Expand All @@ -54,7 +62,10 @@ fun EcosystemBottomSheetContent(
navigateToPlace: (Place) -> Unit,
onDetailsClick: (DetailedEcosystemPlace) -> Unit,
onFavoriteStarClick: (Place) -> Unit,
showFilterSheet: Boolean,
onFilterSheetShow: () -> Unit,
onAddFavoritesClick: () -> Unit,
homeViewModel: HomeViewModel = hiltViewModel(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't be passing view models to composables, they should ideally only be used on the screen composable. You should just add whatever fields or functions you need from the vm to this composable as parameters

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are too many parameters, you can consider grouping some together into a data class

) {
Column(modifier = modifier) {
Row(
Expand All @@ -76,7 +87,7 @@ fun EcosystemBottomSheetContent(
)
}

LazyRow {
LazyRow(modifier = Modifier.padding(bottom = 12.dp)) {
items(filters) {
BottomSheetFilterItem(
imageResId = it.iconId,
Expand All @@ -95,9 +106,35 @@ fun EcosystemBottomSheetContent(
navigateToPlace = navigateToPlace,
onDetailsClick = onDetailsClick,
onFavoriteStarClick = onFavoriteStarClick,
onFilterButtonClick = onFilterSheetShow,
onAddFavoritesClick = onAddFavoritesClick
)
}

val selectedFilters by homeViewModel.selectedFavoritesFilters.collectAsStateWithLifecycle()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above comment, but this should be passed in instead of using the home vm here


if (showFilterSheet) {
ModalBottomSheet(
onDismissRequest = {
homeViewModel.cancelFavoritesFilters()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above for all functions you are using from home view model

},
dragHandle = null
) {
FavoritesFilterBottomSheet(
onCancelClicked = {
homeViewModel.cancelFavoritesFilters()
},
onApplyClicked = {
homeViewModel.applyFavoritesFilters()
},
filters = homeViewModel.favoritesFilterList,
selectedFilters = selectedFilters,
onFilterToggle = { filter ->
homeViewModel.toggleFavoritesFilter(filter)
}
)
}
}
}

@Composable
Expand All @@ -109,43 +146,74 @@ private fun BottomSheetFilteredContent(
navigateToPlace: (Place) -> Unit,
onDetailsClick: (DetailedEcosystemPlace) -> Unit,
onFavoriteStarClick: (Place) -> Unit,
onAddFavoritesClick: () -> Unit
onAddFavoritesClick: () -> Unit,
onFilterButtonClick: () -> Unit
) {
LazyColumn(
contentPadding = PaddingValues(start = 24.dp, end = 24.dp, top = 20.dp, bottom = 90.dp),
modifier = Modifier.fillMaxSize()
) {
when (currentFilter) {
FilterState.FAVORITES -> {
favoriteList(favorites, navigateToPlace, onAddFavoritesClick)
val appliedFilters by homeViewModel.appliedFavoritesFilters.collectAsStateWithLifecycle()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Column {
if (currentFilter == FilterState.FAVORITES) {
Column(modifier = Modifier.padding(horizontal = 12.dp)) {
HorizontalDivider(
modifier = Modifier.padding(vertical = 8.dp),
color = FavoritesDividerGray
)
FilterRow(
selectedFilters = appliedFilters,
onFilterClick = onFilterButtonClick,
onRemoveFilter = { filter -> homeViewModel.removeAppliedFilter(filter) }
)
if (appliedFilters.isNotEmpty()) {
Spacer(modifier = Modifier.height(8.dp))
}
}
}
val isFilterBarHidden = currentFilter == FilterState.FAVORITES && appliedFilters.isEmpty()
Copy link
Member

@AndrewCheung360 AndrewCheung360 Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: might be worth abstracting to vm or using some sort of derived value from the data class

LazyColumn(
contentPadding = PaddingValues(
start = 12.dp,
end = 12.dp,
top = if (isFilterBarHidden) 0.dp else 8.dp,
bottom = 120.dp // Makes bottom content visible with padding at the end
),
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.spacedBy(20.dp)
) {
when (currentFilter) {
FilterState.FAVORITES -> {
favoriteList(
favorites,
navigateToPlace,
onAddFavoritesClick
)
}

FilterState.PRINTERS -> {
printerList(staticPlaces, navigateToPlace)
}
FilterState.PRINTERS -> {
printerList(staticPlaces, navigateToPlace)
}

FilterState.GYMS -> {
gymList(staticPlaces, navigateToPlace)
}
FilterState.GYMS -> {
gymList(staticPlaces, navigateToPlace)
}

FilterState.EATERIES -> {
eateryList(
eateriesApiResponse = staticPlaces.eateries,
onDetailsClick = onDetailsClick,
favorites = favorites,
onFavoriteStarClick = onFavoriteStarClick,
operatingHoursToString = homeViewModel::isOpenAnnotatedStringFromOperatingHours
)
}
FilterState.EATERIES -> {
eateryList(
eateriesApiResponse = staticPlaces.eateries,
onDetailsClick = onDetailsClick,
favorites = favorites,
onFavoriteStarClick = onFavoriteStarClick,
operatingHoursToString = homeViewModel::isOpenAnnotatedStringFromOperatingHours
)
}

FilterState.LIBRARIES -> {
libraryList(
staticPlaces,
navigateToPlace,
onDetailsClick,
favorites,
onFavoriteStarClick,
)
FilterState.LIBRARIES -> {
libraryList(
staticPlaces,
navigateToPlace,
onDetailsClick,
favorites,
onFavoriteStarClick,
)
}
}
}
}
Expand All @@ -160,8 +228,8 @@ private fun LazyListScope.favoriteList(
onAddFavoritesClick: () -> Unit
) {
item {
Spacer(modifier = Modifier.height(8.dp))
AddFavoritesButton(onAddFavoritesClick = onAddFavoritesClick)
Spacer(Modifier.height(20.dp))
}
items(favorites.toList()) {
BottomSheetLocationCard(
Expand All @@ -170,7 +238,6 @@ private fun LazyListScope.favoriteList(
) {
//TODO: Eatery
}
Spacer(Modifier.height(10.dp))
}
}

Expand All @@ -196,7 +263,6 @@ private fun LazyListScope.gymList(
) {
//TODO: Eatery
}
Spacer(Modifier.height(10.dp))
}

}
Expand Down Expand Up @@ -271,7 +337,6 @@ private fun LazyListScope.eateryList(
) {
onDetailsClick(it)
}
Spacer(Modifier.height(10.dp))
}
}
}
Expand Down Expand Up @@ -307,7 +372,6 @@ private fun LazyListScope.libraryList(
) {
navigateToDetails(it)
}
Spacer(Modifier.height(10.dp))
}
}
}
Expand Down Expand Up @@ -337,6 +401,8 @@ private fun PreviewEcosystemBottomSheet() {
navigateToPlace = {},
onDetailsClick = {},
onFavoriteStarClick = {},
onAddFavoritesClick = {}
onAddFavoritesClick = {},
showFilterSheet = true,
onFilterSheetShow = {}
)
}
Loading