Skip to content

Commit 6b5047c

Browse files
committed
feat: disable other settings tabs when image handling is disabled [closes Codeinwp/optimole-service#1386]
1 parent e04e30b commit 6b5047c

File tree

1 file changed

+7
-1
lines changed
  • assets/src/dashboard/parts/connected/settings

1 file changed

+7
-1
lines changed

assets/src/dashboard/parts/connected/settings/Menu.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,19 @@ const Menu = ({
9393
<div className="basis-1/5">
9494
<ul className="grid m-0 gap-1">
9595
{menuItems.map( item => {
96+
const disabled = 'enabled' !== settings?.image_replacer && 'general' !== item.value;
9697
const isActive = tab === item.value || ( item.children && item.children.some( child => child.value === tab ) );
9798

9899

99-
const buttonClasses = classnames({ '!text-info': isActive }, 'w-full bg-transparent border-0 flex items-center appearance-none not-italic font-semibold text-base text-purple-gray cursor-pointer hover:text-info py-2' );
100+
const buttonClasses = classnames(
101+
{ '!text-info': isActive },
102+
{ 'opacity-50 pointer-events-none': disabled },
103+
'w-full bg-transparent border-0 flex items-center appearance-none not-italic font-semibold text-base text-purple-gray cursor-pointer hover:text-info py-2'
104+
);
100105
return (
101106
<li key={item.value} className='m-0'>
102107
<button
108+
disabled={disabled}
103109
className={buttonClasses}
104110
onClick={() => setTab( item.value )}
105111
>

0 commit comments

Comments
 (0)