feat: only show Update View button if view can be persisted (#1533)

Closes #1499
This commit is contained in:
Thaïs 2023-09-11 12:03:01 +02:00 committed by GitHub
parent 9be069bedc
commit 110d5eaa9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,6 +67,10 @@ export const UpdateViewButtonGroup = ({
const setViewEditMode = useSetRecoilState(viewEditModeState);
const canPersistView =
currentViewId &&
(canPersistViewFields || canPersistFilters || canPersistSorts);
const handleArrowDownButtonClick = useCallback(() => {
setIsDropdownOpen((previousIsOpen) => !previousIsOpen);
}, []);
@ -95,17 +99,12 @@ export const UpdateViewButtonGroup = ({
[],
);
if (!canPersistView) return null;
return (
<StyledContainer>
<ButtonGroup size="small" accent="blue">
<Button
title="Update view"
disabled={
!currentViewId ||
(!canPersistViewFields && !canPersistFilters && !canPersistSorts)
}
onClick={handleViewSubmit}
/>
<Button title="Update view" onClick={handleViewSubmit} />
<Button
size="small"
Icon={IconChevronDown}