Skip to content

Commit

Permalink
feat(WordSuggestHint): set current search to form
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-berlin committed Jun 29, 2024
1 parent b56467b commit 65eb302
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/components/SuggestWordForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ import { createToastNotify } from "@stores/index.ts";
import { sendEmail } from "@services/sendMail.ts";
import type { SendEmailPayload } from "@ts_types/generated/graphql.ts";
const props = defineProps<{
berlinerWord?: string;
}>();
export interface FormData {
berlinerWord?: string;
translation?: string;
Expand Down Expand Up @@ -182,6 +186,10 @@ const turnstileSiteKey = import.meta.env.PUBLIC_TURNSTILE_SITE_KEY;
const isVerified = ref(false);
const isSending = ref(false);
if (props.berlinerWord) {
formData.berlinerWord = props.berlinerWord;
}
const sendMail = async (): Promise<void> => {
const createBody = `
<p>Ein neues Berliner Wort wurde eingereicht:</p>
Expand Down
11 changes: 9 additions & 2 deletions src/components/WordSuggestHint.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<template>
<div class="c-word-suggest-hint">
<p>Dieses Wort ist anscheinend noch nicht Teil des Wörterbuchs. Möchtest du es hinzufügen?</p>
<button type="button" class="c-button" @click="getModalLoaded">Wort hinzufügen</button>
<button type="button" class="c-button c-button--center-icon" @click="getModalLoaded">
<CirclePlus />Wort hinzufügen
</button>

<Modal
v-if="loadModal"
Expand All @@ -11,17 +13,22 @@
@close="showModal = false"
@mounted="modalMounted = true"
>
<SuggestWordForm />
<SuggestWordForm :berliner-word="wordSearch.search" />
</Modal>
</div>
</template>

<script setup lang="ts">
import { ref, defineAsyncComponent } from "vue";
import CirclePlus from "virtual:icons/lucide/circle-plus";
import { $wordSearch } from "@stores/index.ts";
import { useStore } from "@nanostores/vue";
const Modal = defineAsyncComponent(() => import("@components/Modal.vue"));
const SuggestWordForm = defineAsyncComponent(() => import("@components/SuggestWordForm.vue"));
const wordSearch = useStore($wordSearch);
const showModal = ref(false);
const loadModal = ref(false);
const modalMounted = ref(false);
Expand Down

0 comments on commit 65eb302

Please sign in to comment.