From 04eef2938796bed5b746bdfb106cb1b3c33d18e0 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Mon, 11 Apr 2022 15:01:11 -0700 Subject: [PATCH] Wire up show highlights modal to new article actions --- .../templates/article/ArticleContainer.tsx | 14 +++++++------- .../templates/article/ArticleHeaderToolbar.tsx | 9 +++++++-- packages/web/pages/app/[username]/[slug]/index.tsx | 3 +++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/web/components/templates/article/ArticleContainer.tsx b/packages/web/components/templates/article/ArticleContainer.tsx index 6d318bdbb..ab3b00800 100644 --- a/packages/web/components/templates/article/ArticleContainer.tsx +++ b/packages/web/components/templates/article/ArticleContainer.tsx @@ -29,14 +29,14 @@ type ArticleContainerProps = { fontSize?: number fontFamily?: string lineHeight?: number - showHighlightsModal?: boolean - setShowHighlightsModal?: (show: boolean) => void + showHighlightsModal: boolean + setShowHighlightsModal: React.Dispatch> } export function ArticleContainer(props: ArticleContainerProps): JSX.Element { const [showShareModal, setShowShareModal] = useState(false) - const [showHighlightsModal, setShowHighlightsModal] = useState(false) const [showReportIssuesModal, setShowReportIssuesModal] = useState(false) + const [showHighlightsModal, setShowHighlightsModal] = useState(props.showHighlightsModal) const [fontSize, setFontSize] = useState(props.fontSize ?? 20) const updateFontSize = async (newFontSize: number) => { @@ -160,8 +160,8 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element { 0} /> @@ -195,10 +195,10 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element { articleAuthor={props.article.author ?? ''} articleId={props.article.id} isAppleAppEmbed={props.isAppleAppEmbed} - highlightBarDisabled={props.highlightBarDisabled} - showHighlightsModal={showHighlightsModal} highlightsBaseURL={props.highlightsBaseURL} - setShowHighlightsModal={setShowHighlightsModal} + highlightBarDisabled={props.highlightBarDisabled} + showHighlightsModal={props.showHighlightsModal} + setShowHighlightsModal={props.setShowHighlightsModal} articleMutations={props.articleMutations} /> {showReportIssuesModal ? ( diff --git a/packages/web/components/templates/article/ArticleHeaderToolbar.tsx b/packages/web/components/templates/article/ArticleHeaderToolbar.tsx index ca2edb16d..10b0e993b 100644 --- a/packages/web/components/templates/article/ArticleHeaderToolbar.tsx +++ b/packages/web/components/templates/article/ArticleHeaderToolbar.tsx @@ -14,7 +14,7 @@ type ArticleHeaderToolbarProps = { articleTitle: string articleShareURL: string hasHighlights: boolean - setShowHighlightsModal: (showHighlightsModal: boolean) => void + setShowHighlightsModal: React.Dispatch> setShowShareArticleModal: (showShareModal: boolean) => void } @@ -46,7 +46,12 @@ export function ArticleHeaderToolbar( return ( {props.hasHighlights && ( -