-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Only stop places checkbox in location search (#4719)
When looking at geocoder request logs, we see that only ~8% of location searches end up in the user selecting an address. They instead use my position or a stop place. To make searching for stop places easier we add a checkbox the user can check so only stop places are returned when searching for a location. We will enable this to a subset of the users, and see if it is a feature which will be used.
- Loading branch information
1 parent
50636bb
commit 3f6bd01
Showing
11 changed files
with
121 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { | ||
screenReaderPause, | ||
ThemeText, | ||
ThemeTextProps, | ||
} from '@atb/components/text'; | ||
import {StyleProp, TouchableOpacity, ViewStyle} from 'react-native'; | ||
import {dictionary, useTranslation} from '@atb/translations'; | ||
import {Checkbox} from '.'; | ||
import React from 'react'; | ||
import {StyleSheet} from '@atb/theme'; | ||
|
||
export const CheckboxWithLabel = ({ | ||
label, | ||
checked, | ||
onPress, | ||
color, | ||
style, | ||
}: { | ||
label: string; | ||
checked: boolean; | ||
onPress: (v: boolean) => void; | ||
color?: ThemeTextProps['color']; | ||
style: StyleProp<ViewStyle>; | ||
}) => { | ||
const {t} = useTranslation(); | ||
const styles = useStyles(); | ||
|
||
const a11yLabel = | ||
label + | ||
screenReaderPause + | ||
t(checked ? dictionary.checked : dictionary.unchecked); | ||
|
||
return ( | ||
<TouchableOpacity | ||
style={[styles.container, style]} | ||
accessible={true} | ||
accessibilityLabel={a11yLabel} | ||
onPress={() => onPress(!checked)} | ||
> | ||
<Checkbox checked={checked} /> | ||
<ThemeText color={color}>{label}</ThemeText> | ||
</TouchableOpacity> | ||
); | ||
}; | ||
|
||
const useStyles = StyleSheet.createThemeHook((theme) => ({ | ||
container: {flexDirection: 'row', gap: theme.spacings.small}, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export {Checkbox} from './Checkbox'; | ||
export {CheckboxWithLabel} from './CheckboxWithLabel'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...tacks-hierarchy/Root_LocationSearchByTextScreen/use-only-stop-places-checkbox-enabled.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {useRemoteConfig} from '@atb/RemoteConfigContext'; | ||
import {useDebugOverride} from '@atb/debug'; | ||
import {StorageModelKeysEnum} from '@atb/storage'; | ||
|
||
export const useOnlyStopPlacesCheckboxEnabled = () => { | ||
const {enable_only_stop_places_checkbox} = useRemoteConfig(); | ||
const [debugOverride] = useOnlyStopPlacesCheckboxEnabledDebugOverride(); | ||
return debugOverride !== undefined | ||
? debugOverride | ||
: enable_only_stop_places_checkbox; | ||
}; | ||
|
||
export const useOnlyStopPlacesCheckboxEnabledDebugOverride = () => | ||
useDebugOverride( | ||
StorageModelKeysEnum.EnableOnlyStopPlacesCheckboxDebugOverride, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters