diff --git a/client/components/GeoLookupInput/AddGeoLookupInput.tsx b/client/components/GeoLookupInput/AddGeoLookupInput.tsx index d0f08c601..e8f46906b 100644 --- a/client/components/GeoLookupInput/AddGeoLookupInput.tsx +++ b/client/components/GeoLookupInput/AddGeoLookupInput.tsx @@ -297,6 +297,7 @@ export class AddGeoLookupInput extends React.Component { {this.state.openSuggestsPopUp && ( { diff --git a/client/components/GeoLookupInput/LocationLookupResultItem.tsx b/client/components/GeoLookupInput/LocationLookupResultItem.tsx index 66124d541..f61147531 100644 --- a/client/components/GeoLookupInput/LocationLookupResultItem.tsx +++ b/client/components/GeoLookupInput/LocationLookupResultItem.tsx @@ -9,6 +9,7 @@ interface IProps { onClick?(): void; active?: boolean; location: Partial; + languageCode?: string; } export class LocationLookupResultItem extends React.PureComponent { @@ -23,7 +24,7 @@ export class LocationLookupResultItem extends React.PureComponent { )} > - {getLocationsShortName(this.props.location)} + {getLocationsShortName(this.props.location, this.props.languageCode)} ); diff --git a/client/components/GeoLookupInput/index.tsx b/client/components/GeoLookupInput/index.tsx index 7248ac540..58112660b 100644 --- a/client/components/GeoLookupInput/index.tsx +++ b/client/components/GeoLookupInput/index.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import {AddGeoLookupInput, GeoLookupInputComponent} from './AddGeoLookupInput'; +import {AddGeoLookupInput} from './AddGeoLookupInput'; import {LineInput, Label} from '../UI/Form'; import {ILocation} from '../../interfaces'; @@ -17,14 +17,14 @@ interface IProps { readOnly?: boolean; boxed?: boolean; noMargin?: boolean; - refNode?: React.RefObject; + refNode?: React.RefObject; language?: string; onChange(field: string, value?: Partial): void; onFocus?(): void; popupContainer?(): HTMLElement; onPopupOpen?(): void; onPopupClose?(): void; - showAddLocationForm(props: any): void; + showAddLocationForm?(props: any): Promise; } export class GeoLookupInput extends React.PureComponent { diff --git a/client/components/UI/Form/LineInput.tsx b/client/components/UI/Form/LineInput.tsx index 89785f43c..aa1d4a1ba 100644 --- a/client/components/UI/Form/LineInput.tsx +++ b/client/components/UI/Form/LineInput.tsx @@ -2,13 +2,32 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; +interface IProps { + required?: boolean; + invalid?: boolean; + readOnly?: boolean; + boxed?: boolean; + isSelect?: boolean; + noMargin?: boolean; + noLabel?: boolean; + withButton?: boolean; + labelLeft?: boolean; + labelLeftAuto?: boolean; + hint?: string; + message?: string; + borderBottom?: boolean; + onClick?: (e: any) => void; + halfWidth?: boolean; + children?: React.ReactNode; + className?: string; +} + /** * @ngdoc react * @name LineInput * @description Component to style input component in a line-input style */ export const LineInput = ({ - children, required, invalid, readOnly, @@ -19,13 +38,14 @@ export const LineInput = ({ withButton, labelLeft, labelLeftAuto, + borderBottom = true, + halfWidth, + children, hint, message, className, - borderBottom, onClick, - halfWidth, -}) => ( +}: IProps): JSX.Element => (
{message}
} ); - -export const LineInputProps = { - required: PropTypes.bool, - invalid: PropTypes.bool, - readOnly: PropTypes.bool, - boxed: PropTypes.bool, - isSelect: PropTypes.bool, - noMargin: PropTypes.bool, - noLabel: PropTypes.bool, - withButton: PropTypes.bool, - labelLeft: PropTypes.bool, - labelLeftAuto: PropTypes.bool, - hint: PropTypes.string, - message: PropTypes.string, - borderBottom: PropTypes.bool, - onClick: PropTypes.func, - halfWidth: PropTypes.bool, -}; - -export const LineInputDefaultProps = { - required: false, - invalid: false, - readOnly: false, - boxed: false, - isSelect: false, - noMargin: false, - noLabel: false, - withButton: false, - labelLeft: false, - labelLeftAuto: false, - borderBottom: true, - halfWidth: false, -}; - -LineInput.propTypes = { - children: PropTypes.node, - className: PropTypes.string, - ...LineInputProps, -}; - -LineInput.defaultProps = {...LineInputDefaultProps}; diff --git a/client/components/UI/Popup/Content.tsx b/client/components/UI/Popup/Content.tsx index ee4f10a6c..76c7c778d 100644 --- a/client/components/UI/Popup/Content.tsx +++ b/client/components/UI/Popup/Content.tsx @@ -2,12 +2,17 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; +interface IProps { + children?: React.ReactNode; + className?: string; + noPadding?: boolean; +} /** * @ngdoc react * @name Content * @description Component to hold contents of a popup */ -const Content = ({children, className, noPadding}) => ( +const Content = ({children, className, noPadding}: IProps) => (
(
); -Content.propTypes = { - children: PropTypes.node, - className: PropTypes.string, - noPadding: PropTypes.bool, -}; - -Content.defaultProps = {noPadding: false}; - export default Content; diff --git a/client/utils/locations.ts b/client/utils/locations.ts index 781aa88bc..ebd06844b 100644 --- a/client/utils/locations.ts +++ b/client/utils/locations.ts @@ -137,9 +137,9 @@ export function formatLocationToAddress(item: Partial | IEventLocatio formattedAddress; } -export function getLocationsShortName(location: Partial) { +export function getLocationsShortName(location: Partial, languageCode?: string) { const formattedAddress = formatLocationToAddress(location); - const title = location.address?.title ?? location.name; + const title = location.translations?.name?.[`name:${languageCode}`] ?? location.address?.title ?? location.name; return title ? `${title}, ${formattedAddress}` :