import * as React from 'react'; import { LiftedConstraint, RelayLocation } from '../../shared/daemon-rpc-types'; import { messages } from '../../shared/gettext'; import { IRelayLocationRedux } from '../redux/settings/reducers'; import LocationList, { LocationSelection, LocationSelectionType, RelayLocations, SpecialLocation, SpecialLocationIcon, SpecialLocations, } from './LocationList'; export enum SpecialBridgeLocationType { closestToExit = 0, } interface IBridgeLocationsProps { source: IRelayLocationRedux[]; defaultExpandedLocations?: RelayLocation[]; selectedValue?: LiftedConstraint; selectedElementRef?: React.Ref; onSelect?: (value: LocationSelection) => void; onWillExpand?: (locationRect: DOMRect, expandedContentHeight: number) => void; onTransitionEnd?: () => void; } const BridgeLocations = React.forwardRef(function BridgeLocationsT( props: IBridgeLocationsProps, ref: React.Ref>, ) { const selectedValue: | LocationSelection | undefined = props.selectedValue ? props.selectedValue === 'any' ? { type: LocationSelectionType.special, value: SpecialBridgeLocationType.closestToExit } : { type: LocationSelectionType.relay, value: props.selectedValue } : undefined; return ( {messages.pgettext('select-location-view', 'Closest to exit server')} ); }); export default BridgeLocations;