mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
bug fixes
This commit is contained in:
parent
445a03f51c
commit
c8e99bc67a
3 changed files with 55 additions and 36 deletions
|
|
@ -3,6 +3,8 @@ import { Overlay, Popover } from 'react-bootstrap';
|
||||||
import { Button } from '@/_ui/LeftSidebar';
|
import { Button } from '@/_ui/LeftSidebar';
|
||||||
import useStore from '@/AppBuilder/_stores/store';
|
import useStore from '@/AppBuilder/_stores/store';
|
||||||
import { shallow } from 'zustand/shallow';
|
import { shallow } from 'zustand/shallow';
|
||||||
|
import { ToolTip } from '@/_components/ToolTip';
|
||||||
|
import SolidIcon from '@/_ui/Icon/SolidIcons';
|
||||||
|
|
||||||
export const PageHandlerMenu = ({ darkMode }) => {
|
export const PageHandlerMenu = ({ darkMode }) => {
|
||||||
const setShowEditingPopover = useStore((state) => state.setShowEditingPopover);
|
const setShowEditingPopover = useStore((state) => state.setShowEditingPopover);
|
||||||
|
|
@ -25,24 +27,6 @@ export const PageHandlerMenu = ({ darkMode }) => {
|
||||||
const featureAccess = useStore((state) => state?.license?.featureAccess, shallow);
|
const featureAccess = useStore((state) => state?.license?.featureAccess, shallow);
|
||||||
const licenseValid = !featureAccess?.licenseStatus?.isExpired && featureAccess?.licenseStatus?.isLicenseValid;
|
const licenseValid = !featureAccess?.licenseStatus?.isExpired && featureAccess?.licenseStatus?.isLicenseValid;
|
||||||
|
|
||||||
// const popoverTargetRef = null;
|
|
||||||
// console.log(
|
|
||||||
// {
|
|
||||||
// setShowEditingPopover,
|
|
||||||
// setShowRenameHandlerModal,
|
|
||||||
// setEditingPage,
|
|
||||||
// setShowPageEventsModal,
|
|
||||||
// popoverTargetRef,
|
|
||||||
// editingPage,
|
|
||||||
// showRenameHandlerModal,
|
|
||||||
// showPageEventsModal,
|
|
||||||
// setEditingPageName,
|
|
||||||
// showEditingPopover,
|
|
||||||
// closeEditingPopover,
|
|
||||||
// },
|
|
||||||
// 'editingPage'
|
|
||||||
// );
|
|
||||||
|
|
||||||
const closeMenu = () => {
|
const closeMenu = () => {
|
||||||
closePageEditPopover();
|
closePageEditPopover();
|
||||||
};
|
};
|
||||||
|
|
@ -124,7 +108,6 @@ export const PageHandlerMenu = ({ darkMode }) => {
|
||||||
callback={() => markAsHomePage(editingPage.id)}
|
callback={() => markAsHomePage(editingPage.id)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!isDisabled && (
|
{!isDisabled && (
|
||||||
<Field
|
<Field
|
||||||
id={isHidden ? 'unhide-page' : 'hide-page'}
|
id={isHidden ? 'unhide-page' : 'hide-page'}
|
||||||
|
|
@ -137,7 +120,6 @@ export const PageHandlerMenu = ({ darkMode }) => {
|
||||||
disabled={isHomePage}
|
disabled={isHomePage}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Field
|
<Field
|
||||||
id="clone-page"
|
id="clone-page"
|
||||||
text="Duplicate page"
|
text="Duplicate page"
|
||||||
|
|
@ -147,7 +129,6 @@ export const PageHandlerMenu = ({ darkMode }) => {
|
||||||
clonePage(editingPage.id);
|
clonePage(editingPage.id);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Field
|
<Field
|
||||||
id="settings"
|
id="settings"
|
||||||
text="Event Handlers"
|
text="Event Handlers"
|
||||||
|
|
@ -169,18 +150,32 @@ export const PageHandlerMenu = ({ darkMode }) => {
|
||||||
}}
|
}}
|
||||||
disabled={isHomePage}
|
disabled={isHomePage}
|
||||||
/>
|
/>
|
||||||
{licenseValid && (
|
|
||||||
<Field
|
<Field
|
||||||
id={isDisabled ? 'enable-page' : 'disable-page'}
|
id={isDisabled ? 'enable-page' : 'disable-page'}
|
||||||
text={isDisabled ? 'Page permission' : 'Page permission'}
|
disabled={!licenseValid}
|
||||||
customClass={'delete-btn'}
|
classNames={'page-permission-btn'}
|
||||||
iconSrc={`assets/images/icons/editor/left-sidebar/authorization.svg`}
|
text={() => {
|
||||||
closeMenu={closeMenu}
|
return (
|
||||||
callback={(id) => {
|
<ToolTip
|
||||||
togglePagePermissionModal(true);
|
message={'Page permissions are available only in paid plans'}
|
||||||
}}
|
placement="right"
|
||||||
/>
|
show={!licenseValid}
|
||||||
)}
|
>
|
||||||
|
<div className="d-flex align-items-center">
|
||||||
|
<div>Page permission</div>
|
||||||
|
{!licenseValid && <SolidIcon name="enterprisesmall" />}
|
||||||
|
</div>
|
||||||
|
</ToolTip>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
customClass={'delete-btn'}
|
||||||
|
iconSrc={`assets/images/icons/editor/left-sidebar/authorization.svg`}
|
||||||
|
closeMenu={closeMenu}
|
||||||
|
callback={(id) => {
|
||||||
|
togglePagePermissionModal(true);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<Field
|
<Field
|
||||||
id="delete-page"
|
id="delete-page"
|
||||||
text="Delete page"
|
text="Delete page"
|
||||||
|
|
@ -240,7 +235,16 @@ const PageHandleField = ({ page, updatePageHandle }) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Field = ({ id, text, iconSrc, customClass = '', closeMenu, disabled = false, callback = () => null }) => {
|
const Field = ({
|
||||||
|
id,
|
||||||
|
text,
|
||||||
|
iconSrc,
|
||||||
|
customClass = '',
|
||||||
|
classNames,
|
||||||
|
closeMenu,
|
||||||
|
disabled = false,
|
||||||
|
callback = () => null,
|
||||||
|
}) => {
|
||||||
const handleOnClick = (e) => {
|
const handleOnClick = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
@ -250,7 +254,12 @@ const Field = ({ id, text, iconSrc, customClass = '', closeMenu, disabled = fals
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`field ${customClass ? ` ${customClass}` : ''}`}>
|
<div className={`field ${customClass ? ` ${customClass}` : ''}`}>
|
||||||
<Button.UnstyledButton onClick={handleOnClick} styles={{ height: '28px' }} disabled={disabled}>
|
<Button.UnstyledButton
|
||||||
|
onClick={handleOnClick}
|
||||||
|
styles={{ height: '28px' }}
|
||||||
|
classNames={classNames}
|
||||||
|
disabled={disabled}
|
||||||
|
>
|
||||||
<Button.Content title={text} iconSrc={iconSrc} direction="left" />
|
<Button.Content title={text} iconSrc={iconSrc} direction="left" />
|
||||||
</Button.UnstyledButton>
|
</Button.UnstyledButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,16 @@ $btn-dark-color: #FFFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.page-permission-btn {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 5px;
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
opacity: 1 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.notification-dot {
|
.notification-dot {
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 90e11056ebdb40f0560ece55198c3ecc8ead4988
|
Subproject commit 78c6a52262ba2df4a0771ae778178d2d74bb7517
|
||||||
Loading…
Reference in a new issue