From c3a74ed341a0f0bb17c1d28c51b0d4e1d95d5b83 Mon Sep 17 00:00:00 2001 From: Arman Date: Wed, 15 Nov 2023 17:34:16 +0100 Subject: [PATCH] feat: support, fix qa --- src/lib/components/cardContainer.svelte | 2 +- src/lib/components/progressBarBig.svelte | 5 +- src/lib/components/support.svelte | 31 +++---- src/lib/layout/header.svelte | 18 ++-- src/lib/layout/navigation.svelte | 28 +++++- src/routes/console/+layout.svelte | 6 ++ .../project-[project]/databases/grid.svelte | 6 +- src/routes/console/supportWizard.svelte | 91 ++++++++++++++----- .../wizard/support/mobileSupportModal.svelte | 10 ++ .../console/wizard/support/step1.svelte | 33 +------ .../console/wizard/support/step2.svelte | 36 -------- src/routes/console/wizard/support/store.ts | 6 +- 12 files changed, 149 insertions(+), 123 deletions(-) create mode 100644 src/routes/console/wizard/support/mobileSupportModal.svelte delete mode 100644 src/routes/console/wizard/support/step2.svelte diff --git a/src/lib/components/cardContainer.svelte b/src/lib/components/cardContainer.svelte index 3768c13f6..a0f6f7c8c 100644 --- a/src/lib/components/cardContainer.svelte +++ b/src/lib/components/cardContainer.svelte @@ -13,7 +13,7 @@ export let service = ''; export let serviceId: PlanServices = service as PlanServices; - $: planLimit = getServiceLimit(serviceId) ?? Infinity; + $: planLimit = getServiceLimit(serviceId) || Infinity; $: limit = preferences.get($page.route)?.limit ?? CARD_LIMIT; diff --git a/src/lib/components/progressBarBig.svelte b/src/lib/components/progressBarBig.svelte index 52c94f394..68132f893 100644 --- a/src/lib/components/progressBarBig.svelte +++ b/src/lib/components/progressBarBig.svelte @@ -1,8 +1,11 @@ {#if isCloud} @@ -31,12 +33,14 @@

Premium support

-

- Get personalized support from the Appwrite team from 09:00 - 17:00 UTC -

+ {#if isPaid} +

+ Get personalized support from the Appwrite team from 09:00 - 17:00 UTC +

+ {/if}
{#if $organization?.billingPlan === 'tier-0'} - {:else} @@ -45,6 +49,7 @@ fullWidth on:click={() => { show = false; + $showSupportModal = false; wizard.start(SupportWizard); }}> Contact our Support Team @@ -60,8 +65,8 @@ href="https://status.appwrite.io/" target="_blank" rel="noopener noreferrer" - class="button is-text u-gap-4 u-cross-center u-padding-inline-0 u-margin-block-start-8 u-width-full-line"> - + class="button is-text u-flex u-gap-4 u-cross-center u-padding-inline-0 u-margin-block-start-8 u-width-full-line"> + All services are online @@ -88,18 +93,12 @@
-

community support

+

Community support

Get help from our community

-
    +
    • -
    • diff --git a/src/lib/layout/header.svelte b/src/lib/layout/header.svelte index 8a40450b6..0a8178791 100644 --- a/src/lib/layout/header.svelte +++ b/src/lib/layout/header.svelte @@ -123,14 +123,16 @@ - - - - - - + {#if isCloud} + + + + + + + {/if} + + {/if}
    • - +
    • +
    • +
    • diff --git a/src/routes/console/+layout.svelte b/src/routes/console/+layout.svelte index f8b19ed45..7c5677f65 100644 --- a/src/routes/console/+layout.svelte +++ b/src/routes/console/+layout.svelte @@ -38,6 +38,8 @@ import { sdk } from '$lib/stores/sdk'; import { loadStripe } from '@stripe/stripe-js'; import { stripe } from '$lib/stores/stripe'; + import MobileSupportModal from './wizard/support/mobileSupportModal.svelte'; + import { showSupportModal } from './wizard/support/store'; function kebabToSentenceCase(str: string) { return str @@ -431,3 +433,7 @@ {#if $log.show} {/if} + +{#if $showSupportModal} + +{/if} diff --git a/src/routes/console/project-[project]/databases/grid.svelte b/src/routes/console/project-[project]/databases/grid.svelte index d4066b928..030241ac4 100644 --- a/src/routes/console/project-[project]/databases/grid.svelte +++ b/src/routes/console/project-[project]/databases/grid.svelte @@ -8,7 +8,11 @@ const project = $page.params.project; - (showCreate = true)} event="database"> + (showCreate = true)} + event="database" + service="databases"> {#each data.databases.databases as database} {database.name} diff --git a/src/routes/console/supportWizard.svelte b/src/routes/console/supportWizard.svelte index d0424630a..6f7f20dc0 100644 --- a/src/routes/console/supportWizard.svelte +++ b/src/routes/console/supportWizard.svelte @@ -3,8 +3,11 @@ import { onDestroy } from 'svelte'; import { isSupportOnline, supportData } from './wizard/support/store'; import Step1 from './wizard/support/step1.svelte'; - import Step2 from './wizard/support/step2.svelte'; import type { WizardStepsType } from '$lib/layout/wizard.svelte'; + import { user } from '$lib/stores/user'; + import { Submit, trackError, trackEvent } from '$lib/actions/analytics'; + import { addNotification } from '$lib/stores/notifications'; + import { wizard } from '$lib/stores/wizard'; onDestroy(() => { $supportData = { @@ -15,37 +18,75 @@ }); const stepsComponents: WizardStepsType = new Map(); + stepsComponents.set(1, { label: 'How can we help you?', component: Step1 }); - stepsComponents.set(2, { - label: 'Your message has been sent', - component: Step2 - }); + + async function handleSubmit() { + const response = await fetch('https://growth.appwrite.io/v1/support', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + subject: 'support', + email: $user.email, + firstName: $user?.name ?? '', + message: $supportData.message, + tags: ['cloud'], + customFields: [{ id: '41612', value: $supportData.category }] + }) + }); + trackEvent(Submit.SupportTicket); + if (response.status !== 200) { + trackError(new Error(response.status.toString()), Submit.SupportTicket); + addNotification({ + message: 'There was an error submitting your feedback', + type: 'error' + }); + } else { + addNotification({ + message: 'Your feedback was submitted successfully', + type: 'success' + }); + } + resetData(); + wizard.hide(); + } + + function resetData() { + $supportData = { + message: null, + category: 'general', + file: null + }; + } - + -
      -

      Contact the Appwrite Team

      -

      - Found a bug? Need a hand? Just want to say hi? Contact the Appwrite team with your - queries. -

      -
      -
      -

      Available: Mon-Fri 09:00 - 17:00 UCT

      -

      - Currently: {#if isSupportOnline()} - - - Online - {:else} -

      +

      Contact the Appwrite Team

      +

      + If you found a bug or have questions, please reach out to the Appwrite team. We try to + respond to all messages within our office hours. +

      +

      Available: Mon-Fri 09:00 - 17:00 UCT

      +
      + Currently: + {#if isSupportOnline()} +
      diff --git a/src/routes/console/wizard/support/mobileSupportModal.svelte b/src/routes/console/wizard/support/mobileSupportModal.svelte new file mode 100644 index 000000000..31f2108c6 --- /dev/null +++ b/src/routes/console/wizard/support/mobileSupportModal.svelte @@ -0,0 +1,10 @@ + + + + + diff --git a/src/routes/console/wizard/support/step1.svelte b/src/routes/console/wizard/support/step1.svelte index e297d30ad..925ca4aa4 100644 --- a/src/routes/console/wizard/support/step1.svelte +++ b/src/routes/console/wizard/support/step1.svelte @@ -1,53 +1,24 @@ - + How can we help you? Please describe your request in detail. If applicable, include steps for reproduction of any - in-app issues. We try to respond to all messages within our office hours (Mon-Fri 09:00 - - 17:00 UCT). Expect to receive an email from us soon! + in-app issues.

      Choose a topic

      diff --git a/src/routes/console/wizard/support/step2.svelte b/src/routes/console/wizard/support/step2.svelte deleted file mode 100644 index d8460cea9..000000000 --- a/src/routes/console/wizard/support/step2.svelte +++ /dev/null @@ -1,36 +0,0 @@ - - - - Your message has been sent - The Appwrite team is on it! - - {#if $supportData.category === 'technical'} - Sweating guy - -

      - Thanks for the message! As you can see from this totally real video of an actual - Appwrite employee, there is absolutely nothing wrong and we're not going to fire anyone. -

      -

      - Just kidding! Dave the Intern is totally getting fired. Someone from the Appwrite team - (not Dave) will be touch with you via email soon. -

      - {:else} - Cat coding - -

      - Thanks for the message! As you can see from this totally real video of an actual - Appwrite employee, the team is hard at work to address your comments and concerns. -

      -

      - Sit tight, one of our ex-purrts will be in touch with you via email soon. -

      - {/if} -
      diff --git a/src/routes/console/wizard/support/store.ts b/src/routes/console/wizard/support/store.ts index e4097cc22..54c71b308 100644 --- a/src/routes/console/wizard/support/store.ts +++ b/src/routes/console/wizard/support/store.ts @@ -14,8 +14,8 @@ export const supportData = writable({ export function isSupportOnline() { const currentDate = new Date(); - const day = currentDate.getDay(); - const hour = currentDate.getHours(); + const day = currentDate.getUTCDay(); + const hour = currentDate.getUTCHours(); if (day === 1 || day === 6) { return false; @@ -27,3 +27,5 @@ export function isSupportOnline() { return true; } + +export const showSupportModal = writable(false);