-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c6935ba
commit 85247b6
Showing
12 changed files
with
844 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<script context="module" lang="ts"> | ||
export enum Providers { | ||
Twilio = 'twilio', | ||
Msg91 = 'msg91', | ||
Telesign = 'telesign', | ||
Textmagic = 'textmagic', | ||
Vonage = 'vonage', | ||
Mailgun = 'mailgun', | ||
Sendgrid = 'sendgrid', | ||
FCM = 'fcm', | ||
APNS = 'apns', | ||
MQTT = 'mqtt' | ||
} | ||
</script> | ||
|
||
<script lang="ts"> | ||
import { base } from '$app/paths'; | ||
import { app } from '$lib/stores/app'; | ||
export let provider: Providers; | ||
export let name: string = ''; | ||
let icon = ''; | ||
let displayName = name || provider.charAt(0).toUpperCase() + provider.slice(1); | ||
switch (provider) { | ||
case Providers.FCM: | ||
icon = 'firebase'; | ||
displayName = name || 'FCM'; | ||
break; | ||
case Providers.APNS: | ||
icon = 'apple'; | ||
displayName = name || 'APNS'; | ||
break; | ||
case Providers.MQTT: | ||
icon = 'mqtt'; | ||
displayName = name || 'MQTT'; | ||
break; | ||
case Providers.Sendgrid: | ||
icon = 'sendgrid'; | ||
break; | ||
case Providers.Mailgun: | ||
icon = 'mailgun'; | ||
break; | ||
case Providers.Twilio: | ||
icon = 'twilio'; | ||
break; | ||
case Providers.Telesign: | ||
icon = 'telesign'; | ||
break; | ||
case Providers.Msg91: | ||
icon = 'msg91'; | ||
displayName = name || 'MSG91'; | ||
break; | ||
case Providers.Textmagic: | ||
icon = 'textmagic'; | ||
displayName = name || 'TextMagic'; | ||
break; | ||
case Providers.Vonage: | ||
icon = 'vonage'; | ||
break; | ||
} | ||
</script> | ||
|
||
{#if icon === ''} | ||
Invalid provider | ||
{:else} | ||
<div class="u-flex u-cross-center u-gap-8"> | ||
<div class="avatar is-size-small"> | ||
<img | ||
style:--p-text-size="1.25rem" | ||
src={`${base}/icons/${$app.themeInUse}/color/${icon}.svg`} | ||
alt={displayName} /> | ||
</div> | ||
<slot> | ||
{displayName} | ||
</slot> | ||
</div> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<script context="module" lang="ts"> | ||
export enum ProviderTypes { | ||
Email = 'email', | ||
Sms = 'sms', | ||
Push = 'push' | ||
} | ||
</script> | ||
|
||
<script lang="ts"> | ||
export let type: ProviderTypes; | ||
let icon = ''; | ||
let text = ''; | ||
switch (type) { | ||
case ProviderTypes.Email: | ||
icon = 'icon-mail'; | ||
text = 'Email'; | ||
break; | ||
case ProviderTypes.Sms: | ||
icon = 'icon-annotation'; | ||
text = 'SMS'; | ||
break; | ||
case ProviderTypes.Push: | ||
icon = 'icon-device-mobile'; | ||
text = 'Push'; | ||
break; | ||
} | ||
</script> | ||
|
||
{#if text === ''} | ||
Invalid provider type | ||
{:else} | ||
<div class="u-flex u-cross-center u-gap-8"> | ||
<div class="avatar is-size-small"> | ||
<span class={icon} style:--p-text-size="1.25rem" aria-hidden="true" /> | ||
</div> | ||
{text} | ||
</div> | ||
{/if} |
62 changes: 62 additions & 0 deletions
62
src/routes/console/project-[project]/messaging/+layout.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<script lang="ts"> | ||
import { goto } from '$app/navigation'; | ||
import { page } from '$app/stores'; | ||
import { registerCommands, updateCommandGroupRanks } from '$lib/commandCenter'; | ||
import { project } from '../store'; | ||
import { showCreate } from './store'; | ||
// TODO: finalize the commands | ||
$: $registerCommands([ | ||
{ | ||
label: 'Create message', | ||
callback: () => { | ||
if (!$page.url.pathname.endsWith('messaging')) { | ||
goto(`/console/project-${$project.$id}/messaging`); | ||
} | ||
$showCreate = true; | ||
}, | ||
keys: $page.url.pathname.endsWith('messaging') ? ['c'] : ['c', 'm'], | ||
icon: 'plus', | ||
group: 'messaging' | ||
}, | ||
{ | ||
label: 'Go to topics', | ||
callback() { | ||
goto(`/console/project-${$project.$id}/messaging/topics`); | ||
}, | ||
keys: ['g', 't'], | ||
disabled: | ||
$page.url.pathname.endsWith('topics') || $page.url.pathname.includes('message-'), | ||
group: 'navigation', | ||
rank: 10 | ||
}, | ||
{ | ||
label: 'Go to providers', | ||
callback() { | ||
goto(`/console/project-${$project.$id}/messaging/providers`); | ||
}, | ||
keys: ['g', 'p'], | ||
disabled: | ||
$page.url.pathname.endsWith('topics') || $page.url.pathname.includes('message-'), | ||
group: 'navigation', | ||
rank: 10 | ||
} | ||
// { | ||
// label: 'Find messages', | ||
// callback: () => { | ||
// addSubPanel(BucketsPanel); | ||
// }, | ||
// group: 'messaging', | ||
// rank: -1 | ||
// } | ||
]); | ||
$: $updateCommandGroupRanks({ messaging: 200, navigation: 100 }); | ||
</script> | ||
|
||
<svelte:head> | ||
<title>Messaging - Appwrite</title> | ||
</svelte:head> | ||
|
||
<slot /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Breadcrumbs from './breadcrumbs.svelte'; | ||
import Header from './header.svelte'; | ||
import type { LayoutLoad } from './$types'; | ||
|
||
export const load: LayoutLoad = async () => { | ||
return { | ||
header: Header, | ||
breadcrumbs: Breadcrumbs | ||
}; | ||
}; |
Oops, something went wrong.