diff --git a/packages/commonwealth/client/scripts/views/Sublayout.tsx b/packages/commonwealth/client/scripts/views/Sublayout.tsx index 4c158643b43..9efad615127 100644 --- a/packages/commonwealth/client/scripts/views/Sublayout.tsx +++ b/packages/commonwealth/client/scripts/views/Sublayout.tsx @@ -183,6 +183,7 @@ const Sublayout = ({ children, isInsideCommunity }: SublayoutProps) => { buttonLink="https://commonwealth.im/common/discussion/25536-Weighted%20Voting%20and%20Contest%20FAQs" growlImage={contestsGTMGrowlImage} extraText="Spark creativity and foster connections within your community." + growlType="contests" /> { const { setIsGrowlHidden, isGrowlHidden } = useGrowlStore(); @@ -37,8 +37,9 @@ export const CWGrowlTemplate = ({ useState(false); const [isDisabled, setIsDisabled] = useState( - localStorage.getItem(LOCALSTORAGE_GROWL_TEMPLATE_KEY) === 'true' || - isGrowlHidden, + localStorage.getItem( + `LOCALSTORAGE_GROWL_TEMPLATE_${growlType.toUpperCase()}_KEY`, + ) === 'true' || isGrowlHidden, ); const handleExit = () => { @@ -46,7 +47,10 @@ export const CWGrowlTemplate = ({ setIsGrowlHidden(true); if (shouldHideGrowlPermanently) { - localStorage.setItem(LOCALSTORAGE_GROWL_TEMPLATE_KEY, 'true'); + localStorage.setItem( + `LOCALSTORAGE_GROWL_TEMPLATE_${growlType.toUpperCase()}_KEY`, + 'true', + ); } }; @@ -56,10 +60,10 @@ export const CWGrowlTemplate = ({ - + {growlImage && }
{headerText} @@ -67,16 +71,18 @@ export const CWGrowlTemplate = ({ {bodyText} - { - e.preventDefault(); - window.open(buttonLink, '_blank'); - }} - /> + {buttonLink && ( + { + e.preventDefault(); + window.open(buttonLink, '_blank'); + }} + /> + )} {discordLink && ( <> { ); return ( - navigate(`${discussionLink}?isEdit=true`)} - onStageTagClick={() => { - navigate(`/discussions?stage=${thread.stage}`); - }} - threadHref={`${getScopePrefix()}${discussionLink}`} - onBodyClick={() => { - const scrollEle = - document.getElementsByClassName('Body')[0]; - localStorage[`${communityId}-discussions-scrollY`] = - scrollEle.scrollTop; - }} - onCommentBtnClick={() => - navigate(`${discussionLink}?focusComments=true`) - } - disabledActionsTooltipText={ - disabledCommentPermissionTooltipText || - disabledReactPermissionTooltipText || - disabledActionsTooltipText - } - hideRecentComments - editingDisabled={isThreadTopicInContest} - /> + <> + + navigate(`${discussionLink}?isEdit=true`) + } + onStageTagClick={() => { + navigate(`/discussions?stage=${thread.stage}`); + }} + threadHref={`${getScopePrefix()}${discussionLink}`} + onBodyClick={() => { + const scrollEle = + document.getElementsByClassName('Body')[0]; + localStorage[`${communityId}-discussions-scrollY`] = + scrollEle.scrollTop; + }} + onCommentBtnClick={() => + navigate(`${discussionLink}?focusComments=true`) + } + disabledActionsTooltipText={ + disabledCommentPermissionTooltipText || + disabledReactPermissionTooltipText || + disabledActionsTooltipText + } + hideRecentComments + editingDisabled={isThreadTopicInContest} + /> + + ); }} endReached={() => {