Skip to content

Commit

Permalink
Merge 47cc910 into 021039d
Browse files Browse the repository at this point in the history
  • Loading branch information
MrOrz committed Apr 27, 2020
2 parents 021039d + 47cc910 commit e406269
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 4 deletions.
49 changes: 47 additions & 2 deletions src/liff/pages/NegativeFeedback.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,54 @@
<script>
import { onMount } from 'svelte';
import { t } from 'ttag';
import Button, { Label } from '@smui/button';
import Textfield, { Input, Textarea } from '@smui/textfield';
import { DOWNVOTE_PREFIX } from 'src/lib/sharedUtils';
import { gql } from '../lib';
let processing = false;
let comment = '';
// Submitting feedback without comment first
onMount(() => gql`
mutation VoteDown {
voteReply(vote: DOWNVOTE)
}
`());
const handleSubmit = async () => {
processing = true;
await liff.sendMessages([
{
type: 'text', text: `${DOWNVOTE_PREFIX}${comment}`,
}
]);
processing = false;
liff.closeWindow();
}
</script>

<svelte:head>
<title>{t`Comment on the not-useful reply`}</title>
<title>{t`Report not useful`}</title>
</svelte:head>

<p>Negative Feedback</p>
<p>{t`We are sorry that the reply is not useful to you.`}</p>

<Textfield
fullwidth
textarea
bind:value={comment}
label={t`How can we make it useful to you?`}
input$rows={8}
/>

<Button
style="display: block; width: 100%; margin: 8px 0;"
variant="raised"
on:click={handleSubmit}
disabled={processing}
>
<Label>{t`Submit`}</Label>
</Button>
49 changes: 47 additions & 2 deletions src/liff/pages/PositiveFeedback.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,54 @@
<script>
import { onMount } from 'svelte';
import { t } from 'ttag';
import Button, { Label } from '@smui/button';
import Textfield, { Input, Textarea } from '@smui/textfield';
import { UPVOTE_PREFIX } from 'src/lib/sharedUtils';
import { gql } from '../lib';
let processing = false;
let comment = '';
// Submitting feedback without comment first
onMount(() => gql`
mutation VoteUp {
voteReply(vote: UPVOTE)
}
`());
const handleSubmit = async () => {
processing = true;
await liff.sendMessages([
{
type: 'text', text: `${UPVOTE_PREFIX}${comment}`,
}
]);
processing = false;
liff.closeWindow();
}
</script>

<svelte:head>
<title>{t`Comment on the useful reply`}</title>
<title>{t`Report reply useful`}</title>
</svelte:head>

<p>Positive feedback</p>
<p>{t`It's glad to see the reply is helpful.`}</p>

<Textfield
fullwidth
textarea
bind:value={comment}
label={t`Do you have anything to add to the reply?`}
input$rows={8}
/>

<Button
style="display: block; width: 100%; margin: 8px 0;"
variant="raised"
on:click={handleSubmit}
disabled={processing}
>
<Label>{t`Submit`}</Label>
</Button>

0 comments on commit e406269

Please sign in to comment.