Live location sharing - update live location tiles (PSF-1027) (#8649)
* update map svg Signed-off-by: Kerry Archibald <kerrya@element.io> * add map fallback component, update styls Signed-off-by: Kerry Archibald <kerrya@element.io> * update purple location icon style Signed-off-by: Kerry Archibald <kerrya@element.io> * fussy import ordering Signed-off-by: Kerry Archibald <kerrya@element.io> * tidy Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
30b03776b8
commit
804ddbb332
11 changed files with 182 additions and 85 deletions
|
@ -32,12 +32,12 @@ import ZoomButtons from '../location/ZoomButtons';
|
|||
import BeaconMarker from './BeaconMarker';
|
||||
import { Bounds, getBeaconBounds } from '../../../utils/beacon/bounds';
|
||||
import { getGeoUri } from '../../../utils/beacon';
|
||||
import { Icon as LocationIcon } from '../../../../res/img/element-icons/location.svg';
|
||||
import { _t } from '../../../languageHandler';
|
||||
import AccessibleButton from '../elements/AccessibleButton';
|
||||
import DialogSidebar from './DialogSidebar';
|
||||
import DialogOwnBeaconStatus from './DialogOwnBeaconStatus';
|
||||
import BeaconStatusTooltip from './BeaconStatusTooltip';
|
||||
import MapFallback from '../location/MapFallback';
|
||||
|
||||
interface IProps extends IDialogProps {
|
||||
roomId: Room['roomId'];
|
||||
|
@ -110,11 +110,10 @@ const BeaconViewDialog: React.FC<IProps> = ({
|
|||
</>
|
||||
}
|
||||
</Map> :
|
||||
<div
|
||||
<MapFallback
|
||||
data-test-id='beacon-view-dialog-map-fallback'
|
||||
className='mx_BeaconViewDialog_map mx_BeaconViewDialog_mapFallback'
|
||||
className='mx_BeaconViewDialog_map'
|
||||
>
|
||||
<LocationIcon className='mx_BeaconViewDialog_mapFallbackIcon' />
|
||||
<span className='mx_BeaconViewDialog_mapFallbackMessage'>{ _t('No live locations') }</span>
|
||||
<AccessibleButton
|
||||
kind='primary'
|
||||
|
@ -123,7 +122,7 @@ const BeaconViewDialog: React.FC<IProps> = ({
|
|||
>
|
||||
{ _t('Close') }
|
||||
</AccessibleButton>
|
||||
</div>
|
||||
</MapFallback>
|
||||
}
|
||||
{ isSidebarOpen ?
|
||||
<DialogSidebar beacons={liveBeacons} requestClose={() => setSidebarOpen(false)} /> :
|
||||
|
|
39
src/components/views/location/MapFallback.tsx
Normal file
39
src/components/views/location/MapFallback.tsx
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { Icon as LocationMarkerIcon } from '../../../../res/img/element-icons/location.svg';
|
||||
import { Icon as MapFallbackImage } from '../../../../res/img/location/map.svg';
|
||||
import Spinner from '../elements/Spinner';
|
||||
|
||||
interface Props extends React.HTMLAttributes<HTMLDivElement> {
|
||||
className?: string;
|
||||
isLoading?: boolean;
|
||||
children?: React.ReactNode | React.ReactNodeArray;
|
||||
}
|
||||
|
||||
const MapFallback: React.FC<Props> = ({ className, isLoading, children, ...rest }) => {
|
||||
return <div className={classNames('mx_MapFallback', className)} {...rest}>
|
||||
<MapFallbackImage className='mx_MapFallback_bg' />
|
||||
{ /* <div className='mx_MapFallback_bg'/> */ }
|
||||
{ isLoading ? <Spinner h={32} w={32} /> : <LocationMarkerIcon className='mx_MapFallback_icon' /> }
|
||||
{ children }
|
||||
</div>;
|
||||
};
|
||||
|
||||
export default MapFallback;
|
|
@ -19,7 +19,6 @@ import { Beacon, BeaconEvent, MatrixEvent } from 'matrix-js-sdk/src/matrix';
|
|||
import { BeaconLocationState } from 'matrix-js-sdk/src/content-helpers';
|
||||
import { randomString } from 'matrix-js-sdk/src/randomstring';
|
||||
|
||||
import { Icon as LocationMarkerIcon } from '../../../../res/img/element-icons/location.svg';
|
||||
import MatrixClientContext from '../../../contexts/MatrixClientContext';
|
||||
import { useEventEmitterState } from '../../../hooks/useEventEmitter';
|
||||
import { _t } from '../../../languageHandler';
|
||||
|
@ -28,8 +27,8 @@ import { useBeacon } from '../../../utils/beacon';
|
|||
import { isSelfLocation } from '../../../utils/location';
|
||||
import { BeaconDisplayStatus, getBeaconDisplayStatus } from '../beacon/displayStatus';
|
||||
import BeaconStatus from '../beacon/BeaconStatus';
|
||||
import Spinner from '../elements/Spinner';
|
||||
import Map from '../location/Map';
|
||||
import MapFallback from '../location/MapFallback';
|
||||
import SmartMarker from '../location/SmartMarker';
|
||||
import OwnBeaconStatus from '../beacon/OwnBeaconStatus';
|
||||
import BeaconViewDialog from '../beacon/BeaconViewDialog';
|
||||
|
@ -134,12 +133,10 @@ const MBeaconBody: React.FC<IBodyProps> = React.forwardRef(({ mxEvent }, ref) =>
|
|||
/>
|
||||
}
|
||||
</Map>
|
||||
: <div className='mx_MBeaconBody_map mx_MBeaconBody_mapFallback'>
|
||||
{ displayStatus === BeaconDisplayStatus.Loading ?
|
||||
<Spinner h={32} w={32} /> :
|
||||
<LocationMarkerIcon className='mx_MBeaconBody_mapFallbackIcon' />
|
||||
}
|
||||
</div>
|
||||
: <MapFallback
|
||||
isLoading={displayStatus === BeaconDisplayStatus.Loading}
|
||||
className='mx_MBeaconBody_map mx_MBeaconBody_mapFallback'
|
||||
/>
|
||||
}
|
||||
{ isOwnBeacon ?
|
||||
<OwnBeaconStatus
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue