Skip to content
Merged
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
14 changes: 12 additions & 2 deletions src/routes/console/project-[project]/messaging/wizard/step1.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
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.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.`;
};
</script>

<WizardStep
Expand All @@ -17,8 +28,7 @@
<svelte:fragment slot="title">Message</svelte:fragment>
<svelte:fragment slot="subtitle">
<!-- TODO: update documentation link -->
Create an {providers[$providerType].text} that will be displayed to your subscribers. Learn more
in our documentation.
{createMessage(providers[$providerType].text)}
</svelte:fragment>
{#if $providerType === ProviderTypes.Email}
<EmailFormList />
Expand Down