-
Notifications
You must be signed in to change notification settings - Fork 797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add/value to active state videopress card #38812
Add/value to active state videopress card #38812
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! |
import ShieldOff from './assets/shield-off.svg'; | ||
import ShieldPartial from './assets/shield-partial.svg'; | ||
import ShieldSuccess from './assets/shield-success.svg'; | ||
import { InfoTooltip } from './info-tooltip'; | ||
import { useProtectTooltipCopy } from './use-protect-tooltip-copy'; | ||
import type { ReactElement, PropsWithChildren } from 'react'; | ||
import type { PropsWithChildren, ReactElement } from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an accident but doesn't make a difference 😅
536655e
to
b29bb5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this tested well and is looking good, I had a few small comments and ran into some things that differed from the test instructions.
When setting up the test, after adding a video, I did not get the option to "Activate" VideoPress - I had "learn more". Not a blocker, but just noting that was different
After activating VideoPress through Jetpack settings, I did see the empty stats with 0s.
font-weight: 500; | ||
margin-bottom: calc(var(--spacing-base) + 2px); | ||
line-height: var(--font-title-small); | ||
text-align: center; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure the text-align is needed since the items are aligned with flex-start
?
...y-jetpack/_inc/components/product-cards-section/videopress-card/videopress-value-section.tsx
Show resolved
Hide resolved
@@ -315,9 +315,16 @@ public static function get_videopress_stats() { | |||
} | |||
|
|||
$videopress_stats = new VideoPress_Stats(); | |||
$featured_stats = $videopress_stats->get_featured_stats( 60 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we should add a transient cache for this call so we aren't calling it on each page load?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we could do that 🤔 I'll set it to 1 hour? Or would that be too long?
I assume this is because you don't meet the criteria for the product to be owned 🤔 If you didn't have the standalone plugin or a plan, and this showed up in the "Discover" section, based on the criteria we set before then I don't believe we should see an "Activate" 🤔 Let me know if my assumptions were wrong or if you think this should be fixed. It's also possible that a value on the backend of the videopress class needs to be updated |
b848419
to
e97e266
Compare
@@ -29,6 +29,10 @@ const VideoPressValueSection: FC< VideoPressValueSectionProps > = ( { isPluginAc | |||
const currentViews = featuredStats?.data?.views?.current; | |||
const currentWatchTime = featuredStats?.data?.watch_time?.current; | |||
|
|||
if ( currentViews === undefined || currentWatchTime === undefined ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to handle the case where there was an error on the API call. 0's should be accepted if the site has videos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small nitpick, this LGTM
|
||
const MISSING_CONNECTION_NOTIFICATION_KEY = 'missing-connection'; | ||
const MISSING_CONNECTION_NOTIFICATION_KEY = 'missing-connection'; | ||
const VIDEOPRESS_STATS_KEY = 'videopress-stats'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick - might be a good idea to add my-jetpack-
to the front of this transient key just in case the videopress plugin decides to use a similar transient name at some point in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I'll add that
510c733
to
0bd3885
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the transient name!
* Add value to active state of VideoPress card * changelog * Return videoCount if error on featured stats call * Update time format to accomodate years * Update definition of videopress active * Show stats if user has videos * Simplify logic of videopress value section * Left align protect headings per design * Update monthly views heading to 30-day views * Add transient * Specify transient key to my jetpack * Fixup project versions
Proposed changes:
$days
arg to function in VideoPress package that returns stats. This arg allows us to customize the days returned for featured stats without having to duplicate functionality in My Jetpack. It also doesn't break any current usages of the function as the argument is optional and defaults to the old value of 14 daysNOTE: This PR does not intend to handle adding trends, tooltip, or context switching between monthly and all-time views. Those will be handled in separate PRs
Other information:
Jetpack product discussion
P2: p1HpG7-rb7-p2
Does this pull request change what data or activity we track or use?
No
Testing instructions:
/wp-admin/options-general.php?page=companion_settings
and enter your sandbox domain to enable sandboxed requestsrand(0, 100)
. You can pick whatever numbers you'd like if you wanted to test out smaller or bigger numbers.Play around with the random numbers to make sure they scale well with the compacting number/time formatting.
Additionally make sure they match designs here: p1HpG7-rb7-p2
Note: There are some pending questions as far as the design goes (p1HpG7-rb7-p2#comment-73251), so the CSS is pending, but the functionality should remain the same so I think it is ready to review