ConfirmDialog.js
1 month ago
LabelWithTooltip.js
1 month ago
ProGate.js
1 month ago
SectionCard.js
1 month ago
SettingsDataProvider.js
1 month ago
SettingsPageShell.js
1 month ago
UnsavedChangesDialog.js
1 month ago
navigationGuard.js
1 month ago
ProGate.js
58 lines
| 1 | import { Button, Container, Title, Text } from '@bsf/force-ui'; |
| 2 | import { Lock } from 'lucide-react'; |
| 3 | import useUpgradeCTA from '../../../hooks/useUpgradeCTA'; |
| 4 | import { useHistory } from '../../../router/router'; |
| 5 | |
| 6 | const ProGate = ( { children, enabled, title, description } ) => { |
| 7 | const history = useHistory(); |
| 8 | const { label, href, onClick, isProUnlicensed } = useUpgradeCTA( history ); |
| 9 | |
| 10 | if ( enabled ) { |
| 11 | return children; |
| 12 | } |
| 13 | |
| 14 | return ( |
| 15 | <div className="relative min-h-[260px] overflow-hidden p-4"> |
| 16 | <div |
| 17 | inert="" |
| 18 | aria-hidden="true" |
| 19 | className="blur-[2px] opacity-60 pointer-events-none select-none px-6 py-4" |
| 20 | > |
| 21 | { children } |
| 22 | </div> |
| 23 | <div className="absolute inset-0 bg-white/40 flex items-center justify-center p-4"> |
| 24 | <Container |
| 25 | direction="column" |
| 26 | className="bg-white rounded-lg border border-border-subtle shadow-pro-gate-cta p-6 max-w-[340px] w-full items-center text-center gap-4" |
| 27 | > |
| 28 | <div className="w-11 h-11 rounded-full flex items-center justify-center bg-background-secondary"> |
| 29 | <Lock className="w-5 h-5 text-icon-secondary" /> |
| 30 | </div> |
| 31 | |
| 32 | <Container direction="column" className="items-center gap-1.5"> |
| 33 | <Title tag="h4" title={ title } size="sm" /> |
| 34 | <Text size="sm" className="text-text-secondary leading-5"> |
| 35 | { description } |
| 36 | </Text> |
| 37 | </Container> |
| 38 | |
| 39 | <Button |
| 40 | tag="a" |
| 41 | href={ href } |
| 42 | target={ isProUnlicensed ? '_self' : '_blank' } |
| 43 | rel={ isProUnlicensed ? undefined : 'noreferrer' } |
| 44 | onClick={ onClick } |
| 45 | variant="primary" |
| 46 | size="sm" |
| 47 | className="mt-1 no-underline hover:no-underline" |
| 48 | > |
| 49 | { label } |
| 50 | </Button> |
| 51 | </Container> |
| 52 | </div> |
| 53 | </div> |
| 54 | ); |
| 55 | }; |
| 56 | |
| 57 | export default ProGate; |
| 58 |