Skip to content

Commit e06894f

Browse files
committed
RU-T47 PR#218 fixes
1 parent 7d11dc2 commit e06894f

File tree

16 files changed

+66
-98
lines changed

16 files changed

+66
-98
lines changed

src/app/(app)/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -503,11 +503,11 @@ const styles = StyleSheet.create({
503503
markerOuterRingPulseWeb:
504504
Platform.OS === 'web'
505505
? {
506-
// @ts-ignore — web-only CSS animation properties
507-
animationName: 'pulse-ring',
508-
animationDuration: '2s',
509-
animationIterationCount: 'infinite',
510-
animationTimingFunction: 'ease-in-out',
511-
}
506+
// @ts-ignore — web-only CSS animation properties
507+
animationName: 'pulse-ring',
508+
animationDuration: '2s',
509+
animationIterationCount: 'infinite',
510+
animationTimingFunction: 'ease-in-out',
511+
}
512512
: ({} as any),
513513
});

src/app/call/[id].tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export default function CallDetail() {
195195
* Opens the device's native maps application with directions to the call location
196196
*/
197197
const handleRoute = async () => {
198-
if (!coordinates.latitude || !coordinates.longitude) {
198+
if (coordinates.latitude === null || coordinates.longitude === null) {
199199
showToast('error', t('call_detail.no_location_for_routing'));
200200
return;
201201
}
@@ -309,7 +309,7 @@ export default function CallDetail() {
309309
<Box className="border-b border-outline-100 pb-2">
310310
<Text className="text-sm text-gray-500">{t('call_detail.note')}</Text>
311311
<Box>
312-
<HtmlRenderer html={call.Note} style={StyleSheet.flatten([styles.container, { height: 200 }])} />
312+
<HtmlRenderer html={call.Note ?? ''} style={StyleSheet.flatten([styles.container, { height: 200 }])} />
313313
</Box>
314314
</Box>
315315
</VStack>
@@ -356,7 +356,7 @@ export default function CallDetail() {
356356
<Text className="font-semibold">{protocol.Name}</Text>
357357
<Text className="text-sm text-gray-600">{protocol.Description}</Text>
358358
<Box>
359-
<HtmlRenderer html={protocol.ProtocolText} style={StyleSheet.flatten([styles.container, { height: 200 }])} />
359+
<HtmlRenderer html={protocol.ProtocolText ?? ''} style={StyleSheet.flatten([styles.container, { height: 200 }])} />
360360
</Box>
361361
</Box>
362362
))}
@@ -455,13 +455,13 @@ export default function CallDetail() {
455455
</HStack>
456456
<VStack className="space-y-1">
457457
<Box style={{ height: 80 }}>
458-
<HtmlRenderer html={call.Nature} style={StyleSheet.flatten([styles.container, { height: 80 }])} />
458+
<HtmlRenderer html={call.Nature ?? ''} style={StyleSheet.flatten([styles.container, { height: 80 }])} />
459459
</Box>
460460
</VStack>
461461
</Box>
462462

463463
{/* Map - only show when valid coordinates exist */}
464-
{coordinates.latitude && coordinates.longitude ? (
464+
{coordinates.latitude !== null && coordinates.longitude !== null ? (
465465
<Box className="w-full">
466466
<StaticMap latitude={coordinates.latitude} longitude={coordinates.longitude} address={call.Address} zoom={15} height={200} showUserLocation={true} />
467467
</Box>

src/components/calls/call-card.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import { AlertTriangle, MapPin, Phone } from 'lucide-react-native';
22
import React from 'react';
33
import { StyleSheet } from 'react-native';
44

5-
import { HtmlRenderer } from '@/components/ui/html-renderer';
6-
75
import { Box } from '@/components/ui/box';
86
import { HStack } from '@/components/ui/hstack';
7+
import { HtmlRenderer } from '@/components/ui/html-renderer';
98
import { Icon } from '@/components/ui/icon';
109
import { Text } from '@/components/ui/text';
1110
import { VStack } from '@/components/ui/vstack';
@@ -102,11 +101,7 @@ export const CallCard: React.FC<CallCardProps> = ({ call, priority }) => {
102101
{/* Nature of Call */}
103102
{call.Nature && (
104103
<Box className="mt-4 rounded-lg bg-white/50 p-3">
105-
<HtmlRenderer
106-
html={call.Nature}
107-
style={StyleSheet.flatten([styles.container, { height: 80 }])}
108-
textColor={textColor}
109-
/>
104+
<HtmlRenderer html={call.Nature} style={StyleSheet.flatten([styles.container, { height: 80 }])} textColor={textColor} />
110105
</Box>
111106
)}
112107
</Box>

src/components/contacts/contact-notes-list.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { useTranslation } from 'react-i18next';
55
import { Linking, ScrollView, StyleSheet } from 'react-native';
66

77
import { HtmlRenderer } from '@/components/ui/html-renderer';
8-
98
import { useAnalytics } from '@/hooks/use-analytics';
109
import { type ContactNoteResultData } from '@/models/v4/contacts/contactNoteResultData';
1110
import { useContactsStore } from '@/stores/contacts/store';

src/components/maps/map-view.web.tsx

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,8 @@ export const MapView = forwardRef<any, MapViewProps>(
130130
try {
131131
// Use initialCenter/initialZoom if provided so the map starts at the
132132
// correct position without needing a programmatic camera move later.
133-
const startCenter = (initialCenter && isFinite(initialCenter[0]) && isFinite(initialCenter[1]))
134-
? initialCenter
135-
: [-98.5795, 39.8283] as [number, number]; // Default US center
136-
const startZoom = (initialZoom != null && isFinite(initialZoom)) ? initialZoom : 4;
133+
const startCenter = initialCenter && isFinite(initialCenter[0]) && isFinite(initialCenter[1]) ? initialCenter : ([-98.5795, 39.8283] as [number, number]); // Default US center
134+
const startZoom = initialZoom != null && isFinite(initialZoom) ? initialZoom : 4;
137135

138136
const newMap = new mapboxgl.Map({
139137
container: mapContainer.current,
@@ -228,6 +226,7 @@ export const MapView = forwardRef<any, MapViewProps>(
228226
if (typeof origRender === 'function') {
229227
newMap._render = function (...args: unknown[]) {
230228
try {
229+
// eslint-disable-next-line react/no-this-in-sfc
231230
const canvas = this.getCanvas?.();
232231
if (canvas && (canvas.width === 0 || canvas.height === 0)) {
233232
return this; // skip frame when canvas is zero-sized
@@ -244,7 +243,7 @@ export const MapView = forwardRef<any, MapViewProps>(
244243
// that occur when mouse events fire while the map canvas is resizing.
245244
newMap.on('error', (e: { error?: Error }) => {
246245
const msg = e.error?.message ?? '';
247-
if (msg.includes('Invalid LngLat') || msg.includes('r[3]')) {
246+
if (msg.includes('Invalid LngLat')) {
248247
return;
249248
}
250249
console.warn('[MapView.web] mapbox-gl error:', e.error);
@@ -349,10 +348,7 @@ export const Camera = forwardRef<any, CameraProps>(({ centerCoordinate, zoomLeve
349348
if (!map) return;
350349

351350
// Validate coordinates before passing to mapbox
352-
if (
353-
options.centerCoordinate &&
354-
(!isFinite(options.centerCoordinate[0]) || !isFinite(options.centerCoordinate[1]))
355-
) {
351+
if (options.centerCoordinate && (!isFinite(options.centerCoordinate[0]) || !isFinite(options.centerCoordinate[1]))) {
356352
return;
357353
}
358354

@@ -371,11 +367,7 @@ export const Camera = forwardRef<any, CameraProps>(({ centerCoordinate, zoomLeve
371367
if (!map) return;
372368

373369
// Validate center if provided
374-
if (
375-
options.center &&
376-
Array.isArray(options.center) &&
377-
(!isFinite(options.center[0]) || !isFinite(options.center[1]))
378-
) {
370+
if (options.center && Array.isArray(options.center) && (!isFinite(options.center[0]) || !isFinite(options.center[1]))) {
379371
return;
380372
}
381373

@@ -386,12 +378,7 @@ export const Camera = forwardRef<any, CameraProps>(({ centerCoordinate, zoomLeve
386378
useEffect(() => {
387379
if (!map) return;
388380

389-
if (
390-
centerCoordinate &&
391-
centerCoordinate.length === 2 &&
392-
isFinite(centerCoordinate[0]) &&
393-
isFinite(centerCoordinate[1])
394-
) {
381+
if (centerCoordinate && centerCoordinate.length === 2 && isFinite(centerCoordinate[0]) && isFinite(centerCoordinate[1])) {
395382
// Skip the first render — the MapView already initialized at the correct
396383
// position via initialCenter/initialZoom, so no programmatic move needed.
397384
if (!hasInitialized.current) {
@@ -418,7 +405,7 @@ export const Camera = forwardRef<any, CameraProps>(({ centerCoordinate, zoomLeve
418405
// Suppress projection-matrix errors during resize/transition
419406
}
420407
}
421-
}, [map, centerCoordinate?.[0], centerCoordinate?.[1], zoomLevel, heading, pitch, animationDuration, animationMode]);
408+
}, [map, centerCoordinate, zoomLevel, heading, pitch, animationDuration, animationMode]);
422409

423410
useEffect(() => {
424411
if (!map || !followUserLocation) return;
@@ -534,13 +521,7 @@ export const PointAnnotation: React.FC<PointAnnotationProps> = ({ id, coordinate
534521

535522
// Update coordinate when values actually change (by value, not reference)
536523
useEffect(() => {
537-
if (
538-
markerRef.current &&
539-
coordinate &&
540-
coordinate.length === 2 &&
541-
isFinite(coordinate[0]) &&
542-
isFinite(coordinate[1])
543-
) {
524+
if (markerRef.current && coordinate && coordinate.length === 2 && isFinite(coordinate[0]) && isFinite(coordinate[1])) {
544525
markerRef.current.setLngLat(coordinate);
545526
}
546527
// eslint-disable-next-line react-hooks/exhaustive-deps

src/components/maps/static-map.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const StaticMap: React.FC<StaticMapProps> = ({ latitude, longitude, address, zoo
3737

3838
return (
3939
<Box style={StyleSheet.flatten([styles.container, { height }])}>
40-
<Mapbox.MapView style={StyleSheet.flatten([styles.map, { height }])} styleURL={mapStyle} logoEnabled={false} attributionEnabled={false} compassEnabled={true} zoomEnabled={true} rotateEnabled={true} initialCenter={[longitude, latitude]} initialZoom={zoom}>
40+
<Mapbox.MapView style={StyleSheet.flatten([styles.map, { height }])} styleURL={mapStyle} logoEnabled={false} attributionEnabled={false} compassEnabled={true} zoomEnabled={true} rotateEnabled={true}>
4141
<Mapbox.Camera zoomLevel={zoom} centerCoordinate={[longitude, latitude]} animationMode="flyTo" animationDuration={1000} />
4242
{/* Marker pin for the location */}
4343
<Mapbox.PointAnnotation id="destinationPoint" coordinate={[longitude, latitude]} title={address || 'Location'}>

src/components/notes/note-details-sheet.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { useTranslation } from 'react-i18next';
44
import { StyleSheet } from 'react-native';
55

66
import { HtmlRenderer } from '@/components/ui/html-renderer';
7-
87
import { useAnalytics } from '@/hooks/use-analytics';
98
import { formatDateForDisplay, parseDateISOString } from '@/lib/utils';
109
import { useNotesStore } from '@/stores/notes/store';
@@ -65,10 +64,7 @@ export const NoteDetailsSheet: React.FC = () => {
6564
<VStack space="md" className="flex-1">
6665
{/* Note content */}
6766
<Box className="w-full flex-1 rounded-lg bg-gray-50 p-1 dark:bg-gray-700">
68-
<HtmlRenderer
69-
html={selectedNote.Body}
70-
style={StyleSheet.flatten([styles.container, { height: 120 }])}
71-
/>
67+
<HtmlRenderer html={selectedNote?.Body ?? ''} style={StyleSheet.flatten([styles.container, { height: 120 }])} />
7268
</Box>
7369

7470
<Divider />

src/components/protocols/protocol-details-sheet.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React, { useEffect } from 'react';
33
import { StyleSheet } from 'react-native';
44

55
import { HtmlRenderer } from '@/components/ui/html-renderer';
6-
76
import { useAnalytics } from '@/hooks/use-analytics';
87
import { formatDateForDisplay, parseDateISOString, stripHtmlTags } from '@/lib/utils';
98
import { useProtocolsStore } from '@/stores/protocols/store';
@@ -49,7 +48,6 @@ export const ProtocolDetailsSheet: React.FC = () => {
4948
);
5049
}
5150

52-
5351
return (
5452
<Actionsheet isOpen={isDetailsOpen} onClose={closeDetails} snapPoints={[67]}>
5553
<ActionsheetBackdrop />
@@ -85,15 +83,11 @@ export const ProtocolDetailsSheet: React.FC = () => {
8583
)}
8684

8785
{/* Protocol content */}
88-
<Box className="w-full flex-1 rounded-lg bg-gray-50 p-1 dark:bg-gray-700">
89-
<HtmlRenderer
90-
html={selectedProtocol.ProtocolText}
91-
style={styles.container}
92-
scrollEnabled={true}
93-
showsVerticalScrollIndicator={true}
94-
rendererKey={selectedProtocolId}
95-
/>
96-
</Box>
86+
{selectedProtocol.ProtocolText && (
87+
<Box className="w-full flex-1 rounded-lg bg-gray-50 p-1 dark:bg-gray-700">
88+
<HtmlRenderer html={selectedProtocol.ProtocolText} style={styles.container} scrollEnabled={true} showsVerticalScrollIndicator={true} rendererKey={selectedProtocolId ?? undefined} />
89+
</Box>
90+
)}
9791

9892
<Divider />
9993

src/components/ui/box/index.web.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import type { VariantProps } from '@gluestack-ui/nativewind-utils';
22
import React from 'react';
3-
import { StyleSheet, type StyleProp, type ViewStyle } from 'react-native';
3+
import { type StyleProp, StyleSheet, type ViewStyle } from 'react-native';
44

55
import { boxStyle } from './styles';
66

77
type IBoxProps = React.ComponentPropsWithoutRef<'div'> & VariantProps<typeof boxStyle> & { className?: string; style?: StyleProp<ViewStyle> };
88

99
const Box = React.forwardRef<HTMLDivElement, IBoxProps>(({ className, style, ...props }, ref) => {
1010
const flatStyle = Array.isArray(style) ? StyleSheet.flatten(style) : style;
11-
return <div ref={ref} className={boxStyle({ class: className })} style={flatStyle} {...props} />;
11+
return <div ref={ref} className={boxStyle({ class: className })} style={flatStyle as React.CSSProperties} {...props} />;
1212
});
1313

1414
Box.displayName = 'Box';

src/components/ui/card/index.web.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import type { VariantProps } from '@gluestack-ui/nativewind-utils';
22
import React from 'react';
3-
import { StyleSheet, type StyleProp, type ViewStyle } from 'react-native';
3+
import { type StyleProp, StyleSheet, type ViewStyle } from 'react-native';
44

55
import { cardStyle } from './styles';
66

77
type ICardProps = React.ComponentPropsWithoutRef<'div'> & VariantProps<typeof cardStyle> & { style?: StyleProp<ViewStyle> };
88

99
const Card = React.forwardRef<HTMLDivElement, ICardProps>(({ className, size = 'md', variant = 'elevated', style, ...props }, ref) => {
1010
const flatStyle = Array.isArray(style) ? StyleSheet.flatten(style) : style;
11-
return <div className={cardStyle({ size, variant, class: className })} style={flatStyle} {...props} ref={ref} />;
11+
return <div className={cardStyle({ size, variant, class: className })} style={flatStyle as React.CSSProperties} {...props} ref={ref} />;
1212
});
1313

1414
Card.displayName = 'Card';

0 commit comments

Comments
 (0)