LLS: rename wireError (#8401)
* rename wireError in ownbeaconstore to locationPublishError Signed-off-by: Kerry Archibald <kerrya@element.io> * rename getLiveBeaconIdsWithWireError -> getLiveBeaconIdsWithLocationPublishError Signed-off-by: Kerry Archibald <kerrya@element.io> * rename wire error variables in components Signed-off-by: Kerry Archibald <kerrya@element.io> * new snapshots for new test names Signed-off-by: Kerry Archibald <kerrya@element.io> * fix bad capitalisation on onResetLocationPublishError Signed-off-by: Kerry Archibald <kerrya@element.io> * missed variable Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
a3f9123f6c
commit
8c6786bad6
11 changed files with 133 additions and 120 deletions
|
@ -53,10 +53,10 @@ const LeftPanelLiveShareWarning: React.FC<Props> = ({ isMinimized }) => {
|
|||
() => OwnBeaconStore.instance.isMonitoringLiveLocation,
|
||||
);
|
||||
|
||||
const beaconIdsWithWireError = useEventEmitterState(
|
||||
const beaconIdsWithLocationPublishError = useEventEmitterState(
|
||||
OwnBeaconStore.instance,
|
||||
OwnBeaconStoreEvent.WireError,
|
||||
() => OwnBeaconStore.instance.getLiveBeaconIdsWithWireError(),
|
||||
OwnBeaconStoreEvent.LocationPublishError,
|
||||
() => OwnBeaconStore.instance.getLiveBeaconIdsWithLocationPublishError(),
|
||||
);
|
||||
|
||||
const liveBeaconIds = useEventEmitterState(
|
||||
|
@ -65,13 +65,13 @@ const LeftPanelLiveShareWarning: React.FC<Props> = ({ isMinimized }) => {
|
|||
() => OwnBeaconStore.instance.getLiveBeaconIds(),
|
||||
);
|
||||
|
||||
const hasWireErrors = !!beaconIdsWithWireError.length;
|
||||
const hasLocationPublishErrors = !!beaconIdsWithLocationPublishError.length;
|
||||
|
||||
if (!isMonitoringLiveLocation) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const relevantBeaconRoomId = chooseBestBeaconRoomId(liveBeaconIds, beaconIdsWithWireError);
|
||||
const relevantBeaconRoomId = chooseBestBeaconRoomId(liveBeaconIds, beaconIdsWithLocationPublishError);
|
||||
|
||||
const onWarningClick = relevantBeaconRoomId ? () => {
|
||||
dispatcher.dispatch<ViewRoomPayload>({
|
||||
|
@ -81,14 +81,14 @@ const LeftPanelLiveShareWarning: React.FC<Props> = ({ isMinimized }) => {
|
|||
});
|
||||
} : undefined;
|
||||
|
||||
const label = hasWireErrors ?
|
||||
const label = hasLocationPublishErrors ?
|
||||
_t('An error occured whilst sharing your live location') :
|
||||
_t('You are sharing your live location');
|
||||
|
||||
return <AccessibleButton
|
||||
className={classNames('mx_LeftPanelLiveShareWarning', {
|
||||
'mx_LeftPanelLiveShareWarning__minimized': isMinimized,
|
||||
'mx_LeftPanelLiveShareWarning__error': hasWireErrors,
|
||||
'mx_LeftPanelLiveShareWarning__error': hasLocationPublishErrors,
|
||||
})}
|
||||
title={isMinimized ? label : undefined}
|
||||
onClick={onWarningClick}
|
||||
|
|
|
@ -38,15 +38,15 @@ const OwnBeaconStatus: React.FC<Props & HTMLProps<HTMLDivElement>> = ({
|
|||
beacon, displayStatus, ...rest
|
||||
}) => {
|
||||
const {
|
||||
hasWireError,
|
||||
hasLocationPublishError,
|
||||
hasStopSharingError,
|
||||
stoppingInProgress,
|
||||
onStopSharing,
|
||||
onResetWireError,
|
||||
onResetLocationPublishError,
|
||||
} = useOwnLiveBeacons([beacon?.identifier]);
|
||||
|
||||
// combine display status with errors that only occur for user's own beacons
|
||||
const ownDisplayStatus = hasWireError || hasStopSharingError ?
|
||||
const ownDisplayStatus = hasLocationPublishError || hasStopSharingError ?
|
||||
BeaconDisplayStatus.Error :
|
||||
displayStatus;
|
||||
|
||||
|
@ -67,10 +67,10 @@ const OwnBeaconStatus: React.FC<Props & HTMLProps<HTMLDivElement>> = ({
|
|||
{ _t('Stop') }
|
||||
</AccessibleButton>
|
||||
}
|
||||
{ hasWireError && <AccessibleButton
|
||||
{ hasLocationPublishError && <AccessibleButton
|
||||
data-test-id='beacon-status-reset-wire-error'
|
||||
kind='link'
|
||||
onClick={onResetWireError}
|
||||
onClick={onResetLocationPublishError}
|
||||
className='mx_OwnBeaconStatus_button mx_OwnBeaconStatus_destructiveButton'
|
||||
>
|
||||
{ _t('Retry') }
|
||||
|
|
|
@ -28,8 +28,8 @@ import StyledLiveBeaconIcon from './StyledLiveBeaconIcon';
|
|||
import { Icon as CloseIcon } from '../../../../res/img/image-view/close.svg';
|
||||
import LiveTimeRemaining from './LiveTimeRemaining';
|
||||
|
||||
const getLabel = (hasWireError: boolean, hasStopSharingError: boolean): string => {
|
||||
if (hasWireError) {
|
||||
const getLabel = (hasLocationPublishError: boolean, hasStopSharingError: boolean): string => {
|
||||
if (hasLocationPublishError) {
|
||||
return _t('An error occured whilst sharing your live location, please try again');
|
||||
}
|
||||
if (hasStopSharingError) {
|
||||
|
@ -45,22 +45,22 @@ interface RoomLiveShareWarningInnerProps {
|
|||
const RoomLiveShareWarningInner: React.FC<RoomLiveShareWarningInnerProps> = ({ liveBeaconIds, roomId }) => {
|
||||
const {
|
||||
onStopSharing,
|
||||
onResetWireError,
|
||||
onResetLocationPublishError,
|
||||
beacon,
|
||||
stoppingInProgress,
|
||||
hasStopSharingError,
|
||||
hasWireError,
|
||||
hasLocationPublishError,
|
||||
} = useOwnLiveBeacons(liveBeaconIds);
|
||||
|
||||
if (!beacon) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const hasError = hasStopSharingError || hasWireError;
|
||||
const hasError = hasStopSharingError || hasLocationPublishError;
|
||||
|
||||
const onButtonClick = () => {
|
||||
if (hasWireError) {
|
||||
onResetWireError();
|
||||
if (hasLocationPublishError) {
|
||||
onResetLocationPublishError();
|
||||
} else {
|
||||
onStopSharing();
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ const RoomLiveShareWarningInner: React.FC<RoomLiveShareWarningInnerProps> = ({ l
|
|||
<StyledLiveBeaconIcon className="mx_RoomLiveShareWarning_icon" withError={hasError} />
|
||||
|
||||
<span className="mx_RoomLiveShareWarning_label">
|
||||
{ getLabel(hasWireError, hasStopSharingError) }
|
||||
{ getLabel(hasLocationPublishError, hasStopSharingError) }
|
||||
</span>
|
||||
|
||||
{ stoppingInProgress &&
|
||||
|
@ -90,7 +90,7 @@ const RoomLiveShareWarningInner: React.FC<RoomLiveShareWarningInnerProps> = ({ l
|
|||
>
|
||||
{ hasError ? _t('Retry') : _t('Stop sharing') }
|
||||
</AccessibleButton>
|
||||
{ hasWireError && <AccessibleButton
|
||||
{ hasLocationPublishError && <AccessibleButton
|
||||
data-test-id='room-live-share-wire-error-close-button'
|
||||
title={_t('Stop sharing and close')}
|
||||
element='button'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue