Merge pull request #1735 from appwrite/fix-support-and-feedback-wizard

Fix support and feedback wizard
This commit is contained in:
Ernst Mulders authored and GitHub committed 2025-03-11 12:13:57 +01:00
commit b73bbc9d4c
2 files changed
+96 -103

No files matched your search

+96 -35
View File
@@ -1,4 +1,11 @@
<script lang="ts">
import { Wizard } from '$lib/layout';
import { Icon, Layout, Tag, Typography, Button, Card } from '@appwrite.io/pink-svelte';
import { supportData, isSupportOnline } from './wizard/support/store';
import { onMount } from 'svelte';
import { sdk } from '$lib/stores/sdk';
import { Form, InputSelect, InputText, InputTextarea } from '$lib/elements/forms/index.js';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import {
localeTimezoneName,
@@ -6,16 +13,23 @@
utcWeekDayToLocaleWeekDay,
type WeekDay
} from '$lib/helpers/date';
import { WizardWithSteps } from '$lib/layout';
import type { WizardStepsType } from '$lib/layout/wizardWithSteps.svelte';
import { addNotification } from '$lib/stores/notifications';
import { organization } from '$lib/stores/organization';
import { user } from '$lib/stores/user';
import { wizard } from '$lib/stores/wizard';
import { VARS } from '$lib/system';
import { onDestroy } from 'svelte';
import Step1 from './wizard/support/step1.svelte';
import { isSupportOnline, supportData } from './wizard/support/store';
import { IconCheckCircle, IconXCircle } from '@appwrite.io/pink-icons-svelte';
let projectOptions: Array<{ value: string; label: string }>;
onMount(async () => {
const projectList = await sdk.forConsole.projects.list();
projectOptions = projectList.projects.map((project) => ({
value: project.$id,
label: project.name
}));
});
onDestroy(() => {
$supportData = {
@@ -26,13 +40,6 @@
};
});
const stepsComponents: WizardStepsType = new Map();
stepsComponents.set(1, {
label: 'How can we help you?',
component: Step1
});
async function handleSubmit() {
const response = await fetch(`${VARS.GROWTH_ENDPOINT}/support`, {
method: 'POST',
@@ -96,29 +103,83 @@
$: supportWeekDays = `${utcWeekDayToLocaleWeekDay(workTimings.startDay, workTimings.start)} - ${utcWeekDayToLocaleWeekDay(workTimings.endDay, workTimings.end)}`;
</script>
<WizardWithSteps
title="Contact us"
steps={stepsComponents}
finalAction="Submit"
on:exit={resetData}>
<Wizard title="Contact us" confirmExit={true}>
<Form onSubmit={handleSubmit}>
<Layout.Stack gap="xl">
<Layout.Stack gap="s">
<Typography.Title>How can we help you?</Typography.Title>
<Typography.Text
>Please describe your request in detail. If applicable, include steps for
reproduction of any in-app issues.</Typography.Text>
</Layout.Stack>
<Layout.Stack gap="s">
<Typography.Text color="--fgcolor-neutral-secondary"
>Choose a topic</Typography.Text>
<Layout.Stack gap="s" direction="row">
{#each ['general', 'billing', 'technical'] as category}
<Tag
on:click={() => {
$supportData.category = category;
}}
selected={$supportData.category === category}>{category}</Tag>
{/each}
</Layout.Stack>
</Layout.Stack>
<InputSelect
id="project"
label="Choose a project"
options={projectOptions ?? []}
bind:value={$supportData.project}
required={false}
placeholder="Select project" />
<InputText
id="subject"
label="Subject"
bind:value={$supportData.subject}
placeholder="What do you need help with?"
required />
<InputTextarea
id="message"
bind:value={$supportData.message}
placeholder="Type here..."
label="Tell us a bit more" />
<Layout.Stack direction="row" justifyContent="flex-end" gap="s">
<Button.Button
variant="secondary"
on:click={() => {
wizard.hide();
}}>Cancel</Button.Button>
<Button.Button>Submit</Button.Button>
</Layout.Stack>
</Layout.Stack>
</Form>
<svelte:fragment slot="aside">
<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>{supportWeekDays}, {supportTimings}</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>
<Card.Base padding="m">
<Layout.Stack gap="xl">
<Typography.Title size="s">Contact the Appwrite Team</Typography.Title>
<Typography.Text
>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.</Typography.Text>
<Layout.Stack direction="row" gap="s">
<Typography.Text>Available:</Typography.Text>
<Typography.Text variant="m-500"
>{supportWeekDays}, {supportTimings}</Typography.Text>
</Layout.Stack>
<Layout.Stack direction="row" gap="s">
<Typography.Text>Currently:</Typography.Text>
{#if isSupportOnline()}
<Layout.Stack direction="row" gap="xxxs" alignItems="center">
<Icon icon={IconCheckCircle} color="--fgcolor-success" />
<Typography.Text color="--fgcolor-success">Online</Typography.Text>
</Layout.Stack>{:else}
<Layout.Stack direction="row" gap="xxxs" alignItems="center">
<Icon icon={IconXCircle} />
<Typography.Text>Offline</Typography.Text>
</Layout.Stack>
{/if}
</Layout.Stack>
</Layout.Stack>
</Card.Base>
</svelte:fragment>
</WizardWithSteps>
</Wizard>
@@ -1,68 +0,0 @@
<script lang="ts">
import { FormList, InputSelect, InputText, InputTextarea } from '$lib/elements/forms';
import { WizardStep } from '$lib/layout';
import { supportData } from './store';
import { Pill } from '$lib/elements';
import { onMount } from 'svelte';
import { sdk } from '$lib/stores/sdk';
let options: {
value: string;
label: string;
}[];
onMount(async () => {
const projectList = await sdk.forConsole.projects.list();
options = projectList.projects.map((project) => ({
value: project.$id,
label: project.name
}));
});
</script>
<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.
</svelte:fragment>
<div class="common-section">
<p class="label">Choose a topic</p>
<div class="u-flex u-gap-8 u-margin-block-start-8">
{#each ['general', 'billing', 'technical'] as topic}
<Pill
button
selected={$supportData.category === topic}
on:click={() => {
$supportData.category = topic;
}}>{topic}</Pill>
{/each}
</div>
</div>
<div class="common-section">
<FormList>
{#if options?.length}
<InputSelect
id="project"
label="Choose a project"
placeholder="Select project"
optionalText="(optional)"
bind:value={$supportData.project}
{options} />
{/if}
<InputText
label="Subject"
id="subject"
placeholder="What do you need help with?"
bind:value={$supportData.subject}
required />
<InputTextarea
label="Tell us a bit more"
id="message"
placeholder="Type here..."
bind:value={$supportData.message}
required />
</FormList>
</div>
</WizardStep>