From c6014ddb864b844d0de4919204b39bac9ddc670f Mon Sep 17 00:00:00 2001 From: qi_xing_jk Date: Mon, 4 Mar 2024 21:12:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(=E5=A2=9E=E5=BC=BA=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E7=9A=84tags=E5=8A=9F=E8=83=BD):=20=E7=BB=99?= =?UTF-8?q?Facebook/Twitter/Tumblr=E5=92=8CWorkplace=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E6=8C=89=E9=92=AE=E7=9A=84tags=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 1cde3dd8b9cfd2bc781ea03efb542e5f9132a1f8) --- components/ShareButtons.js | 90 ++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 42 deletions(-) diff --git a/components/ShareButtons.js b/components/ShareButtons.js index 5ea54055..5ad3bae5 100644 --- a/components/ShareButtons.js +++ b/components/ShareButtons.js @@ -5,48 +5,48 @@ import { useRouter } from 'next/router' import { useEffect, useState } from 'react' import { - EmailIcon, - EmailShareButton, - FacebookIcon, - FacebookMessengerIcon, - FacebookMessengerShareButton, - FacebookShareButton, - HatenaIcon, - HatenaShareButton, - InstapaperIcon, - InstapaperShareButton, - LineIcon, - LineShareButton, - LinkedinIcon, - LinkedinShareButton, - LivejournalIcon, - LivejournalShareButton, - MailruIcon, - MailruShareButton, - OKIcon, - OKShareButton, - PinterestIcon, - PinterestShareButton, - PocketIcon, - PocketShareButton, - RedditIcon, - RedditShareButton, - TelegramIcon, - TelegramShareButton, - TumblrIcon, - TumblrShareButton, - TwitterIcon, - TwitterShareButton, - VKIcon, - VKShareButton, - ViberIcon, - ViberShareButton, - WeiboIcon, - WeiboShareButton, - WhatsappIcon, - WhatsappShareButton, - WorkplaceIcon, - WorkplaceShareButton + EmailIcon, + EmailShareButton, + FacebookIcon, + FacebookMessengerIcon, + FacebookMessengerShareButton, + FacebookShareButton, + HatenaIcon, + HatenaShareButton, + InstapaperIcon, + InstapaperShareButton, + LineIcon, + LineShareButton, + LinkedinIcon, + LinkedinShareButton, + LivejournalIcon, + LivejournalShareButton, + MailruIcon, + MailruShareButton, + OKIcon, + OKShareButton, + PinterestIcon, + PinterestShareButton, + PocketIcon, + PocketShareButton, + RedditIcon, + RedditShareButton, + TelegramIcon, + TelegramShareButton, + TumblrIcon, + TumblrShareButton, + TwitterIcon, + TwitterShareButton, + ViberIcon, + ViberShareButton, + VKIcon, + VKShareButton, + WeiboIcon, + WeiboShareButton, + WhatsappIcon, + WhatsappShareButton, + WorkplaceIcon, + WorkplaceShareButton } from 'react-share' const QrCode = dynamic(() => import('@/components/QrCode'), { ssr: false }) @@ -61,6 +61,8 @@ const ShareButtons = ({ post }) => { const [shareUrl, setShareUrl] = useState(siteConfig('LINK') + router.asPath) const title = post?.title || siteConfig('TITLE') const image = post?.pageCover + const tags = post.tags || [] + const hashTags = tags.map(tag => `#${tag}`).join(',') const body = post?.title + ' | ' + title + ' ' + shareUrl + ' ' + post?.summary @@ -95,6 +97,7 @@ const ShareButtons = ({ post }) => { @@ -152,6 +155,7 @@ const ShareButtons = ({ post }) => { key={singleService} url={shareUrl} title={titleWithSiteInfo} + hashtags={tags} className='mx-1'> @@ -229,6 +233,7 @@ const ShareButtons = ({ post }) => { key={singleService} url={shareUrl} title={titleWithSiteInfo} + tags={tags} className='mx-1'> @@ -274,6 +279,7 @@ const ShareButtons = ({ post }) => { key={singleService} url={shareUrl} quote={titleWithSiteInfo} + hashtag={hashTags} className='mx-1'> From 7a2520d488382fbd3ea37a23acda529ef86ab641 Mon Sep 17 00:00:00 2001 From: anime Date: Sat, 4 Jan 2025 20:24:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?perf(=E4=BD=BF=E7=94=A8switch=20case?= =?UTF-8?q?=E8=80=8C=E9=9D=9E=E8=BF=9E=E7=BB=AD=E7=9A=84if):=20=E8=99=BD?= =?UTF-8?q?=E7=84=B6=E6=B2=A1=E5=95=A5=E5=A4=AA=E5=A4=A7=E7=9A=84=E9=80=9F?= =?UTF-8?q?=E5=BA=A6=E4=BC=98=E5=8C=96=EF=BC=8C=E4=BD=86=E6=98=AF=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=8F=AF=E8=AF=BB=E6=80=A7=E6=9B=B4=E5=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ShareButtons.js | 569 ++++++++++++++++++------------------- 1 file changed, 274 insertions(+), 295 deletions(-) diff --git a/components/ShareButtons.js b/components/ShareButtons.js index 5ad3bae5..29fd37b4 100644 --- a/components/ShareButtons.js +++ b/components/ShareButtons.js @@ -92,303 +92,282 @@ const ShareButtons = ({ post }) => { return ( <> {services.map(singleService => { - if (singleService === 'facebook') { - return ( - - - - ) - } - if (singleService === 'messenger') { - return ( - - - - ) - } - if (singleService === 'line') { - return ( - - - - ) - } - if (singleService === 'reddit') { - return ( - - - - ) - } - if (singleService === 'email') { - return ( - - - - ) - } - if (singleService === 'twitter') { - return ( - - - - ) - } - if (singleService === 'telegram') { - return ( - - - - ) - } - if (singleService === 'whatsapp') { - return ( - - - - ) - } - if (singleService === 'linkedin') { - return ( - - - - ) - } - if (singleService === 'pinterest') { - return ( - - - - ) - } - if (singleService === 'vkshare') { - return ( - - - - ) - } - if (singleService === 'okshare') { - return ( - - - - ) - } - if (singleService === 'tumblr') { - return ( - - - - ) - } - if (singleService === 'livejournal') { - return ( - - - - ) - } - if (singleService === 'mailru') { - return ( - - - - ) - } - if (singleService === 'viber') { - return ( - - - - ) - } - if (singleService === 'workplace') { - return ( - - - - ) - } - if (singleService === 'weibo') { - return ( - - - - ) - } - if (singleService === 'pocket') { - return ( - - - - ) - } - if (singleService === 'instapaper') { - return ( - - - - ) - } - if (singleService === 'hatena') { - return ( - - - - ) - } - if (singleService === 'qq') { - return ( - - ) - } - if (singleService === 'wechat') { - return ( - + ) + case 'wechat': + return ( + - ) +
+
+
+ {qrCodeShow && } +
+ + {locale.COMMON.SCAN_QR_CODE} + +
+
+ + ) + case 'link': + return ( + + ) + default: + return <> } - if (singleService === 'link') { - return ( - - ) - } - return <> })} )