From 2ec67e588b7ef98ec077ecf3dedb1cc1a5a22ddf Mon Sep 17 00:00:00 2001
From: Dylan Munson <65001528+CodeyGuyDylan@users.noreply.github.com>
Date: Wed, 2 Oct 2024 14:17:04 -0600
Subject: [PATCH] Polish the VideoPress connection banner
---
.../components/banner/connect-banner.tsx | 6 ++++--
.../blocks/video/components/banner/style.scss | 2 +-
.../components/videopress-uploader/index.js | 20 +++++++++++++------
.../client/block-editor/blocks/video/edit.tsx | 18 +++++++++--------
4 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/connect-banner.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/connect-banner.tsx
index 4b486acafdd85..3e3422c1c563e 100644
--- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/connect-banner.tsx
+++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/connect-banner.tsx
@@ -35,6 +35,8 @@ export default function ConnectBanner( {
return null;
}
+ const needsActivation = isConnected && ! isModuleActive;
+
let connectButtonText = __( 'Connect Jetpack', 'jetpack-videopress-pkg' );
if ( isConnecting ) {
connectButtonText = __( 'Redirecting…', 'jetpack-videopress-pkg' );
@@ -63,12 +65,12 @@ export default function ConnectBanner( {
disabled={ isConnecting }
isBusy={ isConnecting }
>
- { ! isModuleActive ? activateButtonText : connectButtonText }
+ { needsActivation ? activateButtonText : connectButtonText }
}
icon={ '' }
>
- { ! isModuleActive ? connectJetpackModuleMessage : connectYourAccountMessage }
+ { needsActivation ? connectJetpackModuleMessage : connectYourAccountMessage }
);
}
diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/style.scss b/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/style.scss
index 3ec80ba84d3e8..8964f84b82a95 100644
--- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/style.scss
+++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/style.scss
@@ -11,7 +11,7 @@
.block-banner__content {
color: white;
- margin: 0 8px;
+ margin: 10px 10px 10px 0;
}
.block-banner__action {
diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/videopress-uploader/index.js b/projects/packages/videopress/src/client/block-editor/blocks/video/components/videopress-uploader/index.js
index c1f7374a681e5..a86732386a6fa 100644
--- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/videopress-uploader/index.js
+++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/videopress-uploader/index.js
@@ -10,6 +10,7 @@ import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
+import { usePermission } from '../../../../../admin/hooks/use-permission';
import useResumableUploader from '../../../../../hooks/use-resumable-uploader';
import { uploadFromLibrary } from '../../../../../hooks/use-uploader';
import { buildVideoPressURL, pickVideoBlockAttributesFromUrl } from '../../../../../lib/url';
@@ -36,6 +37,8 @@ const VideoPressUploader = ( {
const [ isUploadingInProgress, setIsUploadingInProgress ] = useState( false );
const [ isVerifyingLocalMedia, setIsVerifyingLocalMedia ] = useState( false );
+ const { hasConnectedOwner } = usePermission();
+
/*
* When the file to upload is set, start the upload process
* just after the component is mounted.
@@ -315,15 +318,20 @@ const VideoPressUploader = ( {
);
}
+ const needsConnectionText = __(
+ 'Connect your WordPress.com account to enable high-quality, ad-free video.',
+ 'jetpack-videopress-pkg'
+ );
+
+ const needsActivationText = __(
+ 'Activate the VideoPress module to enable high-quality, ad-free video.',
+ 'jetpack-videopress-pkg'
+ );
+
if ( ! isActive ) {
return (