Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/molecules/Share/ShareLink.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
Expand All @@ -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);

Expand Down
8 changes: 8 additions & 0 deletions src/organisms/Theme/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -164,6 +165,7 @@ export const ThemeForm = (props) => {
downloadIconImage,
swapShareContent,
shareButtonText,
shareTitleText,
enableDownloadLink: true,
approvalQueueApproveMsg,
approvalQueueDenyMsg,
Expand Down Expand Up @@ -549,6 +551,12 @@ export const ThemeForm = (props) => {
<Input key='shareButtonText' type='text' name='shareButtonText' id='shareButtonText' onChange={(e) => setShareButtonText(e.target.value)} defaultValue={shareButtonText} placeholder='Click to Share' />
</Col>
</FormGroup>
<FormGroup row>
<Label md={4} lg={3} for='shareTitleText'>Share Title Text</Label>
<Col md={8}>
<Input key='shareTitleText' type='text' name='shareTitleText' id='shareTitleText' onChange={(e) => setShareTitleText(e.target.value)} defaultValue={shareTitleText} placeholder='Dispatch Video / Dispatch Image' />
</Col>
</FormGroup>
<FormGroup row>
<Label md={4} lg={3} for='pageDisclaimerText'>Share Text</Label>
<Col md={8}>
Expand Down