Skip to content

Implement Filtering UI #120

Open
RyanCheung555 wants to merge 23 commits intomainfrom
ryan/filtering
Open

Implement Filtering UI #120
RyanCheung555 wants to merge 23 commits intomainfrom
ryan/filtering

Conversation

@RyanCheung555
Copy link
Contributor

Overview

  • Added the UI for a filter button and filtering actions

Changes Made

  • Added a clickable filter button that pulls up an interactive bottom sheet to select filters
  • When filters are selected, their respective labels appear next to the filter button for clarity

Test Coverage

  • Tested on Medium Phone emulator
  • Run on ecosystem build
  • Simple interaction tests with filter button and verifying appearance

Next Steps (delete if not applicable)

  • Add filter functionality

Screenshots (delete if not applicable)

The last button press was 'cancel' (e.g. do nothing)

Filter UI Screen Recording
filter_ui_demo.webm

RyanCheung555 and others added 23 commits February 7, 2026 02:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request implements the UI components for a filtering feature in the favorites section. The PR adds interactive filter buttons and bottom sheets that allow users to select location type filters (Gyms, Eateries, Libraries, Printers, Other), with selected filters displayed as removable tags. The actual filtering functionality is intentionally deferred to a future PR, as stated in the "Next Steps" section.

Changes:

  • Added UI components for filter button, filter row with removable tags, and modal bottom sheet for filter selection
  • Introduced filter state management in HomeViewModel to track selected and applied filters
  • Created new drawable resources for filter icons representing different location types

Reviewed changes

Copilot reviewed 18 out of 24 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
app/src/main/res/drawable/*.xml New vector drawable icons for different location type filters (printer, other, library, gym, eatery, and main filter icon)
app/src/main/java/com/cornellappdev/transit/ui/viewmodels/FavoritesFilterSheetState.kt New enum class defining the available filter types with their icons and labels
app/src/main/java/com/cornellappdev/transit/ui/viewmodels/FilterState.kt Added trailing comma to last enum entry for consistency
app/src/main/java/com/cornellappdev/transit/ui/viewmodels/HomeViewModel.kt Added state management for filter sheet visibility and selected/applied filters
app/src/main/java/com/cornellappdev/transit/ui/theme/Color.kt Added MutedTransitBlue color for active filter background
app/src/main/java/com/cornellappdev/transit/ui/screens/HomeScreen.kt Integrated filter sheet state into the home screen
app/src/main/java/com/cornellappdev/transit/ui/components/home/FilterRow.kt New component displaying the filter button and selected filter tags in a flow row
app/src/main/java/com/cornellappdev/transit/ui/components/home/FilterButton.kt New button component that triggers the filter bottom sheet
app/src/main/java/com/cornellappdev/transit/ui/components/home/FavoritesFilterSheetItem.kt New component for individual filter options in the bottom sheet grid
app/src/main/java/com/cornellappdev/transit/ui/components/home/FavoritesFilterBottomSheet.kt Modal bottom sheet component displaying filter options with cancel/apply actions
app/src/main/java/com/cornellappdev/transit/ui/components/home/EcosystemBottomSheetContent.kt Integrated filter UI into the favorites view with conditional rendering
app/src/main/java/com/cornellappdev/transit/ui/components/home/RoundedImagePlaceCard.kt Removed horizontal and vertical padding to allow for spacing in parent component
app/src/main/java/com/cornellappdev/transit/ui/components/home/AddFavoritesButton.kt Added vertical content padding parameter
.DS_Store, app/.DS_Store, app/src/.DS_Store, app/src/main/.DS_Store, app/src/main/res/.DS_Store, app/src/main/res/drawable/.DS_Store macOS system files that should not be committed

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.OutlinedTextFieldDefaults.contentPadding
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 contentPadding from OutlinedTextFieldDefaults is not used in this file. The contentPadding being used at line 166 comes from the PaddingValues function parameter.

Suggested change
import androidx.compose.material3.OutlinedTextFieldDefaults.contentPadding

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

^^

onRemoveFilter = {}
)


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.

There are two blank lines at the end of this preview function. This is inconsistent with the codebase style, where preview functions typically have only one blank line after the closing brace (see line 98 or other preview functions in the codebase).

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +97 to +98

}
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.

There is an extra blank line after the closing brace. This is inconsistent with the codebase style where preview functions typically have only one blank line after the closing brace (see other preview functions in the codebase).

Copilot uses AI. Check for mistakes.
Comment on lines +97 to +99
onClick : () -> Unit,
text: String,
modifier : Modifier = Modifier
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.

Extra spaces around the colon in parameter declarations. The codebase consistently uses no spaces before the colon (e.g., 'onClick:' not 'onClick :'). Please remove the spaces before the colons in both parameter declarations for consistency with the codebase style (see examples in CurrentLocationItem.kt:29, MenuItem.kt:31, SearchCategoryHeader.kt:21).

Suggested change
onClick : () -> Unit,
text: String,
modifier : Modifier = Modifier
onClick: () -> Unit,
text: String,
modifier: Modifier = Modifier

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

^^. Try to run the keyboard shortcut after you are finished with the file

Comment on lines +53 to +77
color = if(isActive) TransitBlue else MetadataGray,
shape = RoundedCornerShape(8.dp)
)
.background(
color = if(isActive) MutedTransitBlue
else Color.Transparent,
shape = RoundedCornerShape(8.dp)
)
.clickable(onClick = itemOnClick)
.padding(vertical = 16.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Icon(
painterResource(id = iconId),
contentDescription = label,
modifier = Modifier
.size(34.dp),
tint = if(isActive) TransitBlue else Color.Unspecified
)

Spacer(modifier = Modifier.height(8.dp))

Text(
label,
color = if(isActive) TransitBlue else MetadataGray,
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.

Missing space after 'if' keyword. The codebase consistently uses 'if (' with a space (see examples in BottomSheetFilterItem.kt:41, FilterRow.kt:48, EcosystemBottomSheetContent.kt:116). Please change 'if(isActive)' to 'if (isActive)' for consistency with the codebase style.

Copilot uses AI. Check for mistakes.

@Preview(showBackground = true)
@Composable
private fun InactiveFavoritesFilterSheetItemInactive() {
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.

The preview function name 'InactiveFavoritesFilterSheetItemInactive' is inconsistent with the preview naming convention used elsewhere in the codebase. Based on other preview functions like 'PreviewBottomSheetFilterItem' and 'InactivePreviewBottomSheetFilterItem' (from BottomSheetFilterItem.kt), the name should be 'InactivePreviewFavoritesFilterSheetItem' or 'PreviewFavoritesFilterSheetItemInactive' to maintain consistency.

Suggested change
private fun InactiveFavoritesFilterSheetItemInactive() {
private fun PreviewFavoritesFilterSheetItemInactive() {

Copilot uses AI. Check for mistakes.
Comment on lines +108 to +109

}
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.

There is an extra blank line after the closing brace. This is inconsistent with the codebase style where preview functions typically have only one blank line after the closing brace (see other preview functions in the codebase).

Copilot uses AI. Check for mistakes.
Comment on lines +105 to +109
backgroundColor = if(isCancel) Color.White else TransitBlue,
contentColor = if(isCancel) TransitBlue else Color.White
),
shape = RoundedCornerShape(16.dp),
border = if(isCancel) BorderStroke(1.dp, TransitBlue) else null,
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.

Missing space after 'if' keyword. The codebase consistently uses 'if (' with a space (see examples in BottomSheetFilterItem.kt:41, FilterRow.kt:48, EcosystemBottomSheetContent.kt:116). Please change 'if(isCancel)' to 'if (isCancel)' for consistency with the codebase style.

Suggested change
backgroundColor = if(isCancel) Color.White else TransitBlue,
contentColor = if(isCancel) TransitBlue else Color.White
),
shape = RoundedCornerShape(16.dp),
border = if(isCancel) BorderStroke(1.dp, TransitBlue) else null,
backgroundColor = if (isCancel) Color.White else TransitBlue,
contentColor = if (isCancel) TransitBlue else Color.White
),
shape = RoundedCornerShape(16.dp),
border = if (isCancel) BorderStroke(1.dp, TransitBlue) else null,

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +29

) {
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.

Extra blank line in function signature. There's an unnecessary blank line between the parameter list and the closing brace. Remove line 28 for cleaner code formatting.

Suggested change
) {
) {

Copilot uses AI. Check for mistakes.
FilterState.FAVORITES -> {
favoriteList(favorites, navigateToPlace, onAddFavoritesClick)
val appliedFilters by homeViewModel.appliedFavoritesFilters.collectAsStateWithLifecycle()
Column() {
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.

Empty parentheses on Column constructor. When there are no parameters being passed, the parentheses can be omitted in Kotlin for cleaner syntax. Change 'Column()' to 'Column' for consistency with Kotlin conventions.

Suggested change
Column() {
Column {

Copilot uses AI. Check for mistakes.
@AndrewCheung360
Copy link
Member

Remove the .DS_Store files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments