From 2dc64718e9a80a4a83ae93ed3c33d5feade3ef08 Mon Sep 17 00:00:00 2001 From: nick arrasate Date: Fri, 5 Jun 2026 09:15:28 -0700 Subject: [PATCH] Add shareTitleText theme field to ShareLink filename and share title Uses theme.shareTitleText to set the filename of the shared File object (controls the title shown in the iOS share drawer) and the title passed to navigator.share, falling back to Dispatch_Video/Dispatch_Image. Adds the field to the admin Theme form. --- src/molecules/Share/ShareLink.jsx | 10 ++++++++-- src/organisms/Theme/Form.jsx | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/molecules/Share/ShareLink.jsx b/src/molecules/Share/ShareLink.jsx index c1046e4..6c53486 100644 --- a/src/molecules/Share/ShareLink.jsx +++ b/src/molecules/Share/ShareLink.jsx @@ -24,7 +24,12 @@ export const ShareLink = (props) => { fetch(postDownloadUrl) .then(response => response.blob()) .then(blob => { - const filename = isVideo ? 'Dispatch_Video.mp4' : 'Dispatch_Image.jpg'; + const sanitizedTitle = theme.shareTitleText + ? theme.shareTitleText.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, '_') + : null; + const filename = isVideo + ? `${sanitizedTitle || 'Dispatch_Video'}.mp4` + : `${sanitizedTitle || 'Dispatch_Image'}.jpg`; setMediaFile(new File([blob], filename, { type: blob.type })); setLoaded(true); }) @@ -35,7 +40,8 @@ export const ShareLink = (props) => { const sendGAandDownload = async (url) => { const eventName = eventHref('share_download'); - const title = isVideo ? 'Dispatch Video' : 'Dispatch Image'; + const defaultTitle = isVideo ? 'Dispatch Video' : 'Dispatch Image'; + const title = theme.shareTitleText || defaultTitle; const text = 'Share your keepsake and tag us!'; ga.pageView(eventName); diff --git a/src/organisms/Theme/Form.jsx b/src/organisms/Theme/Form.jsx index d3ab32d..8263cab 100644 --- a/src/organisms/Theme/Form.jsx +++ b/src/organisms/Theme/Form.jsx @@ -111,6 +111,7 @@ export const ThemeForm = (props) => { const [ downloadIconImage, setDownloadIconImage ] = useState(theme.downloadIconImage); const [ swapShareContent, setSwapShareContent ] = useState(theme.swapShareContent); const [ shareButtonText, setShareButtonText ] = useState(theme.shareButtonText); + const [ shareTitleText, setShareTitleText ] = useState(theme.shareTitleText); const [ approvalQueueApproveMsg, setApprovalQueueApproveMsg ] = useState(theme.approvalQueueApproveMsg); const [ approvalQueueDenyMsg, setApprovalQueueDenyMsg ] = useState(theme.approvalQueueDenyMsg); @@ -164,6 +165,7 @@ export const ThemeForm = (props) => { downloadIconImage, swapShareContent, shareButtonText, + shareTitleText, enableDownloadLink: true, approvalQueueApproveMsg, approvalQueueDenyMsg, @@ -549,6 +551,12 @@ export const ThemeForm = (props) => { setShareButtonText(e.target.value)} defaultValue={shareButtonText} placeholder='Click to Share' /> + + + + setShareTitleText(e.target.value)} defaultValue={shareTitleText} placeholder='Dispatch Video / Dispatch Image' /> + +