Emails
3 months ago
EngagementChart
3 months ago
MediaHub
3 months ago
Onboarding
3 months ago
Popup
3 months ago
Skeletons
2 months ago
WhatsNew
3 months ago
charts
3 months ago
test
3 months ago
AdminMenuSync.js
3 months ago
ChartEmptyState.js
3 months ago
ChooseDate.js
3 months ago
ColorPicker.js
3 months ago
DashboardPromos.js
2 days ago
ExtendPlugins.js
3 months ago
Filters.js
3 months ago
Link.js
3 months ago
McpPromoBanner.js
2 days ago
Navbar.js
2 months ago
NoFound.js
3 months ago
PageHeader.js
3 months ago
PluginRecommendations.js
3 months ago
PostScheduleField.js
3 months ago
PrestoPlayerIcon.js
3 months ago
ProGateOverlay.js
3 months ago
PromoBanner.js
2 days ago
QuickAccess.js
2 weeks ago
RankedTable.js
3 months ago
SkinPromoBanner.js
2 days ago
StatCard.js
3 months ago
TopMedia.js
3 months ago
TopPerformingMedia.js
3 months ago
TopUsers.js
3 months ago
TruncatedTitle.js
3 months ago
UpgradeNotice.js
3 months ago
UpgradeToPro.js
2 weeks ago
VideoModal.js
3 months ago
WelcomeBanner.js
3 months ago
QuickAccess.js
128 lines
| 1 | import React from 'react'; |
| 2 | const { __ } = wp.i18n; |
| 3 | import { Container, Label, Text } from '@bsf/force-ui'; |
| 4 | import { |
| 5 | HelpCircle, |
| 6 | Star, |
| 7 | Headphones, |
| 8 | Crown, |
| 9 | Sparkles, |
| 10 | Bot, |
| 11 | } from 'lucide-react'; |
| 12 | import useUpgradeCTA from '../hooks/useUpgradeCTA'; |
| 13 | import { useHistory } from '../router/router'; |
| 14 | |
| 15 | const QuickAccess = () => { |
| 16 | // Plugin status data from WordPress |
| 17 | const prestoPlayerData = window.prestoPlayer || {}; |
| 18 | const history = useHistory(); |
| 19 | const upgrade = useUpgradeCTA( history ); |
| 20 | |
| 21 | const quickAccessItems = [ |
| 22 | { |
| 23 | id: 'ai', |
| 24 | icon: <Bot className="w-4 h-4" />, |
| 25 | label: __( 'Explore AI Abilities', 'presto-player' ), |
| 26 | badge: __( 'New', 'presto-player' ), |
| 27 | link: `${ |
| 28 | prestoPlayerData?.dashboardUrl || '#' |
| 29 | }&tab=Settings§ion=mcp`, |
| 30 | internal: true, |
| 31 | // The MCP section reads /wp/v2/settings, so only show the shortcut to |
| 32 | // users who can actually load it. |
| 33 | condition: |
| 34 | prestoPlayerData?.abilitiesSupported !== false && |
| 35 | prestoPlayerData?.canManageOptions !== false, |
| 36 | }, |
| 37 | { |
| 38 | id: '1', |
| 39 | icon: <Sparkles className="w-4 h-4" />, |
| 40 | label: __( 'Guided Onboarding', 'presto-player' ), |
| 41 | link: prestoPlayerData?.onboardingUrl || '#', |
| 42 | internal: true, |
| 43 | }, |
| 44 | { |
| 45 | id: '2', |
| 46 | icon: <HelpCircle className="w-4 h-4" />, |
| 47 | label: __( 'Help Center', 'presto-player' ), |
| 48 | link: 'https://prestoplayer.com/docs/', |
| 49 | }, |
| 50 | { |
| 51 | id: '3', |
| 52 | icon: <Headphones className="w-4 h-4" />, |
| 53 | label: __( 'Open Support Ticket', 'presto-player' ), |
| 54 | link: 'https://prestoplayer.com/contact/', |
| 55 | }, |
| 56 | { |
| 57 | id: '4', |
| 58 | icon: <Star className="w-4 h-4" />, |
| 59 | label: __( 'Leave Us a Review', 'presto-player' ), |
| 60 | link: 'https://wordpress.org/support/plugin/presto-player/reviews/#new-post', |
| 61 | }, |
| 62 | { |
| 63 | id: '5', |
| 64 | icon: <Crown className="w-4 h-4" />, |
| 65 | label: upgrade.label, |
| 66 | link: upgrade.href, |
| 67 | internal: upgrade.isProUnlicensed, |
| 68 | onClick: upgrade.onClick, |
| 69 | condition: ! upgrade.isPremium, |
| 70 | }, |
| 71 | ]; |
| 72 | |
| 73 | return ( |
| 74 | <Container |
| 75 | containerType="flex" |
| 76 | direction="column" |
| 77 | className="p-3 border-0.5 border-solid rounded-xl shadow-sm bg-background-primary border-border-subtle" |
| 78 | gap="xs" |
| 79 | > |
| 80 | <Container.Item className="p-1 md:w-full lg:w-full"> |
| 81 | <Label className="font-semibold"> |
| 82 | { __( 'Quick Access', 'presto-player' ) } |
| 83 | </Label> |
| 84 | </Container.Item> |
| 85 | <Container.Item className="flex flex-col gap-1 p-1 rounded-lg md:w-full lg:w-full bg-field-primary-background"> |
| 86 | { quickAccessItems.map( |
| 87 | ( button ) => |
| 88 | button?.condition !== false && ( |
| 89 | <Text |
| 90 | key={ button.id } |
| 91 | as="a" |
| 92 | href={ button.link } |
| 93 | target={ button.internal ? '_self' : '_blank' } |
| 94 | rel={ button.internal ? undefined : 'noreferrer' } |
| 95 | onClick={ button.onClick } |
| 96 | aria-label={ button.label } |
| 97 | className="flex items-center gap-1 p-2 rounded-md bg-background-primary shadow-soft-shadow-inner no-underline hover:no-underline cursor-pointer" |
| 98 | > |
| 99 | <Container |
| 100 | containerType="flex" |
| 101 | direction="row" |
| 102 | className="items-center gap-1 p-1" |
| 103 | align="center" |
| 104 | > |
| 105 | <Container.Item className="flex items-center justify-center text-text-primary"> |
| 106 | { button.icon } |
| 107 | </Container.Item> |
| 108 | <Container.Item className="flex items-start gap-1.5"> |
| 109 | <Text className="px-1 py-0 text-sm font-medium text-text-primary"> |
| 110 | { button.label } |
| 111 | </Text> |
| 112 | { button.badge && ( |
| 113 | <span className="mt-0.5 shrink-0 rounded-full bg-brand-primary-600 px-1 text-[9px] font-semibold uppercase tracking-wide text-white"> |
| 114 | { button.badge } |
| 115 | </span> |
| 116 | ) } |
| 117 | </Container.Item> |
| 118 | </Container> |
| 119 | </Text> |
| 120 | ) |
| 121 | ) } |
| 122 | </Container.Item> |
| 123 | </Container> |
| 124 | ); |
| 125 | }; |
| 126 | |
| 127 | export default QuickAccess; |
| 128 |