import { View } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import type { IconName } from '../../atoms/Icon'; import type { BottomMenuProps } from './BottomMenu.types'; import { BottomMenuButton } from './BottomMenuButton'; /** * Mapeo de los nombres "paper-icon" históricamente usados en pantallas * a los nombres internos de Icon. Cuando todas las pantallas pasen * tipos `IconName`, este mapa puede eliminarse. */ const paperToAppIcon: Record = { 'cloud-upload': 'upload', 'cloud-sync': 'refresh', 'content-save-outline': 'save', 'cursor-default-click': 'check', }; function resolveIcon(icon: string | undefined, fallback: IconName): IconName { if (!icon) { return fallback; } if (icon in paperToAppIcon) { return paperToAppIcon[icon]; } return icon as IconName; } export function BottomMenu({ onObservationPress, onTechnicalSheetPress, onCreatePress, isObservationDisabled = false, isTechnicalSheetDisabled = false, onBackPress, showBackButton = true, onAddPress, isAddDisabled = false, isSelectionMode = false, observationLabel = 'Seleccionar', observationIcon, observationBadgeCount = 0, onSelectAll, onDeselectAll, }: BottomMenuProps) { const insets = useSafeAreaInsets(); const containerClass = 'mx-4 mt-2 flex-row items-center justify-around rounded-[15px] border border-primary-700/70 bg-primary px-4 py-3'; if (isSelectionMode) { return ( {onObservationPress ? ( ) : null} {onSelectAll ? ( ) : null} {onDeselectAll ? ( ) : null} {onAddPress ? ( ) : null} {onTechnicalSheetPress ? ( ) : null} ); } return ( {showBackButton && onBackPress ? ( ) : null} {onCreatePress ? ( ) : null} {onObservationPress ? ( ) : null} {onTechnicalSheetPress ? ( ) : null} ); }