mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-25 21:13:01 +03:00
feat: only show Update View button if view can be persisted (#1533)
Closes #1499
This commit is contained in:
parent
9be069bedc
commit
110d5eaa9d
@ -67,6 +67,10 @@ export const UpdateViewButtonGroup = ({
|
|||||||
|
|
||||||
const setViewEditMode = useSetRecoilState(viewEditModeState);
|
const setViewEditMode = useSetRecoilState(viewEditModeState);
|
||||||
|
|
||||||
|
const canPersistView =
|
||||||
|
currentViewId &&
|
||||||
|
(canPersistViewFields || canPersistFilters || canPersistSorts);
|
||||||
|
|
||||||
const handleArrowDownButtonClick = useCallback(() => {
|
const handleArrowDownButtonClick = useCallback(() => {
|
||||||
setIsDropdownOpen((previousIsOpen) => !previousIsOpen);
|
setIsDropdownOpen((previousIsOpen) => !previousIsOpen);
|
||||||
}, []);
|
}, []);
|
||||||
@ -95,17 +99,12 @@ export const UpdateViewButtonGroup = ({
|
|||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!canPersistView) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledContainer>
|
<StyledContainer>
|
||||||
<ButtonGroup size="small" accent="blue">
|
<ButtonGroup size="small" accent="blue">
|
||||||
<Button
|
<Button title="Update view" onClick={handleViewSubmit} />
|
||||||
title="Update view"
|
|
||||||
disabled={
|
|
||||||
!currentViewId ||
|
|
||||||
(!canPersistViewFields && !canPersistFilters && !canPersistSorts)
|
|
||||||
}
|
|
||||||
onClick={handleViewSubmit}
|
|
||||||
/>
|
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
Icon={IconChevronDown}
|
Icon={IconChevronDown}
|
||||||
|
Loading…
Reference in New Issue
Block a user