diff --git a/fronts-client/src/components/FrontsEdit/CollectionComponents/Card.tsx b/fronts-client/src/components/FrontsEdit/CollectionComponents/Card.tsx index e40c2f46420..ed8382b06f3 100644 --- a/fronts-client/src/components/FrontsEdit/CollectionComponents/Card.tsx +++ b/fronts-client/src/components/FrontsEdit/CollectionComponents/Card.tsx @@ -44,6 +44,7 @@ import { DefaultDropIndicator } from 'components/DropZone'; import DragIntentContainer from 'components/DragIntentContainer'; import { CardTypes, CardTypesMap } from 'constants/cardTypes'; import { RecipeCard } from 'components/card/recipe/RecipeCard'; +import { ChefCard } from '../../card/chef/ChefCard'; export const createCardId = (id: string) => `collection-item-${id}`; @@ -223,6 +224,25 @@ class Card extends React.Component { {getSublinks} ); + case CardTypesMap.CHEF: + return ( + <> + onSelect(uuid)} + size={size} + textSize={textSize} + showMeta={showMeta} + /> + {getSublinks} + + ); default: return (

diff --git a/fronts-client/src/components/card/chef/ChefCard.tsx b/fronts-client/src/components/card/chef/ChefCard.tsx new file mode 100644 index 00000000000..a5d49c075c9 --- /dev/null +++ b/fronts-client/src/components/card/chef/ChefCard.tsx @@ -0,0 +1,85 @@ +import React from 'react'; +import { Card, CardSizes } from '../../../types/Collection'; +import { useSelector } from 'react-redux'; +import { selectCard } from '../../../selectors/shared'; +import { State } from '../../../types/State'; +import { selectors as chefsSelectors } from 'bundles/chefsBundle'; +import CardContainer from '../CardContainer'; +import CardBody from '../CardBody'; +import CardMetaHeading from '../CardMetaHeading'; +import CardMetaContainer from '../CardMetaContainer'; +import CardMetaContent from '../CardMetaContent'; +import upperFirst from 'lodash/upperFirst'; +import CardContent from '../CardContent'; +import CardSettingsDisplay from '../CardSettingsDisplay'; +import CardHeadingContainer from '../CardHeadingContainer'; +import CardHeading from '../CardHeading'; +import ImageAndGraphWrapper from '../../image/ImageAndGraphWrapper'; +import Thumbnail, { ThumbnailSmall } from '../../image/Thumbnail'; + +interface Props { + onDragStart?: (d: React.DragEvent) => void; + onDrop?: (d: React.DragEvent) => void; + onDelete?: (uuid: string) => void; + onAddToClipboard?: (uuid: string) => void; + onClick?: () => void; + id: string; + collectionId?: string; + frontId: string; + draggable?: boolean; + size?: CardSizes; + textSize?: CardSizes; + fade?: boolean; + children?: React.ReactNode; + isUneditable?: boolean; + showMeta?: boolean; +} + +export const ChefCard = ({ + id, + fade, + size = 'default', + textSize = 'default', + onDelete, + onAddToClipboard, + children, + isUneditable, + collectionId, + frontId, + showMeta = true, + ...rest +}: Props) => { + const card = useSelector((state) => selectCard(state, id)); + const chef = useSelector((state) => + chefsSelectors.selectById(state, card.id) + ); + return ( + + + {showMeta && ( + + Chef + {upperFirst(chef?.sectionName)} + + )} + + + + + {`${chef?.firstName} ${chef?.lastName}` ?? 'No Chef found'} + + + + + + + + + ); +}; diff --git a/fronts-client/src/constants/cardTypes.ts b/fronts-client/src/constants/cardTypes.ts index d9130439f3c..4c360b4e8b6 100644 --- a/fronts-client/src/constants/cardTypes.ts +++ b/fronts-client/src/constants/cardTypes.ts @@ -2,6 +2,7 @@ export const CardTypesMap = { SNAP_LINK: 'snap-link', ARTICLE: 'article', RECIPE: 'recipe', + CHEF: 'chef', } as const; export type CardTypes = (typeof CardTypesMap)[keyof typeof CardTypesMap];