Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: nps feedback design review #724

Merged
merged 18 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 15 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
12 changes: 7 additions & 5 deletions src/lib/components/feedback/evaluation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
export let value: number = null;
</script>

<fieldset class="u-margin-block-start-8">
<fieldset class="u-margin-block-start-8 u-min-width-0">
<legend class="label is-required u-margin-0 u-line-height-1-5 u-bold">
<slot />
</legend>
<ul class="u-flex u-main-space-between u-margin-block-start-16">
<ol
class="u-flex u-main-space-between u-margin-block-start-16 u-overflow-x-auto"
style="padding-block: 0.13rem">
{#each Array(11) as _, i}
<li>
<input
Expand All @@ -18,9 +20,9 @@
checked={value === i} />
</li>
{/each}
</ul>
</ol>
<div class="u-flex u-main-space-between u-margin-block-start-8">
<span>Not at all likely</span>
<span>Extremely likely</span>
<span class:u-color-text-gray={value === null}>Not at all likely</span>
<span class:u-color-text-gray={value === null}>Extremely likely</span>
</div>
</fieldset>
10 changes: 5 additions & 5 deletions src/lib/components/feedback/feedback.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
);
addNotification({
type: 'success',
message: 'Feedback submitted successfully'
message: 'Thank you for your feedback'
});
feedback.toggleFeedback();
feedbackData.reset();
Expand All @@ -33,15 +33,15 @@
}
</script>

<section class="drop-section">
<section class="drop-section u-padding-24">
<header class="u-flex u-main-space-between u-gap-16">
<h4 class="body-text-1 u-bold">{$selectedFeedback.title}</h4>
<h4 class="label u-bold" style:font-size="var(--font-size-1)">{$selectedFeedback.title}</h4>
<button
type="button"
class="button is-text is-only-icon u-margin-inline-start-auto"
style="--button-size:1.5rem;"
aria-label="Close Modal"
title="Close Modal"
aria-label="Close feedback"
title="Close feedback"
on:click={() => feedback.toggleFeedback()}>
<span class="icon-x" aria-hidden="true" />
</button>
Expand Down
14 changes: 7 additions & 7 deletions src/lib/components/feedback/feedbackNPS.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import Evaluation from './evaluation.svelte';
</script>

<Evaluation bind:value={$feedbackData.value}>
How likely are you to recommend Appwrite to a friend or colleague?
</Evaluation>
{#if $feedbackData.value}
<FormList>
<FormList>
<Evaluation bind:value={$feedbackData.value}>
How likely are you to recommend Appwrite to a friend or colleague?
</Evaluation>
{#if $feedbackData.value !== null}
<InputTextarea
id="feedback"
placeholder="Your message here"
Expand All @@ -26,5 +26,5 @@
id="email"
bind:value={$feedbackData.email}
placeholder="Enter email" />
</FormList>
{/if}
{/if}
</FormList>
6 changes: 6 additions & 0 deletions src/lib/layout/header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@
{/if}
<DropList show={$feedback.show} scrollable on:blur={toggleFeedback}>
<button class="button is-small is-text" on:click={toggleFeedback}>
<!-- TODO: invert this before release -->
{#if !$feedback.notification}
<span
class="notification u-position-absolute u-inset-block-start-8 u-inset-inline-end-8"
></span>
{/if}
<span class="text">Feedback</span>
</button>
<svelte:fragment slot="other">
Expand Down
18 changes: 9 additions & 9 deletions src/lib/stores/feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ export type FeedbackOption = {
export const feedbackOptions: FeedbackOption[] = [
{
type: 'general',
title: 'How can we improve?',
desc: 'Your feedback is important to us. Please be honest and tell us what you think.',
title: 'Help us improve Appwrite',
desc: 'Appwrite evolves with your input. Share your thoughts and help us improve Appwrite.',
component: FeedbackGeneral
},
{
type: 'nps',
title: 'How are we doing?',
desc: "At Appwrite, we value the feedback of our users. That means you! We'd love to hear what you think.",
title: 'Help us improve Appwrite',
desc: 'Appwrite evolves with your input. Share your thoughts and help us improve Appwrite. If you would like to be contacted regarding your feedback, please share your contact details below.',
component: FeedbackNps
}
];
Expand All @@ -49,7 +49,7 @@ function createFeedbackDataStore() {
message: '',
name: '',
email: '',
value: 0
value: null
});
return {
set,
Expand All @@ -60,7 +60,7 @@ function createFeedbackDataStore() {
feedbackData.message = '';
feedbackData.name = '';
feedbackData.email = '';
feedbackData.value = 0;
feedbackData.value = null;
return feedbackData;
});
}
Expand All @@ -71,10 +71,10 @@ export const feedbackData = createFeedbackDataStore();

function createFeedbackStore() {
const { subscribe, update } = writable<Feedback>({
elapsed: browser ? parseInt(localStorage.getItem('feedbackElapsed')) : 0,
visualized: browser ? parseInt(localStorage.getItem('feedbackVisualized')) : 0,
elapsed: browser ? parseInt(localStorage.getItem('feedbackElapsed')) ?? 0 : 0,
visualized: browser ? parseInt(localStorage.getItem('feedbackVisualized')) ?? 0 : 0,
notification: false,
type: 'general',
type: 'nps', //TODO: change to general before release
show: false
});
return {
Expand Down
4 changes: 3 additions & 1 deletion src/routes/console/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@
let isOpen = false;
onMount(async () => {
loading.set(false);

if (!localStorage.getItem('feedbackElapsed')) {
localStorage.setItem('feedbackElapsed', '0');
}
setInterval(() => {
checkForFeedback(INTERVAL);
}, INTERVAL);
Expand Down
2 changes: 1 addition & 1 deletion src/routes/console/wizard/feedback/step1.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
);
addNotification({
type: 'success',
message: 'Feedback submitted successfully'
message: 'Thank you for your feedback'
});
} catch (error) {
addNotification({
Expand Down
Loading