disco
/
backend
/
views
/
components
/
Main
/
pages
/
Rules
/
Tabs
/
DesignBlock
/
TextHighlight
/
TextHighlight.jsx
TextHighlight.jsx in Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO 1.3.54, at backend/views/components/Main/pages/Rules/Tabs/DesignBlock/TextHighlight/TextHighlight.jsx
| 1 | import { useDispatch, useSelector } from 'react-redux'; |
| 2 | import { updateTextHighlight } from '../../../../../features/discount/discountSlice'; |
| 3 | import useIsPro from '../../../../../hooks/useIsPro'; |
| 4 | import BadgeActions from '../components/BadgeActions'; |
| 5 | import BadgeComponentContainer from '../components/BadgeComponentContainer'; |
| 6 | import BadgeTitle from '../components/BadgeTitle'; |
| 7 | import ProFeatureButton from '../components/ProFeatureButton'; |
| 8 | import Status from '../components/Status'; |
| 9 | import TextHighlightCard from './components/TextHighlightCard'; |
| 10 | import { __ } from '@wordpress/i18n'; |
| 11 | |
| 12 | const TextHighlight = () => { |
| 13 | const { text_highlight } = useSelector( |
| 14 | (state) => state.discount.design_blocks |
| 15 | ); |
| 16 | const isPro = useIsPro(); |
| 17 | const tryNowUrl = |
| 18 | 'https://discoplugin.com/pricing/?utm_source=bulk-table&utm_medium=free-to-pro&utm_campaign=from-display-page&utm_id=1'; |
| 19 | |
| 20 | const dispatch = useDispatch(); |
| 21 | |
| 22 | const handleStatus = (status) => { |
| 23 | dispatch(updateTextHighlight({ name: 'enable', value: status })); |
| 24 | }; |
| 25 | |
| 26 | return ( |
| 27 | <BadgeComponentContainer> |
| 28 | <TextHighlightCard /> |
| 29 | <BadgeTitle |
| 30 | title={__('Text Highlight', 'disco')} |
| 31 | url="https://discoplugin.com/docs/display-text-highlight/" |
| 32 | className="disco-mt-3" |
| 33 | /> |
| 34 | <BadgeActions> |
| 35 | <Status |
| 36 | status={text_highlight?.enable || false} |
| 37 | handleStatus={handleStatus} |
| 38 | disabled={!isPro} |
| 39 | dataTestid="text-highlight-status" |
| 40 | /> |
| 41 | <ProFeatureButton |
| 42 | tryNowUrl={tryNowUrl} |
| 43 | componentToEdit="TextHighlightEdit" |
| 44 | testId="text-highlight" |
| 45 | /> |
| 46 | </BadgeActions> |
| 47 | </BadgeComponentContainer> |
| 48 | ); |
| 49 | }; |
| 50 | |
| 51 | export default TextHighlight; |
| 52 |