-
Notifications
You must be signed in to change notification settings - Fork 798
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Social: Add Threads to social previews (#38003)
* Update dependencies * Wire up Threads preview * Fix color override for facebook icon to fix a regression introduced in #37977 * Add changelog * Add context to Threads i18n * Update dependencies to fix JSX attributes issue * Fix up versions * Fix title not displayed in caption
- Loading branch information
1 parent
ca075bb
commit 64517a4
Showing
15 changed files
with
104 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
projects/js-packages/components/changelog/add-social-threads-preview
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 | ||
|
||
Added social preview for Threads |
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
4 changes: 4 additions & 0 deletions
4
projects/js-packages/publicize-components/changelog/add-social-threads-preview
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 | ||
|
||
Added social preview for Threads |
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
49 changes: 49 additions & 0 deletions
49
projects/js-packages/publicize-components/src/components/social-previews/threads.js
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,49 @@ | ||
import { ThreadsPreviews } from '@automattic/social-previews'; | ||
import { useSelect } from '@wordpress/data'; | ||
import React from 'react'; | ||
import { usePostMeta } from '../../hooks/use-post-meta'; | ||
import { CONNECTION_SERVICE_THREADS, store } from '../../social-store'; | ||
|
||
/** | ||
* The threads tab component. | ||
* | ||
* @param {object} props - The props. | ||
* @param {string} props.title - The post title | ||
* @param {string} props.description - The post description/excerpt | ||
* @param {object} props.image - The post featured image | ||
* @param {string} props.url - The URL of the post | ||
* @param {object[]} props.media - Array of attached media | ||
* @returns {React.ReactNode} The threads tab component. | ||
*/ | ||
export function Threads( { title, description, image, url, media } ) { | ||
const { shareMessage: text } = usePostMeta(); | ||
|
||
const posts = useSelect( | ||
select => { | ||
const { displayName: name, profileImage } = select( store ).getConnectionProfileDetails( | ||
CONNECTION_SERVICE_THREADS | ||
); | ||
|
||
return [ | ||
{ | ||
name, | ||
profileImage, | ||
text, | ||
title, | ||
description, | ||
image, | ||
media, | ||
url, | ||
}, | ||
]; | ||
}, | ||
[ title, image, description, media, url, text ] | ||
); | ||
|
||
const threadsConnections = useSelect( | ||
select => select( store ).getConnectionsByService( CONNECTION_SERVICE_THREADS ), | ||
[] | ||
); | ||
|
||
return <ThreadsPreviews posts={ posts } hidePostPreview={ ! threadsConnections.length } />; | ||
} |
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
4 changes: 4 additions & 0 deletions
4
projects/packages/publicize/changelog/add-social-threads-preview
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 | ||
|
||
Added social preview for Threads |
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
4 changes: 4 additions & 0 deletions
4
projects/plugins/jetpack/changelog/add-social-threads-preview
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: enhancement | ||
|
||
Add Threads preview to Social Previews |
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