@@ -31,7 +31,7 @@ import ForkIcon from "icons/ForkIcon";
3131import AppleIcon from "icons/AppleIcon" ;
3232import IosShareIcon from "@mui/icons-material/IosShare" ;
3333import SubdirectoryArrowRightIcon from "@mui/icons-material/SubdirectoryArrowRight" ;
34- import { useEffect , useState } from "react" ;
34+ import { useEffect , useMemo , useState } from "react" ;
3535import { useNavigate } from "react-router-dom" ;
3636import * as analytics from "services/analytics" ;
3737import {
@@ -55,6 +55,7 @@ import XIcon from "@mui/icons-material/X";
5555import PinterestIcon from "@mui/icons-material/Pinterest" ;
5656import IconButton from "@mui/material/IconButton" ;
5757import ChevronLeftIcon from "@mui/icons-material/ChevronLeft" ;
58+ import { foodTypeLabelObject } from "helpers/Constants" ;
5859
5960const MinorHeading = styled ( Typography ) ( ( { theme } ) => ( {
6061 variant : "h5" ,
@@ -97,6 +98,20 @@ const StakeholderDetails = ({ onBackClick, isDesktop }) => {
9798 const position = usePosition ( ) ;
9899 const [ paddingBottom , setPaddingBottom ] = useState ( 30 ) ;
99100
101+ const foodTypes = useMemo ( ( ) => {
102+ return (
103+ Object . keys ( foodTypeLabelObject )
104+ . filter ( ( foodType ) => selectedOrganization [ foodType ] )
105+ . map ( ( foodType ) => {
106+ return foodTypeLabelObject [ foodType ] ;
107+ } )
108+ . join ( ", " ) +
109+ ( selectedOrganization . foodTypes
110+ ? `, ${ selectedOrganization . foodTypes } `
111+ : "" )
112+ ) ;
113+ } , [ selectedOrganization ] ) ;
114+
100115 useEffect ( ( ) => {
101116 const windowHeight = window . innerHeight / 100 ;
102117 if (
@@ -529,23 +544,6 @@ const StakeholderDetails = ({ onBackClick, isDesktop }) => {
529544 </ Stack >
530545 ) }
531546
532- { selectedOrganization . foodTypes && (
533- < Box textAlign = "left" >
534- < Typography
535- variant = "body2"
536- component = "p"
537- key = { selectedOrganization . id }
538- sx = { {
539- alignSelf : "flex-start" ,
540- margin : "1em 0.25em 0.5em 0" ,
541- fontSize : "1rem !important" ,
542- } }
543- >
544- { selectedOrganization . foodTypes }
545- </ Typography >
546- </ Box >
547- ) }
548-
549547 < Stack
550548 direction = "row"
551549 justifyContent = "start"
@@ -682,10 +680,15 @@ const StakeholderDetails = ({ onBackClick, isDesktop }) => {
682680 </ >
683681 ) }
684682
685- { selectedOrganization . items && (
683+ { ( selectedOrganization . items || foodTypes . length > 0 ) && (
686684 < >
687685 < MinorHeading > Items Available</ MinorHeading >
688- < DetailText > { selectedOrganization . items } </ DetailText >
686+ { selectedOrganization . items && (
687+ < DetailText > { selectedOrganization . items } </ DetailText >
688+ ) }
689+ { foodTypes . length > 0 && (
690+ < DetailText > { foodTypes } </ DetailText >
691+ ) }
689692 </ >
690693 ) }
691694 { hasAnySocialMediaUrl ( selectedOrganization ) && (
0 commit comments