📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
allowedToManage check for funnels
Blue Mouse49ee414febca
diff --git a/app/modals/NewFunnel.tsx b/app/modals/NewFunnel.tsxindex ae11526c3..b40f88506 100644--- a/app/modals/NewFunnel.tsx+++ b/app/modals/NewFunnel.tsx@@ -21,6 +21,7 @@ interface INewFunnel {isOpened: booleanpid: stringloading: boolean+ allowedToManage: booleanfunnel?: IFunnelprojectPassword?: string}@@ -36,6 +37,7 @@ const NewFunnel = ({loading,project,projectPassword,+ allowedToManage,}: INewFunnel): JSX.Element => {const { t } = useTranslation('common')const [name, setName] = useState<string>(funnel?.name || '')@@ -115,6 +117,7 @@ const NewFunnel = ({label={t('modals.funnels.name')}value={name}onChange={(e) => setName(e.target.value)}+ disabled={!allowedToManage}/><p className='mt-5 text-sm font-medium text-gray-700 dark:text-gray-200'>{t('modals.funnels.steps')}</p>{_map(steps, (step, index) => (@@ -133,8 +136,9 @@ const NewFunnel = ({setSteps(newSteps)}}title={step || ''}+ disabled={!allowedToManage}/>- {steps.length > MIN_FUNNEL_STEPS && (+ {steps.length > MIN_FUNNEL_STEPS && allowedToManage && (<TrashIconrole='button'aria-label='Remove step'@@ -148,7 +152,7 @@ const NewFunnel = ({)}</div>))}- {steps.length < MAX_FUNNEL_STEPS && (+ {steps.length < MAX_FUNNEL_STEPS && allowedToManage && (<ponClick={() => {setSteps([...steps, null])@@ -163,7 +167,7 @@ const NewFunnel = ({}title={funnel ? t('modals.funnels.editTitle') : t('modals.funnels.addTitle')}isOpened={isOpened}- submitDisabled={!name || !allStepsFulfilled}+ submitDisabled={!name || !allStepsFulfilled || !allowedToManage}overflowVisible/>)diff --git a/app/pages/Project/View/ViewProject.tsx b/app/pages/Project/View/ViewProject.tsxindex 85d69628e..de51fbf8a 100644--- a/app/pages/Project/View/ViewProject.tsx+++ b/app/pages/Project/View/ViewProject.tsx@@ -3958,6 +3958,7 @@ const ViewProject = ({deleteFunnel={onFunnelDelete}loading={funnelActionLoading}authenticated={authenticated}+ allowedToManage={allowedToManage}/>)}{activeTab === PROJECT_TABS.funnels && !activeFunnel && _isEmpty(project.funnels) && (@@ -4850,6 +4851,7 @@ const ViewProject = ({pid={id}funnel={funnelToEdit}isOpened={isNewFunnelOpened}+ allowedToManage={allowedToManage}onClose={() => {setIsNewFunnelOpened(false)setFunnelToEdit(undefined)diff --git a/app/pages/Project/View/components/FunnelsList.tsx b/app/pages/Project/View/components/FunnelsList.tsxindex b067ead98..0691321cd 100644--- a/app/pages/Project/View/components/FunnelsList.tsx+++ b/app/pages/Project/View/components/FunnelsList.tsx@@ -12,6 +12,7 @@ interface IFunnelsList {deleteFunnel: (id: string) => voidloading: booleanauthenticated: boolean+ allowedToManage: boolean}interface IFunnelCard {@@ -20,13 +21,21 @@ interface IFunnelCard {openFunnel: (funnel: IFunnel) => voiddeleteFunnel: (id: string) => voidloading: boolean+ allowedToManage: boolean}interface IAddFunnel {openFunnelSettings: (funnel?: IFunnel) => void}-const FunnelCard = ({ funnel, openFunnelSettings, openFunnel, deleteFunnel, loading }: IFunnelCard): JSX.Element => {+const FunnelCard = ({+ funnel,+ openFunnelSettings,+ openFunnel,+ deleteFunnel,+ loading,+ allowedToManage,+}: IFunnelCard): JSX.Element => {const { t } = useTranslation()return (@@ -48,17 +57,22 @@ const FunnelCard = ({ funnel, openFunnelSettings, openFunnel, deleteFunnel, load><AdjustmentsVerticalIcon className='w-6 h-6 text-gray-800 dark:text-slate-400 hover:text-gray-900 dark:hover:text-slate-500' /></button>- <TrashIcon- onClick={(e) => {- e.stopPropagation()- deleteFunnel(funnel.id)- }}- role='button'- aria-label={t('common.delete')}- className={cx('w-6 h-6 text-gray-800 dark:text-slate-400 hover:text-gray-900 dark:hover:text-slate-500', {- 'cursor-not-allowed': loading,- })}- />+ {allowedToManage && (+ <TrashIcon+ onClick={(e) => {+ e.stopPropagation()+ deleteFunnel(funnel.id)+ }}+ role='button'+ aria-label={t('common.delete')}+ className={cx(+ 'w-6 h-6 text-gray-800 dark:text-slate-400 hover:text-gray-900 dark:hover:text-slate-500',+ {+ 'cursor-not-allowed': loading,+ },+ )}+ />+ )}</div></div></div>@@ -101,6 +115,7 @@ const FunnelsList = ({deleteFunnel,loading,authenticated,+ allowedToManage,}: IFunnelsList): JSX.Element => (<ul className='grid grid-cols-1 gap-x-6 gap-y-3 lg:gap-y-6 lg:grid-cols-3 mt-4'>{_map(funnels, (funnel) => (@@ -111,9 +126,10 @@ const FunnelsList = ({openFunnelSettings={openFunnelSettings}openFunnel={openFunnel}loading={loading}+ allowedToManage={allowedToManage}/>))}- {authenticated && <AddFunnel openFunnelSettings={openFunnelSettings} />}+ {authenticated && allowedToManage && <AddFunnel openFunnelSettings={openFunnelSettings} />}</ul>)diff --git a/app/ui/Combobox.tsx b/app/ui/Combobox.tsxindex a5d0d17b5..79382554b 100644--- a/app/ui/Combobox.tsx+++ b/app/ui/Combobox.tsx@@ -18,6 +18,7 @@ interface ISelect {labelExtractor?: (item: any, index: number) => stringkeyExtractor?: (item: any, index: number) => stringonSelect: (item: any) => void+ disabled?: booleanplaceholder?: string}@@ -30,6 +31,7 @@ const Combobox = ({onSelect,buttonClassName,placeholder,+ disabled,}: ISelect): JSX.Element => {const { t } = useTranslation('common')const [query, setQuery] = useState('')@@ -43,7 +45,7 @@ const Combobox = ({})return (- <HeadlessCombobox value={title} onChange={onSelect}>+ <HeadlessCombobox disabled={disabled} value={title} onChange={onSelect}><div className={cx('relative mt-1', className)}><div className='relative w-full cursor-default rounded-lg'><HeadlessCombobox.Input@@ -120,6 +122,7 @@ Combobox.propTypes = {labelExtractor: PropTypes.func,keyExtractor: PropTypes.func,onSelect: PropTypes.func.isRequired,+ disabled: PropTypes.bool,}Combobox.defaultProps = {@@ -129,6 +132,7 @@ Combobox.defaultProps = {buttonClassName: '',labelExtractor: null,keyExtractor: null,+ disabled: false,}export default memo(Combobox)