Spaces:
Running
Running
File size: 1,438 Bytes
3109a5e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
<script lang="ts">
import { applyAction, enhance } from "$app/forms";
import { invalidateAll } from "$app/navigation";
import Modal from "$lib/components/Modal.svelte";
import { createEventDispatcher } from "svelte";
const dispatch = createEventDispatcher<{ close: void }>();
let reason = "";
</script>
<Modal on:close>
<form
method="POST"
action="?/report"
use:enhance={() => {
return async ({ result }) => {
await applyAction(result);
dispatch("close");
invalidateAll();
};
}}
class="w-full min-w-64 p-4"
>
<span class="mb-1 text-sm font-semibold">Report an assistant</span>
<p class="text-sm text-gray-500">
Please provide a brief description of why you are reporting this assistant.
</p>
<textarea
name="reportReason"
class="mt-6 max-h-48 w-full resize-y rounded-lg border-2 border-gray-200 bg-gray-100 p-2 text-smd"
placeholder="Reason(s) for the report"
maxlength="128"
bind:value={reason}
/>
<div class="flex w-full flex-row justify-between px-2 pt-4">
<button
type="button"
class="text-sm text-gray-700 hover:underline"
on:click={() => dispatch("close")}>Cancel</button
>
<button
type="submit"
class="rounded-full bg-black px-4 py-2 text-sm font-semibold text-white md:px-8"
disabled={!reason}
class:bg-gray-200={!reason}
class:!text-gray-400={!reason}
>
Submit report
</button>
</div>
</form>
</Modal>
|