one-click-accessibility/modules/settings/assets/js/layouts/logo-settings.js
Nirbhay Singh 83d2a9f641
[APP-1105] Add pro capabilities (#205)
* add: volume and solid crown icon

* add: volume and crown icons to export

* update: refactor menu item to a new component

* add: screen reader to the menu items and reorganize them

* add: pro item infotip content

* add: capabilities item and pro info tip to exports

* update: import ProInfoTip component and change disabled logic

* update: imports

* update: refactor pro item infotip into the separate component

* update: refactor infotip and add comments

* add: custom switch component

* add: logo settings layout

* update: switch component

* add: useToggleSetting hook to manage widget settings.

* update: move pro feature key to a separate constant

* fix: pro icon style

* update: remove branding key

* update: pro enable check structure

* update: pro enabled check structure

* update: key name

* update: update key before checking for it

* fix: null error

* add: update logic to get the tools settings based on plan

* update: exclude remove-elementor-label from the minimum option rule

* update: add formlabel and eventnames

* add: logic to deactivate the features which are disabled for the plan

* fix: PHP warning

* fix: keyword name

* add: GOLINKS

* add: open link function

* fix: PHP warning undefined key

* update: logic to show the icon and added golinks
2025-03-17 13:12:30 +02:00

68 lines
1.7 KiB
JavaScript

import Card from '@elementor/ui/Card';
import CardHeader from '@elementor/ui/CardHeader';
import Typography from '@elementor/ui/Typography';
import { CustomSwitch, ProItemInfotip } from '@ea11y/components';
import { useSettings, useToggleSetting } from '@ea11y/hooks';
import { __ } from '@wordpress/i18n';
import { PRO_FEATURES } from '../constants/index';
const LogoSettings = () => {
const { widgetMenuSettings, planData } = useSettings();
const { toggleMenu } = useToggleSetting();
/**
* Check if the feature is enabled in user's plan.
* @return {boolean} true if the feature is enabled.
*/
const isProEnabled = () => {
const key = PRO_FEATURES.REMOVE_BRANDING.replaceAll('-', '_');
return planData?.plan?.features?.[key];
};
return (
<Card variant="outlined">
<CardHeader
title={
<>
{__('Ally by Elementor logo', 'pojo-accessibility')}
{!isProEnabled() && (
<ProItemInfotip
childKey={PRO_FEATURES.REMOVE_BRANDING}
childValue="pro"
source="icon"
showIcon={true}
/>
)}
</>
}
subheader={
<Typography variant="body2">
{__(
'Hide the Elementor logo from the bottom of your widget menu.',
'pojo-accessibility',
)}
</Typography>
}
action={
<ProItemInfotip
childKey={PRO_FEATURES.REMOVE_BRANDING}
childValue="pro"
source="toggle"
enabled={isProEnabled()}
>
<CustomSwitch
disabled={!isProEnabled()}
onChange={() => toggleMenu('pro', PRO_FEATURES?.REMOVE_BRANDING)}
checked={
widgetMenuSettings?.[PRO_FEATURES?.REMOVE_BRANDING]?.enabled ||
false
}
/>
</ProItemInfotip>
}
/>
</Card>
);
};
export default LogoSettings;