replace feedback & contact with contact
This commit is contained in:
@@ -41,12 +41,6 @@
|
|||||||
href: 'faq',
|
href: 'faq',
|
||||||
active: false
|
active: false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'Feedback & Kontakt',
|
|
||||||
sprite: MenuFeedback.src,
|
|
||||||
href: 'feedback',
|
|
||||||
active: false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'Admins',
|
name: 'Admins',
|
||||||
sprite: MenuAdmins.src,
|
sprite: MenuAdmins.src,
|
||||||
|
|||||||
@@ -10,12 +10,11 @@ import Input from '@components/input/Input.svelte';
|
|||||||
<WebsiteLayout title="Feedback & Kontakt">
|
<WebsiteLayout title="Feedback & Kontakt">
|
||||||
<div class="flex justify-center items-center">
|
<div class="flex justify-center items-center">
|
||||||
<div class="mt-12 grid card w-11/12 xl:w-2/3 2xl:w-1/2 p-6 shadow-lg">
|
<div class="mt-12 grid card w-11/12 xl:w-2/3 2xl:w-1/2 p-6 shadow-lg">
|
||||||
<h2 class="text-3xl text-center">Feedback & Kontakt</h2>
|
<h2 class="text-3xl text-center">Kontakt</h2>
|
||||||
<form id="feedback-contact">
|
<form id="feedback-contact">
|
||||||
<div class="space-y-4 mt-6 mb-4">
|
<div class="space-y-4 mt-6 mb-4">
|
||||||
<Select id="type" values={{ 'website-feedback': 'Feedback', 'website-contact': 'Kontakt' }} />
|
<Textarea id="content" label="Feedback" dynamicWidth required rows={10} />
|
||||||
<Textarea id="content" label="Feedback" dynamicWidth required rows={5} />
|
<Input id="email" type="email" label="Email" required />
|
||||||
<Input id="email" type="email" label="Email" required hidden />
|
|
||||||
</div>
|
</div>
|
||||||
<button id="send" class="btn">Senden</button>
|
<button id="send" class="btn">Senden</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -34,66 +33,22 @@ import Input from '@components/input/Input.svelte';
|
|||||||
|
|
||||||
function setupForm() {
|
function setupForm() {
|
||||||
const form = document.getElementById('feedback-contact') as HTMLFormElement;
|
const form = document.getElementById('feedback-contact') as HTMLFormElement;
|
||||||
const type = document.getElementById('type') as HTMLSelectElement;
|
|
||||||
const content = document.getElementById('content') as HTMLTextAreaElement;
|
const content = document.getElementById('content') as HTMLTextAreaElement;
|
||||||
const email = document.getElementById('email') as HTMLInputElement;
|
const email = document.getElementById('email') as HTMLInputElement;
|
||||||
|
|
||||||
// reset form on site (re-)load
|
// reset form on site (re-)load
|
||||||
form.reset();
|
form.reset();
|
||||||
|
|
||||||
type.addEventListener('change', () => {
|
|
||||||
if (type.value === 'website-feedback') {
|
|
||||||
// content input
|
|
||||||
content.previousElementSibling!.firstChild!.textContent = 'Feedback';
|
|
||||||
// email input
|
|
||||||
email.parentElement!.hidden = true;
|
|
||||||
email.required = false;
|
|
||||||
} else if (type.value === 'website-contact') {
|
|
||||||
// content input
|
|
||||||
content.previousElementSibling!.firstChild!.textContent = 'Anfrage';
|
|
||||||
// email input
|
|
||||||
email.required = true;
|
|
||||||
email.parentElement!.hidden = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
email.required = false;
|
|
||||||
|
|
||||||
form.addEventListener('submit', async (e) => {
|
form.addEventListener('submit', async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (type.value === 'website-feedback') {
|
|
||||||
confirmPopupState.set({
|
|
||||||
title: 'Feedback abschicken',
|
|
||||||
message: 'Soll das Feedback abgeschickt werden?',
|
|
||||||
onConfirm: () => sendFeedback().then(() => form.reset())
|
|
||||||
});
|
|
||||||
} else if (type.value === 'website-contact') {
|
|
||||||
confirmPopupState.set({
|
confirmPopupState.set({
|
||||||
title: 'Kontaktanfrage abschicken',
|
title: 'Kontaktanfrage abschicken',
|
||||||
message: 'Soll die Kontaktanfrage abgeschickt werden?',
|
message: 'Soll die Kontaktanfrage abgeschickt werden?',
|
||||||
onConfirm: () => sendContact().then(() => form.reset())
|
onConfirm: () => sendContact().then(() => form.reset())
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const sendFeedback = async () => {
|
|
||||||
const { error } = await actions.feedback.addWebsiteFeedback({
|
|
||||||
content: content.value
|
|
||||||
});
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
actionErrorPopup(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
popupState.set({
|
|
||||||
type: 'info',
|
|
||||||
title: 'Feedback abgeschickt',
|
|
||||||
message: 'Dein Feedback wurde abgeschickt. Vielen Dank, dass du uns hilfst, das Projekt besser zu machen!'
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const sendContact = async () => {
|
const sendContact = async () => {
|
||||||
const { error } = await actions.feedback.addWebsiteContact({
|
const { error } = await actions.feedback.addWebsiteContact({
|
||||||
content: content.value,
|
content: content.value,
|
||||||
@@ -102,7 +57,7 @@ import Input from '@components/input/Input.svelte';
|
|||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
actionErrorPopup(error);
|
actionErrorPopup(error);
|
||||||
return;
|
throw null;
|
||||||
}
|
}
|
||||||
|
|
||||||
popupState.set({
|
popupState.set({
|
||||||
@@ -210,5 +210,8 @@ nicht gestattet.</p>`
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="w-full flex justify-center mt-6 sm:mt-12">
|
||||||
|
<a class="btn" href="contact">Deine Frage ist nicht aufgeführt? Schreib uns!</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</WebsiteLayout>
|
</WebsiteLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user