-
Notifications
You must be signed in to change notification settings - Fork 797
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add/value to active state videopress card (#38812)
* 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
- Loading branch information
1 parent
ee09161
commit 7015560
Showing
14 changed files
with
174 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 1 addition & 9 deletions
10
projects/packages/my-jetpack/_inc/components/stats-section/count-comparison-card.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { numberFormat } from '@automattic/jetpack-components'; | ||
|
||
type FormatNumberFunction = ( number: number, config: Intl.NumberFormatOptions ) => string; | ||
|
||
const formatNumber: FormatNumberFunction = ( number, config = {} ) => { | ||
if ( number === null || ! Number.isFinite( number ) ) { | ||
return '-'; | ||
} | ||
|
||
return numberFormat( number, config ); | ||
}; | ||
|
||
export default formatNumber; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
type FormatTimeFunction = ( seconds: number ) => string; | ||
|
||
const formatTime: FormatTimeFunction = ( seconds: number ) => { | ||
const minutes = Math.floor( seconds / 60 ); | ||
const hours = Math.floor( minutes / 60 ); | ||
const days = Math.floor( hours / 24 ); | ||
const years = Math.floor( days / 365 ); | ||
|
||
if ( years > 0 ) { | ||
return `${ years }y ${ days % 365 }d`; | ||
} | ||
|
||
if ( days > 0 ) { | ||
return `${ days }d ${ hours % 24 }h`; | ||
} | ||
|
||
if ( hours > 0 ) { | ||
return `${ hours }h ${ minutes % 60 }m`; | ||
} | ||
|
||
if ( minutes > 0 ) { | ||
return `${ minutes }m ${ seconds % 60 }s`; | ||
} | ||
|
||
return `${ seconds }s`; | ||
}; | ||
|
||
export default formatTime; |
4 changes: 4 additions & 0 deletions
4
projects/packages/my-jetpack/changelog/add-value-to-active-state-videopress-card
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: added | ||
|
||
Add value to active card state on VideoPress My Jetpack card |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
projects/packages/videopress/changelog/add-value-to-active-state-videopress-card
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: added | ||
|
||
Add value to active card state on VideoPress My Jetpack card |
Oops, something went wrong.