-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Social: Add Social Share status component and cleanup panels (#39049)
* Move PostPublishPanels to publicize components * changelog * Wrap with ThemeProvider * Move share status component to postpublish component * Add feature flag to postpublishShareStatus * Cleanup ThemeProvider * Pass targetDom and jsDoc update
- Loading branch information
Showing
15 changed files
with
101 additions
and
49 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
projects/js-packages/publicize-components/changelog/refactor-social-post-publish-panel
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: minor | ||
Type: changed | ||
|
||
Moved PostPublishPanels component to publicize-components package |
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
1 change: 0 additions & 1 deletion
1
projects/js-packages/publicize-components/src/components/manual-sharing/styles.module.scss
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
.wrapper { | ||
margin-top: 1rem; | ||
padding-block: 1rem; | ||
display: flex; | ||
flex-direction: column; | ||
|
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
16 changes: 16 additions & 0 deletions
16
projects/js-packages/publicize-components/src/components/post-publish-panels/index.tsx
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,16 @@ | ||
import { ThemeProvider } from '@automattic/jetpack-components'; | ||
import PostPublishManualSharing from '../post-publish-manual-sharing'; | ||
import PostPublishReviewPrompt from '../post-publish-review-prompt'; | ||
import { PostPublishShareStatus } from '../post-publish-share-status'; | ||
|
||
const PostPublishPanels = () => { | ||
return ( | ||
<ThemeProvider targetDom={ document.body }> | ||
<PostPublishShareStatus /> | ||
<PostPublishManualSharing /> | ||
<PostPublishReviewPrompt /> | ||
</ThemeProvider> | ||
); | ||
}; | ||
|
||
export default PostPublishPanels; |
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
29 changes: 29 additions & 0 deletions
29
projects/js-packages/publicize-components/src/components/post-publish-share-status/index.tsx
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,29 @@ | ||
import { useSelect } from '@wordpress/data'; | ||
import { PluginPostPublishPanel } from '@wordpress/edit-post'; | ||
import { store as socialStore } from '../../social-store'; | ||
import { ShareStatusModal } from '../share-status-modal'; | ||
|
||
/** | ||
* Post publish share status component. | ||
* | ||
* @return {import('react').ReactNode} - Post publish share status component. | ||
*/ | ||
export function PostPublishShareStatus() { | ||
const { featureFlags } = useSelect( select => { | ||
const store = select( socialStore ); | ||
return { | ||
featureFlags: store.featureFlags(), | ||
}; | ||
}, [] ); | ||
|
||
if ( ! featureFlags.useShareStatus ) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<PluginPostPublishPanel id="publicize-share-status"> | ||
Your post was successfully shared in 4 connections. | ||
<ShareStatusModal /> | ||
</PluginPostPublishPanel> | ||
); | ||
} |
29 changes: 29 additions & 0 deletions
29
projects/js-packages/publicize-components/src/components/share-status-modal/index.tsx
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,29 @@ | ||
import { Button } from '@wordpress/components'; | ||
import { useSelect } from '@wordpress/data'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { store as socialStore } from '../../social-store'; | ||
import styles from './styles.module.scss'; | ||
|
||
/** | ||
* Share status modal component. | ||
* | ||
* @return {import('react').ReactNode} - Share status modal component. | ||
*/ | ||
export function ShareStatusModal() { | ||
const { featureFlags } = useSelect( select => { | ||
const store = select( socialStore ); | ||
return { | ||
featureFlags: store.featureFlags(), | ||
}; | ||
}, [] ); | ||
|
||
if ( ! featureFlags.useShareStatus ) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className={ styles.wrapper }> | ||
<Button variant="secondary">{ __( 'Review sharing status', 'jetpack' ) }</Button>{ ' ' } | ||
</div> | ||
); | ||
} |
4 changes: 4 additions & 0 deletions
4
...cts/js-packages/publicize-components/src/components/share-status-modal/styles.module.scss
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 @@ | ||
.wrapper { | ||
margin-top: 1rem; | ||
padding-block: 1rem; | ||
} |
4 changes: 4 additions & 0 deletions
4
projects/plugins/jetpack/changelog/refactor-social-post-publish-panel
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: minor | ||
Type: other | ||
|
||
Moved PostPublishPanels component to publicize-coomponents package |
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
15 changes: 0 additions & 15 deletions
15
projects/plugins/jetpack/extensions/plugins/publicize/post-publish.js
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
projects/plugins/social/changelog/refactor-social-post-publish-panel
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: minor | ||
Type: changed | ||
|
||
Moved PostPublishPanels component to publicize-components package |
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