From 3784bf1d77001c75459ee29a000337c33c9c1aec Mon Sep 17 00:00:00 2001 From: Tom Richards Date: Fri, 4 Oct 2024 21:51:47 +0100 Subject: [PATCH 1/2] add empty `pinboard-article-button` elements per article, as a handle for pinboard to attach itself (distinguished by the `data-url-path` attribute) and optionally expanded with draggable images if `data-with-draggable-thumbs-of-ratio` attribute is set with the ratio of the container --- .../components/card/article/ArticleBody.tsx | 1 + .../src/components/card/chef/ChefCard.tsx | 2 +- .../feastCollection/FeastCollectionCard.tsx | 1 + .../src/components/card/recipe/RecipeCard.tsx | 1 + .../components/card/snapLink/SnapLinkCard.tsx | 1 + .../src/components/feed/FeedItem.tsx | 1 + .../src/components/form/ArticleMetaForm.tsx | 22 ++++++++++++++----- .../inputs/HoverActionButtonWrapper.tsx | 11 ++++++++++ .../inputs/__tests__/HoverActions.spec.tsx | 1 + fronts-client/src/util/form.ts | 3 +++ 10 files changed, 38 insertions(+), 6 deletions(-) diff --git a/fronts-client/src/components/card/article/ArticleBody.tsx b/fronts-client/src/components/card/article/ArticleBody.tsx index b086fbf3224..8f395c8db70 100644 --- a/fronts-client/src/components/card/article/ArticleBody.tsx +++ b/fronts-client/src/components/card/article/ArticleBody.tsx @@ -358,6 +358,7 @@ const articleBodyDefault = React.memo( size={size} toolTipPosition={'top'} toolTipAlign={'right'} + urlPath={urlPath} renderButtons={(props) => ( <> {urlPath && ( diff --git a/fronts-client/src/components/card/chef/ChefCard.tsx b/fronts-client/src/components/card/chef/ChefCard.tsx index dbd16880672..a2575528fb4 100644 --- a/fronts-client/src/components/card/chef/ChefCard.tsx +++ b/fronts-client/src/components/card/chef/ChefCard.tsx @@ -61,7 +61,6 @@ export const ChefCard = ({ const chef = useSelector((state: State) => chefsSelectors.selectChefFromCard(state, card.uuid), ); - return ( @@ -115,6 +114,7 @@ export const ChefCard = ({ ( <> ( <> ( <> ( <> {urlPath && ( diff --git a/fronts-client/src/components/feed/FeedItem.tsx b/fronts-client/src/components/feed/FeedItem.tsx index 0290a27e0f3..d1a8c1733f4 100644 --- a/fronts-client/src/components/feed/FeedItem.tsx +++ b/fronts-client/src/components/feed/FeedItem.tsx @@ -220,6 +220,7 @@ export class FeedItem extends React.Component { ( <> diff --git a/fronts-client/src/components/form/ArticleMetaForm.tsx b/fronts-client/src/components/form/ArticleMetaForm.tsx index 1f384b8235e..941d420af02 100644 --- a/fronts-client/src/components/form/ArticleMetaForm.tsx +++ b/fronts-client/src/components/form/ArticleMetaForm.tsx @@ -537,6 +537,8 @@ class FormComponent extends React.Component { groupSizeId && groupSizeId > 0))); + const cardCriteria = this.determineCardCriteria(); + return ( { component={InputImage} disabled={imageHide || coverCardImageReplace} criteria={ - isEditionsMode - ? editionsCardImageCriteria - : this.determineCardCriteria() + isEditionsMode ? editionsCardImageCriteria : cardCriteria } frontId={frontId} defaultImageUrl={ @@ -847,7 +847,7 @@ class FormComponent extends React.Component { frontId={frontId} component={RenderSlideshow} change={change} - criteria={this.determineCardCriteria()} + criteria={cardCriteria} slideshowHasAtLeastTwoImages={slideshowHasAtLeastTwoImages} /> @@ -904,6 +904,15 @@ class FormComponent extends React.Component { )} + {articleCapiFieldValues.urlPath && ( + // the below tag is empty and meaningless to the fronts tool itself, but serves as a handle for + // Pinboard to attach itself via, identified/distinguished by the urlPath data attribute + // @ts-ignore + + )}