Skip to content

Commit

Permalink
Fix #9197 Disable apply media editor button while loading a selected …
Browse files Browse the repository at this point in the history
…item (#9198) (#9199)
  • Loading branch information
allyoucanmap authored May 29, 2023
1 parent a82f99e commit 43b4668
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 14 additions & 1 deletion web/client/selectors/__tests__/mediaEditor-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import {
getCurrentMediaResourcesParams,
getCurrentMediaResourcesTotalCount,
getLoadingSelectedMedia,
getLoadingMediaList
getLoadingMediaList,
disableApplyMapMedia
} from "../mediaEditor";

describe('mediaEditor selectors', () => {
Expand Down Expand Up @@ -278,4 +279,16 @@ describe('mediaEditor selectors', () => {
}
})).toBe(true);
});
it('disableApplyMapMedia', () => {
expect(disableApplyMapMedia({
mediaEditor: {
loadingSelected: true
}
})).toBe(true);
expect(disableApplyMapMedia({
mediaEditor: {
loadingSelected: false
}
})).toBe(false);
});
});
4 changes: 3 additions & 1 deletion web/client/selectors/mediaEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export const disabledMediaTypeSelector = state => get(state, "mediaEditor.disabl
/**
* Disable `apply` on empty selection for map media editor when geostory section is GeoCarousel,
* here disable media type value is available only in GeoCarousel section
* The apply button should be disabled also when a selected item is loading
*/
export const disableApplyMapMedia = (state) =>
disabledMediaTypeSelector(state).length && !selectedItemSelector(state) && currentMediaTypeSelector(state) === 'map';
(disabledMediaTypeSelector(state).length && !selectedItemSelector(state) && currentMediaTypeSelector(state) === 'map')
|| getLoadingSelectedMedia(state);

0 comments on commit 43b4668

Please sign in to comment.