diff --git a/met-web/src/components/engagement/view/EngagementBanner/BannerSection.tsx b/met-web/src/components/engagement/view/EngagementBanner/BannerSection.tsx index cd9d31b2e..cad40baef 100644 --- a/met-web/src/components/engagement/view/EngagementBanner/BannerSection.tsx +++ b/met-web/src/components/engagement/view/EngagementBanner/BannerSection.tsx @@ -1,46 +1,25 @@ import React from 'react'; -import { Grid, Skeleton } from '@mui/material'; +import { Skeleton } from '@mui/material'; import { Banner } from '../../../banner/Banner'; -import { PrimaryButton } from 'components/common'; import { SubmissionStatus } from 'constants/engagementStatus'; -import { When } from 'react-if'; import EngagementInfoSection from '../EngagementInfoSection'; import { Engagement } from 'models/engagement'; export interface EngagementBannerProps { - startSurvey: () => void; isEngagementLoading: boolean; savedEngagement: Engagement | null; - mockStatus?: SubmissionStatus; isLoggedIn: boolean; + mockStatus?: SubmissionStatus; + surveyButton?: React.ReactNode; } -export const BannerSection = ({ - startSurvey, - isEngagementLoading, - savedEngagement, - isLoggedIn, - mockStatus, -}: EngagementBannerProps) => { - const surveyId = savedEngagement?.surveys[0]?.id ?? ''; - const isPreview = isLoggedIn; - const currentStatus = isPreview ? mockStatus : savedEngagement?.submission_status; - const isOpen = currentStatus === SubmissionStatus.Open; - +export const BannerSection = ({ isEngagementLoading, savedEngagement, surveyButton }: EngagementBannerProps) => { if (isEngagementLoading || !savedEngagement) { return ; } return ( - - - - - Share Your Thoughts - - - - + {surveyButton} ); }; diff --git a/met-web/src/components/engagement/view/EngagementBanner/StandAloneBanner.tsx b/met-web/src/components/engagement/view/EngagementBanner/StandAloneBanner.tsx index c1a012eea..ed23c8dee 100644 --- a/met-web/src/components/engagement/view/EngagementBanner/StandAloneBanner.tsx +++ b/met-web/src/components/engagement/view/EngagementBanner/StandAloneBanner.tsx @@ -5,10 +5,10 @@ import { getEngagementIdBySlug } from 'services/engagementSlugService'; import { getEngagement } from 'services/engagementService'; interface EngagementBannerProps { - startSurvey: () => void; engagementSlug: string; + surveyButton?: React.ReactNode; } -export const EngagementBanner = ({ startSurvey, engagementSlug }: EngagementBannerProps) => { +export const EngagementBanner = ({ engagementSlug, surveyButton }: EngagementBannerProps) => { const [isEngagementLoading, setIsEngagementLoading] = useState(true); const [savedEngagement, setSavedEngagement] = useState(null); const [engagementId, setEngagementId] = useState(null); @@ -52,7 +52,7 @@ export const EngagementBanner = ({ startSurvey, engagementSlug }: EngagementBann return ( void; -} -export const EngagementBanner = ({ startSurvey }: EngagementBannerProps) => { +export const EngagementBanner = () => { const { isEngagementLoading, savedEngagement, mockStatus } = useContext(ActionContext); const isLoggedIn = useAppSelector((state) => state.user.authentication.authenticated); return ( { - + window.open(props['engagementurl'], '_blank')} + surveyButton={ + window.open(props['engagementurl'], '_blank')}> + Share Your Thoughts + + } engagementSlug={this._getSlugFromUrl(props['engagementurl'])} {...props} />