Open obenland opened 4 years ago
We need the WordPress.com Reader Preview to be available in Jetpack (both standalone and wpcom mode) as we already have facebook, twitter, google search.
reader-preview
component has two internal dependencies
https://github.com/Automattic/wp-calypso/blob/f2c9d99b07e14ea938829e9b2e5b31b6fb388a90/client/components/seo/reader-preview/index.js#L8-L32reader-post-card
component in particular has a lot more internal dependencies and a lot of logic
https://github.com/Automattic/wp-calypso/blob/9e53fabcd455a828d7791dd39a34978d2afabd1a/client/blocks/reader-post-card/index.jsx#L13-L279reader-post-actions
toolbar (as facebook doesn't include their toolbar in the preview too). It neither adds any value to the user experience, nor it changes per content / settings (at least as of now).
reader-post-card
is not used only by previews, so it doesn't make sense trying to put in @automattic/social-previews. Recreate the component in @automattic/social-previews. Given the Constants above we don't need anything from the state
Create a wrapper component in calypso that will provide any state needed. We could then try to make the inner components more abstract and create npm packages for them. Ultimately we would replace all the inner references with the new npm packages and reuse them in jetpack
I am trying hard to find a better solution than the two above, which are both far from perfect. If we drop the standalone jetpack environment, maybe it is worth trying to find a way sharing the component from calypso and making it usable in jetpack https://github.com/Automattic/jetpack/blob/a77a757b2629cd0a9cb4b95e45a15c79f2b4ac4f/extensions/blocks/social-previews/constants.js#L5-L28
44380
Simple but effective 🥇
@cpapazoglou Thanks for researching and providing options. Personally I vote for option 1 - Recreate the component in @automattic/social-previews.
.
Very bad maintainability,
Can you provide info on how many times the Calypso reader component(s) have been directly modified in the last year? That will give us some idea of the impact and which teams/individuals we should consult before going ahead.
Can be used anywhere without any wpcom dependencies
I'd say that's a pretty major plus point.
The most straightforward way as of now.
If we want this included quickly to provide feature parity between the Calypso Preview modal and the new Social Previews in the Jetpack sidebar then we should take this route.
Can you provide info on how many times the Calypso reader component(s) have been directly modified in the last year? That will give us some idea of the impact and which teams/individuals we should consult before going ahead.
As it seems here https://github.com/Automattic/wp-calypso/commits/master/client/blocks/reader-post-card there are ~ 10 commits the last year which actually touched the appearance (since we don't care for functionality) especially typography. The good thing is that almost all of them are CSS related which should be easy enough to port in the npm package.
I suggest:
seo/reader-preview
component and check if it is hopefully doableseo/reader-preview
and the npm package seo/reader-preview
seo/reader-preview
and deletes the standalone seo/reader-preview
How does that sound @getdave ?
There is WIP in this PR https://github.com/Automattic/wp-calypso/pull/45056
This issue is stale because it has been 180 days with no activity. You can keep the issue open by adding a comment. If you do, please provide additional context and explain why you’d like it to remain open. You can also close the issue yourself — if you do, please add a brief explanation and apply one of relevant issue close labels.
https://github.com/Automattic/wp-calypso/issues/44380