feat: support, fix qa

This commit is contained in:
Arman committed 2023-11-15 17:34:16 +01:00
1 parent 3834dfc49a
commit c3a74ed341
12 files changed
+149 -123

No files matched your search

+1 -1
View File
@@ -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;
</script>
+4 -1
View File
@@ -1,8 +1,11 @@
<script lang="ts">
import { abbreviateNumber } from '$lib/helpers/numbers';
export let unit: string;
export let used: number;
export let max: number;
export let status: null | 'warning' | 'error' = null;
export let formatNumber = true;
$: progress = Math.round((used / max) * 100);
@@ -19,7 +22,7 @@
<p class="heading-level-4">{progress}%</p>
</div>
<p class="body-text-2">
{max}
{formatNumber ? abbreviateNumber(max) : max}
{unit}
</p>
</div>
+15 -16
View File
@@ -7,11 +7,13 @@
import { app } from '$lib/stores/app';
import { wizard } from '$lib/stores/wizard';
import SupportWizard from '../../routes/console/supportWizard.svelte';
import { isSupportOnline } from '../../routes/console/wizard/support/store';
import { isSupportOnline, showSupportModal } from '../../routes/console/wizard/support/store';
import { isCloud } from '$lib/system';
import { organization } from '$lib/stores/organization';
export let show = false;
$: isPaid = $organization?.billingPlan === 'tier-1' || $organization?.billingPlan === 'tier-2';
</script>
{#if isCloud}
@@ -31,12 +33,14 @@
</div>
<div>
<h4 class="eyebrow-heading-3">Premium support</h4>
<p class="u-line-height-1-5 u-margin-block-start-8">
Get personalized support from the Appwrite team from <b>09:00 - 17:00 UTC</b>
</p>
{#if isPaid}
<p class="u-line-height-1-5 u-margin-block-start-8">
Get personalized support from the Appwrite team from <b>09:00 - 17:00 UTC</b>
</p>
{/if}
</div>
{#if $organization?.billingPlan === 'tier-0'}
<Button fullWidth href="https://appwrite.io/billing">
<Button fullWidth href="https://appwrite.io/pricing" external>
<span class="text">Get Premium support</span>
</Button>
{:else}
@@ -45,6 +49,7 @@
fullWidth
on:click={() => {
show = false;
$showSupportModal = false;
wizard.start(SupportWizard);
}}>
<span class="text">Contact our Support Team</span>
@@ -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">
<span class="helper u-success">
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">
<span class="helper u-color-text-success">
<span class="icon-check-circle" aria-hidden="true" />
</span>
<b class="text">All services are online</b>
@@ -88,18 +93,12 @@
</section>
<section class="drop-section u-grid u-gap-8 u-padding-24">
<div>
<h4 class="eyebrow-heading-3">community support</h4>
<h4 class="eyebrow-heading-3">Community support</h4>
<p class="text u-margin-block-start-8">Get help from our community</p>
</div>
<ul class="u-flex">
<ul class="u-flex u-gap-8">
<li>
<Button
href="https://github.com/appwrite"
round
text
noMargin
external
ariaLabel="Github">
<Button href="https://github.com/appwrite" text noMargin external ariaLabel="Github">
<span class="icon-github" aria-hidden="true" />
</Button>
</li>
+10 -8
View File
@@ -123,14 +123,16 @@
</svelte:fragment>
</DropList>
<DropList width="17.5" bind:show={showSupport} scrollable={true}>
<Button text on:click={() => (showSupport = !showSupport)}>
<span class="text">Support</span>
</Button>
<svelte:fragment slot="other">
<Support bind:show={showSupport} />
</svelte:fragment>
</DropList>
{#if isCloud}
<DropList width="17.5" bind:show={showSupport} scrollable={true}>
<Button text on:click={() => (showSupport = !showSupport)}>
<span class="text">Support</span>
</Button>
<svelte:fragment slot="other">
<Support bind:show={showSupport} />
</svelte:fragment>
</DropList>
{/if}
<Button
actions={[
(node) => {
+26 -2
View File
@@ -5,8 +5,12 @@
import { tooltip } from '$lib/actions/tooltip';
import { isMac } from '$lib/helpers/platform';
import { slide } from '$lib/helpers/transition';
import { organization } from '$lib/stores/organization';
import { wizard } from '$lib/stores/wizard';
import { isCloud } from '$lib/system';
import ChangeOrganizationTierCloud from '$routes/console/changeOrganizationTierCloud.svelte';
import Create from '$routes/console/feedbackWizard.svelte';
import { showSupportModal } from '$routes/console/wizard/support/store';
export let isOpen = false;
@@ -32,10 +36,15 @@
}
}
function openWizard() {
function openFeedback() {
isOpen = false;
wizard.start(Create);
}
function openSupport() {
isOpen = false;
$showSupportModal = true;
}
</script>
<svelte:window on:keydown={handleKeyDown} />
@@ -169,9 +178,24 @@
<span class="icon-cog" aria-hidden="true" />
<span class="text">Settings</span>
</a>
<ul class="drop-list is-only-mobile">
{#if isCloud && $organization?.billingPlan !== 'tier-2'}
<li class="drop-list-item">
<button
class="drop-button"
on:click={() => wizard.start(ChangeOrganizationTierCloud)}>
<span class="text">Upgrade</span>
</button>
</li>
{/if}
<li class="drop-list-item">
<button class="drop-button" on:click={openWizard}>
<button class="drop-button" on:click={openSupport}>
<span class="text">Support</span>
</button>
</li>
<li class="drop-list-item">
<button class="drop-button" on:click={openFeedback}>
<span class="text">Feedback</span>
</button>
</li>
+6
View File
@@ -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}
<Logs />
{/if}
{#if $showSupportModal}
<MobileSupportModal bind:show={$showSupportModal}></MobileSupportModal>
{/if}
@@ -8,7 +8,11 @@
const project = $page.params.project;
</script>
<CardContainer total={data.databases.total} on:click={() => (showCreate = true)} event="database">
<CardContainer
total={data.databases.total}
on:click={() => (showCreate = true)}
event="database"
service="databases">
{#each data.databases.databases as database}
<GridItem1 href={`${base}/console/project-${project}/databases/database-${database.$id}`}>
<svelte:fragment slot="title">{database.name}</svelte:fragment>
+66 -25
View File
@@ -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
};
}
</script>
<Wizard title="Contact us" steps={stepsComponents} finalAction="Go back to My Console">
<Wizard
title="Contact us"
steps={stepsComponents}
finalAction="Submit"
on:finish={handleSubmit}
on:exit={resetData}>
<svelte:fragment slot="aside">
<div class="common-section">
<h4 class="body-text-1">Contact the Appwrite Team</h4>
<p class="text">
Found a bug? Need a hand? Just want to say hi? Contact the Appwrite team with your
queries.
</p>
</div>
<div class="common-section">
<p class="text">Available: <b>Mon-Fri 09:00 - 17:00 UCT</b></p>
<p class="text u-flex u-gap-4 u-cross-center">
Currently: {#if isSupportOnline()}
<span class="u-success">
<span class="icon-check-circle" aria-hidden="true" />
</span>
<span class="u-success text">Online</span>
{:else}
<span class="icon-x-circle" aria-hidden="true" />
<span class="text">Offline</span>{/if}
</p>
<h4 class="body-text-1 u-bold">Contact the Appwrite Team</h4>
<p class="text u-margin-block-start-16">
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.
</p>
<p class="text u-margin-block-start-32">Available: <b>Mon-Fri 09:00 - 17:00 UCT</b></p>
<div class="u-flex u-gap-4 u-cross-center">
<span>Currently:</span>
{#if isSupportOnline()}
<span class="icon-check-circle u-color-text-success" aria-hidden="true" />
<span class="u-color-text-success text">Online</span>
{:else}
<span class="icon-x-circle" aria-hidden="true" />
<span class="text">Offline</span>
{/if}
</div>
</svelte:fragment>
</Wizard>
@@ -0,0 +1,10 @@
<script lang="ts">
import { Support } from '$lib/components';
import Modal from '$lib/components/modal.svelte';
export let show: boolean;
</script>
<Modal title="Contact us" bind:show>
<Support />
</Modal>
+2 -31
View File
@@ -1,53 +1,24 @@
<script lang="ts">
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { FormList, InputTextarea } from '$lib/elements/forms';
import { WizardStep } from '$lib/layout';
import { app } from '$lib/stores/app';
import { addNotification } from '$lib/stores/notifications';
import { wizard } from '$lib/stores/wizard';
import { supportData } from './store';
import Light from '$lib/images/support/support-wizard-light.svg';
import Dark from '$lib/images/support/support-wizard-dark.svg';
import { Pill } from '$lib/elements';
// import { Collapsible, CollapsibleItem } from '$lib/components';
import { user } from '$lib/stores/user';
$wizard.media = $app.themeInUse === 'dark' ? Dark : Light;
// let files: FileList;
async function beforeSubmit() {
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'
});
}
}
</script>
<WizardStep {beforeSubmit}>
<WizardStep>
<svelte:fragment slot="title">How can we help you?</svelte:fragment>
<svelte:fragment slot="subtitle">
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.
</svelte:fragment>
<div class="common-section">
<p class="label">Choose a topic</p>
@@ -1,36 +0,0 @@
<script lang="ts">
import { WizardStep } from '$lib/layout';
import { supportData } from './store';
</script>
<WizardStep>
<svelte:fragment slot="title">Your message has been sent</svelte:fragment>
<svelte:fragment slot="subtitle">The Appwrite team is on it!</svelte:fragment>
{#if $supportData.category === 'technical'}
<img
src="https://i.kym-cdn.com/photos/images/newsfeed/001/485/098/245.gif"
alt="Sweating guy" />
<p class="text common-section">
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.
</p>
<p class="text common-section">
Just kidding! Dave the Intern is totally getting fired. Someone from the Appwrite team
(not Dave) will be touch with you via email soon.
</p>
{:else}
<img
src="https://i.pinimg.com/originals/1c/3a/0d/1c3a0d8ce9c4a92344ae924ccda10149.gif"
alt="Cat coding" />
<p class="text common-section">
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.
</p>
<p class="text common-section">
Sit tight, one of our ex-purrts will be in touch with you via email soon.
</p>
{/if}
</WizardStep>
+4 -2
View File
@@ -14,8 +14,8 @@ export const supportData = writable<SupportData>({
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);