(core) remove the sort&filter save button on readonly mode

Summary: Saving sort or filter is not permitted in readonly mode. Hence we remove the button. The diff adds a new unit to

Test Plan: Adds test for behaviour to `nbrowser/ReadOnlyMode`. Also adds tests for other Save buttons related to sort & filter that should be disabled.

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D2804
This commit is contained in:
Cyprien P 2021-05-05 17:15:15 +02:00
parent 8056bb0069
commit 9a6369a4ff

View File

@ -86,6 +86,7 @@ export function viewSectionMenu(owner: IDisposableOwner, docModel: DocModel, vie
dom.on('click', save), dom.on('click', save),
hoverTooltip(() => 'Save', {key: 'sortFilterButton', openDelay: TOOLTIP_DELAY_OPEN}), hoverTooltip(() => 'Save', {key: 'sortFilterButton', openDelay: TOOLTIP_DELAY_OPEN}),
testId('small-btn-save'), testId('small-btn-save'),
dom.hide(isReadonly),
), ),
cssSmallIconWrapper( cssSmallIconWrapper(
cssIcon('CrossSmall'), cssSmallIconWrapper.cls('-gray'), cssIcon('CrossSmall'), cssSmallIconWrapper.cls('-gray'),
@ -346,6 +347,8 @@ const cssSmallIconWrapper = styled('div', `
width: 16px; width: 16px;
height: 16px; height: 16px;
border-radius: 8px; border-radius: 8px;
margin: 0 5px 0 5px;
&-green { &-green {
background-color: ${colors.lightGreen}; background-color: ${colors.lightGreen};
} }
@ -359,8 +362,7 @@ const cssSmallIconWrapper = styled('div', `
const cssSaveIconsWrapper = styled('div', ` const cssSaveIconsWrapper = styled('div', `
padding: 0 6px 0 6px; padding: 0 1px 0 1px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
width: 54px;
`); `);