-
Notifications
You must be signed in to change notification settings - Fork 843
Social: Add Social Share Status modal for published posts #39051
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
c560c10
Register meta with name of `jetpack_social_post_shares`
gmjuhasz 1848811
Add new meta to usePostMeta hook
gmjuhasz 34f0219
Add bare components with fetching data
gmjuhasz be45e2f
changelog
gmjuhasz 98b4231
Add moment
gmjuhasz efde646
Populate the modal
gmjuhasz b5eba3a
Merge branch 'trunk' into add/social-share-status-shares-modal
gmjuhasz 502b21c
Remove moment and schema as we use store
gmjuhasz 0b3f3d8
Improve share retrieval and css
gmjuhasz a4c4328
Merge branch 'trunk' into add/social-share-status-shares-modal
gmjuhasz 82f9e7d
Only order the list
gmjuhasz 54ae707
Rebase onto the global modal
gmjuhasz 1046ce5
Remove leftover file
gmjuhasz 5db5551
revert bad change
gmjuhasz 68b94a9
Fix minification issue
gmjuhasz 902fa2c
remove external_id from types
gmjuhasz 3c5e987
Improve normalizeShareStatus
manzoorwanijk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Populate the modal
- Loading branch information
commit efde64628a1d2c57cd796516b94ccc8a1c837ad7
There are no files selected for viewing
This file contains hidden or 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
26 changes: 26 additions & 0 deletions
26
...s-packages/publicize-components/src/components/share-status-modal/share-status-action.tsx
This file contains hidden or 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,26 @@ | ||
| import { ExternalLink } from '@wordpress/components'; | ||
| import { __ } from '@wordpress/i18n'; | ||
| import styles from './styles.module.scss'; | ||
|
|
||
| /** | ||
| * | ||
| * Share status action component. | ||
| * | ||
| * @param {object} props - component props | ||
| * @param {boolean} props.status - status of the share | ||
| * @param {string} props.shareLink - link to the share | ||
| * @return {import('react').ReactNode} - React element | ||
| */ | ||
| export function ShareStatusAction( { status, shareLink } ) { | ||
| return ( | ||
| <div className={ styles[ 'share-status-action-wrapper' ] }> | ||
| { 'success' !== status ? ( | ||
| <span>Retry</span> | ||
| ) : ( | ||
| <ExternalLink className={ styles[ 'profile-link' ] } href={ shareLink }> | ||
| { __( 'View', 'jetpack' ) } | ||
| </ExternalLink> | ||
| ) } | ||
| </div> | ||
| ); | ||
| } |
44 changes: 44 additions & 0 deletions
44
...js-packages/publicize-components/src/components/share-status-modal/share-status-label.tsx
This file contains hidden or 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,44 @@ | ||
| import { IconTooltip, Text } from '@automattic/jetpack-components'; | ||
| import { __ } from '@wordpress/i18n'; | ||
| import { Icon, check } from '@wordpress/icons'; | ||
| import clsx from 'clsx'; | ||
| import React from 'react'; | ||
| import styles from './styles.module.scss'; | ||
|
|
||
| /** | ||
| * | ||
| * Share status label component. | ||
| * | ||
| * @param {object} props - component props | ||
| * @param {boolean} props.status - status of the share | ||
| * @param {string} props.message - link to the share, or error message if failed | ||
| * @return {import('react').ReactNode} - React element | ||
| */ | ||
| export function ShareStatusLabel( { status, message } ) { | ||
| const isSuccessful = 'success' === status; | ||
|
|
||
| const icon = isSuccessful ? ( | ||
| <Icon className={ styles[ 'share-status-icon' ] } icon={ check } /> | ||
| ) : ( | ||
| <IconTooltip | ||
| title={ __( 'Sharing failed with the following message:', 'jetpack' ) } | ||
| className={ styles[ 'share-status-icon-tooltip' ] } | ||
| > | ||
| <Text variant="body-small">{ message }</Text> | ||
| </IconTooltip> | ||
| ); | ||
|
|
||
| return ( | ||
| <div | ||
| className={ clsx( styles[ 'share-status-wrapper' ], { | ||
| [ styles[ 'share-status-success' ] ]: isSuccessful, | ||
| [ styles[ 'share-status-failure' ] ]: ! isSuccessful, | ||
| } ) } | ||
| > | ||
| <div className={ styles[ 'share-status-icon' ] }>{ icon }</div> | ||
| <div className={ styles[ 'share-status-label' ] }> | ||
| { isSuccessful ? __( 'Shared', 'jetpack' ) : __( 'Failed', 'jetpack' ) } | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.