From 3f0e60d0c2a1b76d0564b2b2ec16af94f04942d1 Mon Sep 17 00:00:00 2001 From: wess Date: Tue, 6 Feb 2024 09:14:47 -0500 Subject: [PATCH 1/2] Fixes issue where, when creating a message, the article for the provider message type was incorrect Adjusted if provider message type was plural or not as well --- .../project-[project]/messaging/wizard/step1.svelte | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/routes/console/project-[project]/messaging/wizard/step1.svelte b/src/routes/console/project-[project]/messaging/wizard/step1.svelte index 4fffcc771d..d0d4d3ccc9 100644 --- a/src/routes/console/project-[project]/messaging/wizard/step1.svelte +++ b/src/routes/console/project-[project]/messaging/wizard/step1.svelte @@ -8,6 +8,16 @@ import PushFormList, { validateData } from './pushFormList.svelte'; async function beforeSubmit() {} + + const createMessage = (providerText:string) => { + const vowels = ['a', 'e', 'i', 'o', 'u']; + const firstLetter = providerText.toLowerCase().charAt(0); + const lastLetter = providerText.charAt(providerText.length - 1); + let article = vowels.includes(firstLetter) ? 'an' : 'a'; + article = lastLetter === 's' ? '' : article; + + return `Create ${article} ${providerText} that will be displayed to your subscribers. Learn more in our documentation.`; + }; Message - Create an {providers[$providerType].text} that will be displayed to your subscribers. Learn more - in our documentation. + {createMessage(providers[$providerType].text)} {#if $providerType === ProviderTypes.Email} From 6edea22cc4d9b0437c95198983fd1e09669e928a Mon Sep 17 00:00:00 2001 From: wess Date: Tue, 6 Feb 2024 13:11:05 -0500 Subject: [PATCH 2/2] Updated for special SMS handling --- .../console/project-[project]/messaging/wizard/step1.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/console/project-[project]/messaging/wizard/step1.svelte b/src/routes/console/project-[project]/messaging/wizard/step1.svelte index d0d4d3ccc9..68a6bc3d3b 100644 --- a/src/routes/console/project-[project]/messaging/wizard/step1.svelte +++ b/src/routes/console/project-[project]/messaging/wizard/step1.svelte @@ -12,10 +12,11 @@ const createMessage = (providerText:string) => { const vowels = ['a', 'e', 'i', 'o', 'u']; const firstLetter = providerText.toLowerCase().charAt(0); - const lastLetter = providerText.charAt(providerText.length - 1); + const lastLetter = providerText.toLowerCase().charAt(providerText.length - 1); let article = vowels.includes(firstLetter) ? 'an' : 'a'; article = lastLetter === 's' ? '' : article; + providerText = providerText.toLowerCase() === 'sms' ? 'SMS messages' : providerText; return `Create ${article} ${providerText} that will be displayed to your subscribers. Learn more in our documentation.`; };