Emails
1 month ago
EngagementChart
1 month ago
MediaHub
1 month ago
Onboarding
1 month ago
Popup
1 month ago
Skeletons
1 week ago
WhatsNew
1 month ago
charts
1 month ago
test
1 month ago
AdminMenuSync.js
1 month ago
ChartEmptyState.js
1 month ago
ChooseDate.js
1 month ago
ColorPicker.js
1 month ago
ExtendPlugins.js
1 month ago
Filters.js
1 month ago
Link.js
1 month ago
Navbar.js
1 week ago
NoFound.js
1 month ago
PageHeader.js
1 month ago
PluginRecommendations.js
1 month ago
PostScheduleField.js
1 month ago
PrestoPlayerIcon.js
1 month ago
ProGateOverlay.js
1 month ago
QuickAccess.js
1 month ago
RankedTable.js
1 month ago
StatCard.js
1 month ago
TopMedia.js
1 month ago
TopPerformingMedia.js
1 month ago
TopUsers.js
1 month ago
TruncatedTitle.js
1 month ago
UpgradeNotice.js
1 month ago
UpgradeToPro.js
1 month ago
VideoModal.js
1 month ago
WelcomeBanner.js
1 month ago
WelcomeBanner.js
116 lines
| 1 | import React from "react"; |
| 2 | const { __ } = wp.i18n; |
| 3 | import { Button, Container, Text, Title } from "@bsf/force-ui"; |
| 4 | import { Plus, ExternalLink } from "lucide-react"; |
| 5 | |
| 6 | const VIDEO_ID = "7ibtk_KTgCw"; |
| 7 | const THUMBNAIL_URL = `https://img.youtube.com/vi/${VIDEO_ID}/hqdefault.jpg`; |
| 8 | |
| 9 | const WelcomeBanner = ({ onVideoOpen, videoTriggerRef }) => { |
| 10 | return ( |
| 11 | <Container |
| 12 | className="p-4 border border-solid border-border-subtle bg-background-primary rounded-xl shadow-soft-shadow overflow-clip" |
| 13 | direction={{ sm: "column", md: "row" }} |
| 14 | gap="lg" |
| 15 | align="center" |
| 16 | > |
| 17 | |
| 18 | {/* Content */} |
| 19 | <Container.Item className="md:w-[60%] lg:w-[70%]"> |
| 20 | <Container direction="column" gap="lg" className="px-2 py-2"> |
| 21 | <Container.Item> |
| 22 | <Title |
| 23 | size="lg" |
| 24 | tag="h3" |
| 25 | title={__("Welcome to Presto Player!", "presto-player")} |
| 26 | /> |
| 27 | <Text className="text-text-secondary mt-1 font-normal text-sm"> |
| 28 | {__( |
| 29 | "We're excited to help you create amazing video experience for your WordPress site. Presto Player makes it simple to add powerful, customizable video players that engage your audience.", |
| 30 | "presto-player" |
| 31 | )} |
| 32 | </Text> |
| 33 | </Container.Item> |
| 34 | <Container.Item> |
| 35 | <Container className="gap-3"> |
| 36 | <Button |
| 37 | icon={<Plus className="w-5 h-5" />} |
| 38 | iconPosition="left" |
| 39 | size="md" |
| 40 | tag="button" |
| 41 | type="button" |
| 42 | variant="primary" |
| 43 | onClick={() => { |
| 44 | window.location.href = |
| 45 | window.prestoPlayer?.createMediaUrl || |
| 46 | "post-new.php?post_type=pp_video_block"; |
| 47 | }} |
| 48 | > |
| 49 | {__("Create Media", "presto-player")} |
| 50 | </Button> |
| 51 | <Button |
| 52 | icon={<ExternalLink className="w-5 h-5" />} |
| 53 | iconPosition="right" |
| 54 | size="md" |
| 55 | tag="button" |
| 56 | type="button" |
| 57 | variant="ghost" |
| 58 | onClick={() => { |
| 59 | window.open( |
| 60 | "https://www.youtube.com/playlist?list=PLiEQfBIWdTTLiE6ch4DsqlsfRIrJ1emLV", |
| 61 | "_blank" |
| 62 | ); |
| 63 | }} |
| 64 | > |
| 65 | {__("Learn More", "presto-player")} |
| 66 | <span className="sr-only"> |
| 67 | {__("(opens in a new tab)", "presto-player")} |
| 68 | </span> |
| 69 | </Button> |
| 70 | </Container> |
| 71 | </Container.Item> |
| 72 | </Container> |
| 73 | </Container.Item> |
| 74 | |
| 75 | {/* Video thumbnail */} |
| 76 | <Container.Item className="shrink-0 w-full md:w-[360px] p-2"> |
| 77 | <div |
| 78 | ref={videoTriggerRef} |
| 79 | className="relative cursor-pointer w-full overflow-hidden rounded-lg focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500 focus-visible:outline-none" |
| 80 | onClick={() => onVideoOpen(true)} |
| 81 | role="button" |
| 82 | aria-label={__("Play introduction video", "presto-player")} |
| 83 | tabIndex={0} |
| 84 | onKeyDown={(e) => { |
| 85 | if (e.key === "Enter" || e.key === " ") { |
| 86 | e.preventDefault(); |
| 87 | onVideoOpen(true); |
| 88 | } |
| 89 | }} |
| 90 | > |
| 91 | <img |
| 92 | src={THUMBNAIL_URL} |
| 93 | alt="" |
| 94 | role="presentation" |
| 95 | className="w-full h-full object-cover rounded-lg aspect-video cursor-pointer" |
| 96 | loading="lazy" |
| 97 | /> |
| 98 | <div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-10 h-10 flex items-center justify-center bg-black bg-opacity-50 rounded-full"> |
| 99 | <svg |
| 100 | className="w-6 h-6 text-white" |
| 101 | viewBox="0 0 24 24" |
| 102 | xmlns="http://www.w3.org/2000/svg" |
| 103 | fill="currentColor" |
| 104 | aria-hidden="true" |
| 105 | > |
| 106 | <path d="M8 5v14l11-7L8 5z"></path> |
| 107 | </svg> |
| 108 | </div> |
| 109 | </div> |
| 110 | </Container.Item> |
| 111 | </Container> |
| 112 | ); |
| 113 | }; |
| 114 | |
| 115 | export default WelcomeBanner; |
| 116 |