ToolJet/frontend/src/HomePage/AppMenu.jsx
Midhun G S 0c5ab3484c
Platform LTS Final fixes (#13221)
* Cloud Blocker bugfixes (#13160)

* fix

* minor email fixes

* settings menu fix

* fixes

* Bugfixes/whitelabelling apis (#13180)

* white-labelling apis

* removed consoles logs

* reverts

* fixes for white-labelling

* fixes

* reverted breadcrumb changes (#13194)

* fixes for getting public sso configurations

* fix for enable signup on cloud

* Cloud Trial and Banners (#13182)

* Cloud Blocker bugfixes (#13160)

* fix

* minor email fixes

* settings menu fix

* fixes

* Cloud Trial and Banners

* revert

* initial commit

* Added website onboarding APIs

* moved ai onboarding controller to auth module

* ee banners

* fix

---------

Co-authored-by: Rohan Lahori <64496391+rohanlahori@users.noreply.github.com>
Co-authored-by: gsmithun4 <gsmithun4@gmail.com>

* Bugfixes/minor UI fixes-CLoud (#13203)

* Bugfixes/UI bugs platform 1 (#13205)

* cleanup

* Audit logs fix

* gitignore changes

* postgrest configs removed

* removed unused import

* improvements

* fix

* improved startup logs

* Platform cypress fix (#13192)

* Cloud Blocker bugfixes (#13160)

* fix

* minor email fixes

* settings menu fix

* fixes

* Bugfixes/whitelabelling apis (#13180)

* white-labelling apis

* removed consoles logs

* reverts

* fixes for white-labelling

* fixes

* Cypress fix

* reverted breadcrumb changes (#13194)

* cypress fix

* title fix

* fixes for getting public sso configurations

---------

Co-authored-by: Rohan Lahori <64496391+rohanlahori@users.noreply.github.com>
Co-authored-by: gsmithun4 <gsmithun4@gmail.com>

* deployment fix

* added interfaces and permissions

* Bugfixes/lts 3.6 branch 1 platform (#13238)

* fix

* Licensing Banners Fixes Cloud and EE (#13241)

* design: Adds license buttons to header

* Refactor header actions

* Cloud Blocker bugfixes (#13160)

* fix

* minor email fixes

* settings menu fix

* fixes

* subscription page

* fix banners

---------

Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
Co-authored-by: Rohan Lahori <64496391+rohanlahori@users.noreply.github.com>

* fix for public apps

* fix

* CE Instance Signup bug (#13254)

* CE Instance Signup bug

* improvement

* fix

* Add WEBSITE_SIGNUP_URL to deployment environment variables

* Add WEBSITE_SIGNUP_URL to environment variables for deployment

* Super admin banner fix (#13262)

* Git Sync Fixes  (#13249)

* git-sync module changes

* git sync fixes

* added app resource guard

* git-sync fixes

* removed require feature

* fix

* review comment changes

* ypress fix

* App logo fix inside app builder

* fix for subpath cache

* fix (#13274)

* platform-cypress-fix (#13271)

* git sync fixes (#13277)

* fix

* Add data-cy for new components (#13289)

---------

Co-authored-by: Rohan Lahori <64496391+rohanlahori@users.noreply.github.com>
Co-authored-by: Rudhra Deep Biswas <98055396+rudeUltra@users.noreply.github.com>
Co-authored-by: Ajith KV <ajith.jaban@gmail.com>
Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
Co-authored-by: rohanlahori <rohanlahori99@gmail.com>
Co-authored-by: Adish M <adish.madhu@gmail.com>
Co-authored-by: Rudra deep Biswas <rudra21ultra@gmail.com>
2025-07-09 22:36:41 +05:30

128 lines
4.8 KiB
JavaScript

import React from 'react';
import OverlayTrigger from 'react-bootstrap/OverlayTrigger';
import Popover from 'react-bootstrap/Popover';
import { useTranslation } from 'react-i18next';
export const AppMenu = function AppMenu({
deleteApp,
exportApp,
canCreateApp,
canDeleteApp,
canUpdateApp,
onMenuOpen,
openAppActionModal,
darkMode,
currentFolder,
popoverVisible,
setMenuOpen,
appType,
}) {
const { t } = useTranslation();
const isModuleApp = appType === 'module';
const Field = ({ text, onClick, customClass }) => {
const closeMenu = () => {
document.body.click();
onClick();
};
return (
<div className={`field mb-3${customClass ? ` ${customClass}` : ''}`}>
<span
role="button"
onClick={() => {
closeMenu();
}}
data-cy={`${text.toLowerCase().replace(/\s+/g, '-')}-card-option`}
>
{text}
</span>
</div>
);
};
return (
<OverlayTrigger
trigger="click"
placement="top-start"
rootClose
onToggle={onMenuOpen}
onExit={() => setMenuOpen(false)}
show={popoverVisible}
container={document.getElementsByClassName('home-page-content')[0]}
overlay={
<div>
<Popover id="popover-app-menu" className={darkMode && 'dark-theme'} placement="bottom">
<Popover.Body bsPrefix="popover-body">
<div data-cy="card-options">
{canUpdateApp && (
<Field
text={t(
'homePage.appCard.renameApp',
appType === 'workflow' ? 'Rename workflow' : appType === 'module' ? 'Rename module' : 'Rename app'
)}
onClick={() => openAppActionModal('rename-app')}
/>
)}
{canUpdateApp && (
<Field
text={t('homePage.appCard.changeIcon', 'Change Icon')}
onClick={() => openAppActionModal('change-icon')}
/>
)}
{canCreateApp && appType !== 'module' && (
<>
<Field
text={t('homePage.appCard.addToFolder', 'Add to folder')}
onClick={() => openAppActionModal('add-to-folder')}
/>
{currentFolder.id && (
<Field
text={t('homePage.appCard.removeFromFolder', 'Remove from folder')}
onClick={() => openAppActionModal('remove-app-from-folder')}
/>
)}
</>
)}
{canUpdateApp && canCreateApp && appType !== 'workflow' && (
<>
<Field
text={
appType === 'workflow' ? 'Clone workflow' : appType === 'module' ? 'Clone module' : 'Clone app'
}
onClick={() => openAppActionModal('clone-app')}
/>
<Field text={appType === 'module' ? 'Export module' : 'Export app'} onClick={exportApp} />
</>
)}
{canDeleteApp && (
<Field
text={
appType === 'workflow'
? t('homePage.appCard.deleteWorkflow', 'Delete workflow')
: appType === 'front-end'
? t('homePage.appCard.deleteApp', 'Delete app')
: 'Delete module'
}
customClass="field__danger"
onClick={deleteApp}
/>
)}
</div>
</Popover.Body>
</Popover>
</div>
}
>
<div className={'cursor-pointer menu-ico menu-icon--trigger'} data-cy={`app-card-menu-icon`}>
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
fillRule="evenodd"
clipRule="evenodd"
d="M12.8335 9.91667C12.8335 9.27233 13.3558 8.75 14.0002 8.75C14.6445 8.75 15.1668 9.27233 15.1668 9.91667C15.1668 10.561 14.6445 11.0833 14.0002 11.0833C13.3558 11.0833 12.8335 10.561 12.8335 9.91667ZM12.8335 14C12.8335 13.3557 13.3558 12.8333 14.0002 12.8333C14.6445 12.8333 15.1668 13.3557 15.1668 14C15.1668 14.6443 14.6445 15.1667 14.0002 15.1667C13.3558 15.1667 12.8335 14.6443 12.8335 14ZM12.8335 18.0833C12.8335 17.439 13.3558 16.9167 14.0002 16.9167C14.6445 16.9167 15.1668 17.439 15.1668 18.0833C15.1668 18.7277 14.6445 19.25 14.0002 19.25C13.3558 19.25 12.8335 18.7277 12.8335 18.0833Z"
fill="#11181C"
/>
</svg>
</div>
</OverlayTrigger>
);
};