-
Notifications
You must be signed in to change notification settings - Fork 6
fixes for displaying FloorFilter facilitySelector when Sites are not … #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -112,7 +112,8 @@ internal fun SiteAndFacilitySelector( | |||||||||
) | ||||||||||
{ | ||||||||||
Column { | ||||||||||
if (!isFacilitiesSelectorVisible) { | ||||||||||
// display the siteSelector | ||||||||||
if (!isFacilitiesSelectorVisible && floorFilterState.sites.isNotEmpty()) { | ||||||||||
// display the sites top bar | ||||||||||
SiteSelectorTopBar( | ||||||||||
uiProperties = uiProperties, | ||||||||||
|
@@ -130,6 +131,8 @@ internal fun SiteAndFacilitySelector( | |||||||||
onFacilitiesSelectorVisible(true) | ||||||||||
} | ||||||||||
} else { | ||||||||||
// display the facilitiesSelector | ||||||||||
|
||||||||||
// display the facilities top bar | ||||||||||
Comment on lines
+134
to
136
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicate comment
Suggested change
|
||||||||||
FacilitySelectorTopBar( | ||||||||||
floorFilterState = floorFilterState, | ||||||||||
|
@@ -211,15 +214,18 @@ internal fun FacilitySelectorTopBar( | |||||||||
modifier = Modifier.height(65.dp).fillMaxWidth(), | ||||||||||
horizontalArrangement = Arrangement.SpaceBetween | ||||||||||
) { | ||||||||||
// a box is helpful to use a consistent clickable animation | ||||||||||
Box( | ||||||||||
modifier = Modifier.clickable { backToSiteButtonClicked() } | ||||||||||
) { | ||||||||||
Icon( | ||||||||||
modifier = Modifier.fillMaxHeight().padding(horizontal = 6.dp).size(24.dp), | ||||||||||
painter = painterResource(id = R.drawable.ic_chevron_left_32), | ||||||||||
contentDescription = "Go Back to Site Selector" | ||||||||||
) | ||||||||||
// if there are no sites, do not allow going back to the siteSelector from facilitySelector | ||||||||||
if (floorFilterState.sites.isNotEmpty()) { | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removes back button from facility selector |
||||||||||
// a box is helpful to use a consistent clickable animation | ||||||||||
Box( | ||||||||||
modifier = Modifier.clickable { backToSiteButtonClicked() } | ||||||||||
) { | ||||||||||
Icon( | ||||||||||
modifier = Modifier.fillMaxHeight().padding(horizontal = 6.dp).size(24.dp), | ||||||||||
painter = painterResource(id = R.drawable.ic_chevron_left_32), | ||||||||||
contentDescription = "Go Back to Site Selector" | ||||||||||
) | ||||||||||
} | ||||||||||
} | ||||||||||
Divider( | ||||||||||
color = Color.LightGray, | ||||||||||
|
@@ -245,7 +251,7 @@ internal fun FacilitySelectorTopBar( | |||||||||
|
||||||||||
Text( | ||||||||||
text = stringResource(R.string.floor_filter_site_selector_top_bar) + | ||||||||||
floorFilterState.getSelectedSite()?.name.toString(), | ||||||||||
(floorFilterState.getSelectedSite()?.name ?: "not available"), | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. displays |
||||||||||
fontSize = 15.sp, | ||||||||||
color = Color.Gray | ||||||||||
) | ||||||||||
|
@@ -284,6 +290,11 @@ internal fun SitesAndFacilitiesFilter( | |||||||||
// focus manager is used to clear focus from OutlinedTextField on search | ||||||||||
val focusManager = LocalFocusManager.current | ||||||||||
|
||||||||||
val facilitiesAtSelectedSite = if (floorFilterState.sites.isNotEmpty()) | ||||||||||
floorFilterState.getSelectedSite()?.facilities | ||||||||||
else | ||||||||||
floorFilterState.facilities | ||||||||||
|
||||||||||
// list of all the site/facility names to display when no search prompt is used | ||||||||||
val allSitesOrFacilities: MutableList<SiteFacilityWrapper> = | ||||||||||
if (!isFacilitiesSelectorVisible) | ||||||||||
|
@@ -294,7 +305,7 @@ internal fun SitesAndFacilitiesFilter( | |||||||||
) | ||||||||||
}.toMutableList() | ||||||||||
else | ||||||||||
floorFilterState.getSelectedSite()?.facilities?.map { floorFacility -> | ||||||||||
facilitiesAtSelectedSite?.map { floorFacility -> | ||||||||||
SiteFacilityWrapper( | ||||||||||
facility = floorFacility, | ||||||||||
isSelected = floorFacility.id == floorFilterState.selectedFacilityId | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we fallback to the levelNumber when the level.shortName is Blank