Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type Props = {
onAmenityTypesChange: (ids: string[]) => void;
buildingOptions: BuildingFilterOption[];
amenityOptions: AmenityFilterOption[];
onPanelLayout?: (height: number) => void;
};

export function MapFilters({
Expand All @@ -34,6 +35,7 @@ export function MapFilters({
onAmenityTypesChange,
buildingOptions,
amenityOptions,
onPanelLayout,
}: Props) {
const buildingSet = useMemo(() => new Set(buildingTypeIds), [buildingTypeIds]);
const amenitySet = useMemo(() => new Set(amenityTypeIds), [amenityTypeIds]);
Expand All @@ -42,7 +44,9 @@ export function MapFilters({

return (
<View style={styles.container} pointerEvents="box-none">
<View style={styles.panel}>
<View
style={styles.panel}
onLayout={(e) => onPanelLayout?.(e.nativeEvent.layout.height)}>
<View style={styles.rowSpaceBetween}>
<Text style={styles.panelTitle}>Map Style</Text>
<Pressable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export function SearchPanel({ cameraMove, cameraFitRoute, bottomSheetPosition }:
const routingSearchSheetRef = useRef<BottomSheet>(null);
const routeStartInputRef = useRef<TextInput>(null);
const routeEndInputRef = useRef<TextInput>(null);
const routingSearchInputRef = useRef<TextInput>(null);

const snapPoints = useMemo(() => ["27%", "35%", "55%", "75%"], []);
const routingSearchSnapPoints = useMemo(() => ["85%"], []);
Expand Down Expand Up @@ -154,13 +155,19 @@ export function SearchPanel({ cameraMove, cameraFitRoute, bottomSheetPosition }:
const openRoutingSearchSheet = useCallback(
(field: "start" | "end") => {
const value = field === "start" ? startValue : endValue;
routeStartInputRef.current?.blur();
routeEndInputRef.current?.blur();
setActiveField(field);
setSearchQuery(value);
setFocused(true);
setRoutingSearchSheetOpen(true);

requestAnimationFrame(() => {
routingSearchSheetRef.current?.snapToIndex(0);
sheetRef.current?.snapToIndex(3);
setTimeout(() => {
routingSearchInputRef.current?.focus();
}, 120);
});
},
[endValue, setSearchQuery, startValue],
Expand Down Expand Up @@ -537,6 +544,7 @@ export function SearchPanel({ cameraMove, cameraFitRoute, bottomSheetPosition }:
placeholder="Starting point"
value={startValue}
clearButtonMode="always"
showSoftInputOnFocus={false}
onFocus={() => openRoutingSearchSheet("start")}
onChangeText={(text) => {
setStartValue(text);
Expand All @@ -555,6 +563,7 @@ export function SearchPanel({ cameraMove, cameraFitRoute, bottomSheetPosition }:
autoCapitalize="none"
autoCorrect={false}
value={endValue}
showSoftInputOnFocus={false}
onFocus={() => openRoutingSearchSheet("end")}
onChangeText={(text) => {
setEndValue(text);
Expand Down Expand Up @@ -683,6 +692,7 @@ export function SearchPanel({ cameraMove, cameraFitRoute, bottomSheetPosition }:
</View>

<BottomSheetTextInput
ref={routingSearchInputRef}
style={styles.input}
placeholder={
activeField === "start"
Expand Down
111 changes: 76 additions & 35 deletions frontend/calpoly-map/src/components/map/MapContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export function MapContainer({
}, [featureCenter, selectedBuilding]);

const searchPanelHeight = useSharedValue<number>(0);
const [filtersPanelHeight, setFiltersPanelHeight] = useState(0);
const windowHeight = Dimensions.get("window").height;

const controlsAnimatedStyle = useAnimatedStyle(() => {
Expand Down Expand Up @@ -499,6 +500,7 @@ export function MapContainer({
onAmenityTypesChange={setAmenityTypeIds}
buildingOptions={buildingOptions}
amenityOptions={amenityOptions}
onPanelLayout={setFiltersPanelHeight}
/>

{(hasLoading || errorMessage) && (
Expand Down Expand Up @@ -529,49 +531,83 @@ export function MapContainer({
)}

{navigationMode ? (
<NavigationUI />
<>
<NavigationUI />
<Animated.View
style={[styles.zoomControlsNav, {top: filtersPanelHeight + 16}, controlsAnimatedStyle]}
pointerEvents="box-none"
>
<UserLocationButton />

<Pressable
accessibilityRole="button"
accessibilityLabel="Zoom in"
onPress={() => handleZoom(1)}
style={styles.zoomButton}
>
<View style={styles.zoomIcon}>
<View style={styles.zoomIconBarHorizontal} />
<View style={styles.zoomIconBarVertical} />
</View>
</Pressable>
<Pressable
accessibilityRole="button"
accessibilityLabel="Zoom out"
onPress={() => handleZoom(-1)}
style={styles.zoomButton}
>
<View style={styles.zoomIcon}>
<View style={styles.zoomIconBarHorizontal} />
</View>
</Pressable>
</Animated.View>
</>

) : (
<SearchPanel
cameraMove={handleCameraMove}
cameraFitRoute={handleCameraFitRoute}
bottomSheetPosition={searchPanelHeight}
/>
<>
<SearchPanel
cameraMove={handleCameraMove}
cameraFitRoute={handleCameraFitRoute}
bottomSheetPosition={searchPanelHeight}
/>

<Animated.View
style={[styles.zoomControls, controlsAnimatedStyle]}
pointerEvents="box-none"
>
<UserLocationButton />

<Pressable
accessibilityRole="button"
accessibilityLabel="Zoom in"
onPress={() => handleZoom(1)}
style={styles.zoomButton}
>
<View style={styles.zoomIcon}>
<View style={styles.zoomIconBarHorizontal} />
<View style={styles.zoomIconBarVertical} />
</View>
</Pressable>
<Pressable
accessibilityRole="button"
accessibilityLabel="Zoom out"
onPress={() => handleZoom(-1)}
style={styles.zoomButton}
>
<View style={styles.zoomIcon}>
<View style={styles.zoomIconBarHorizontal} />
</View>
</Pressable>
</Animated.View>
</>

)}

<BuildingPopup
visible={!!selectedBuilding}
building={selectedBuilding}
onClose={clearSelection}
onNavigate={handleNavigate}
/>
<Animated.View
style={[styles.zoomControls, controlsAnimatedStyle]}
pointerEvents="box-none"
>
<UserLocationButton />

<Pressable
accessibilityRole="button"
accessibilityLabel="Zoom in"
onPress={() => handleZoom(1)}
style={styles.zoomButton}
>
<View style={styles.zoomIcon}>
<View style={styles.zoomIconBarHorizontal} />
<View style={styles.zoomIconBarVertical} />
</View>
</Pressable>
<Pressable
accessibilityRole="button"
accessibilityLabel="Zoom out"
onPress={() => handleZoom(-1)}
style={styles.zoomButton}
>
<View style={styles.zoomIcon}>
<View style={styles.zoomIconBarHorizontal} />
</View>
</Pressable>
</Animated.View>

<AmenityPopup
visible={!!selectedAmenity}
Expand Down Expand Up @@ -658,6 +694,11 @@ const styles = StyleSheet.create({
color: "#374151",
fontWeight: "600",
},
zoomControlsNav: {
position: "absolute",
right: 16,
gap: 10,
},
zoomControls: {
position: "absolute",
right: 16,
Expand Down