more linting
This commit is contained in:
parent
84337b7b1d
commit
ae179550bf
@ -14,8 +14,8 @@ const feedbackOptions = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
function getFeedbackOption(value: string) {
|
function getFeedbackOption(value: string): string {
|
||||||
return feedbackOptions.find((option) => option.value === value);
|
return feedbackOptions.find((option) => option.value === value).label;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
@ -36,7 +36,7 @@ export default defineEventHandler(async (event) => {
|
|||||||
embeds: [
|
embeds: [
|
||||||
{
|
{
|
||||||
color: 3447003,
|
color: 3447003,
|
||||||
title: getFeedbackOption(type).label,
|
title: getFeedbackOption(type),
|
||||||
description,
|
description,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref } from "vue";
|
import { reactive, ref } from "vue";
|
||||||
import { useRoute } from "vitepress";
|
import { useRoute } from "vitepress";
|
||||||
import type { FeedbackType } from "../../types/Feedback";
|
import { type FeedbackType, getFeedbackOption, feedbackOptions } from "../../types/Feedback";
|
||||||
|
|
||||||
const loading = ref<boolean>(false);
|
const loading = ref<boolean>(false);
|
||||||
const error = ref<unknown>(null);
|
const error = ref<unknown>(null);
|
||||||
@ -10,23 +10,6 @@ const { path } = useRoute();
|
|||||||
|
|
||||||
const feedback = reactive<FeedbackType>({ message: "", contact: "" });
|
const feedback = reactive<FeedbackType>({ message: "", contact: "" });
|
||||||
|
|
||||||
const feedbackOptions = [
|
|
||||||
{ label: "🐞 Bug", value: "bug" },
|
|
||||||
{
|
|
||||||
label: "💡 Suggestion",
|
|
||||||
value: "suggestion",
|
|
||||||
},
|
|
||||||
{ label: "📂 Other", value: "other" },
|
|
||||||
{
|
|
||||||
label: "❤️ Appreciation",
|
|
||||||
value: "appreciate",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
function getFeedbackOption(value: string) {
|
|
||||||
return feedbackOptions.find((option) => option.value === value);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleSubmit(type?: FeedbackType["type"]) {
|
async function handleSubmit(type?: FeedbackType["type"]) {
|
||||||
if (type) feedback.type = type;
|
if (type) feedback.type = type;
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
@ -53,7 +36,7 @@ async function handleSubmit(type?: FeedbackType["type"]) {
|
|||||||
error.value = data.error;
|
error.value = data.error;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (data.status === "success") {
|
if (data.status === "ok") {
|
||||||
success.value = true;
|
success.value = true;
|
||||||
}
|
}
|
||||||
} catch (error_) {
|
} catch (error_) {
|
||||||
@ -99,7 +82,7 @@ async function handleSubmit(type?: FeedbackType["type"]) {
|
|||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
:disabled="feedback.message.length > 1000"
|
:disabled="feedback.message.length > 1000 || feedback.contact.length > 100"
|
||||||
@click="handleSubmit()">
|
@click="handleSubmit()">
|
||||||
Submit
|
Submit
|
||||||
</button>
|
</button>
|
||||||
|
@ -10,11 +10,10 @@ import {
|
|||||||
} from "@headlessui/vue";
|
} from "@headlessui/vue";
|
||||||
|
|
||||||
const isOpen = ref(true);
|
const isOpen = ref(true);
|
||||||
interface ILogger {}
|
|
||||||
|
|
||||||
const feedbackOptions = [
|
const feedbackOptions = [
|
||||||
{
|
{
|
||||||
label: "♻️ Suggestion",
|
label: "💡 Suggestion",
|
||||||
value: "suggestion",
|
value: "suggestion",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -37,8 +36,7 @@ function openModal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="p-[4px 8px] text-xl i-carbon:user-favorite-alt-filled"
|
class="p-[4px 8px] text-xl i-carbon:user-favorite-alt-filled"
|
||||||
@click="openModal"
|
@click="openModal" />
|
||||||
/>
|
|
||||||
|
|
||||||
<TransitionRoot appear :show="isOpen" as="template">
|
<TransitionRoot appear :show="isOpen" as="template">
|
||||||
<Dialog as="div" class="relative z-10" @close="closeModal">
|
<Dialog as="div" class="relative z-10" @close="closeModal">
|
||||||
@ -62,8 +60,7 @@ function openModal() {
|
|||||||
enter-to="opacity-100 scale-100"
|
enter-to="opacity-100 scale-100"
|
||||||
leave="duration-200 ease-in"
|
leave="duration-200 ease-in"
|
||||||
leave-from="opacity-100 scale-100"
|
leave-from="opacity-100 scale-100"
|
||||||
leave-to="opacity-0 scale-95"
|
leave-to="opacity-0 scale-95">
|
||||||
>
|
|
||||||
<DialogPanel
|
<DialogPanel
|
||||||
class="w-full max-w-md transform overflow-hidden rounded-2xl bg-bg p-6 text-left align-middle shadow-xl transition-all">
|
class="w-full max-w-md transform overflow-hidden rounded-2xl bg-bg p-6 text-left align-middle shadow-xl transition-all">
|
||||||
<DialogTitle as="h3" class="text-lg font-medium leading-6 text-text">
|
<DialogTitle as="h3" class="text-lg font-medium leading-6 text-text">
|
||||||
@ -75,8 +72,7 @@ function openModal() {
|
|||||||
<button
|
<button
|
||||||
v-for="item in feedbackOptions"
|
v-for="item in feedbackOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
class="inline-flex justify-center rounded-md border border-transparent bg-bg-alt px-4 py-2 text-sm font-medium text-text hover:border-primary focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2"
|
class="inline-flex justify-center rounded-md border border-transparent bg-bg-alt px-4 py-2 text-sm font-medium text-text hover:border-primary focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2">
|
||||||
>
|
|
||||||
<span>{{ item.label }}</span>
|
<span>{{ item.label }}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -84,9 +80,9 @@ function openModal() {
|
|||||||
|
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<div>
|
<div>
|
||||||
<label for="feedback-input-text" class="field-label">Feedback*</label>
|
<label class="field-label">Feedback*</label>
|
||||||
|
|
||||||
<textarea id="feedback-input-text" placeholder="meow" rows="5" />
|
<textarea placeholder="meow" rows="5" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -94,8 +90,7 @@ function openModal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="inline-flex justify-center rounded-md border border-transparent bg-blue-100 px-4 py-2 text-sm font-medium text-blue-900 hover:bg-blue-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"
|
class="inline-flex justify-center rounded-md border border-transparent bg-blue-100 px-4 py-2 text-sm font-medium text-blue-900 hover:bg-blue-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"
|
||||||
@click="closeModal"
|
@click="closeModal">
|
||||||
>
|
|
||||||
Close
|
Close
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,4 +7,21 @@ export const FeedbackSchema = z.object({
|
|||||||
page: z.string().min(3).max(10),
|
page: z.string().min(3).max(10),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const feedbackOptions = [
|
||||||
|
{ label: "🐞 Bug", value: "bug" },
|
||||||
|
{
|
||||||
|
label: "💡 Suggestion",
|
||||||
|
value: "suggestion",
|
||||||
|
},
|
||||||
|
{ label: "📂 Other", value: "other" },
|
||||||
|
{
|
||||||
|
label: "❤️ Appreciation",
|
||||||
|
value: "appreciate",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export function getFeedbackOption(value: string): { label: string; value: string } {
|
||||||
|
return feedbackOptions.find((option) => option.value === value);
|
||||||
|
}
|
||||||
|
|
||||||
export type FeedbackType = z.infer<typeof FeedbackSchema>;
|
export type FeedbackType = z.infer<typeof FeedbackSchema>;
|
||||||
|
4
.vitepress/vue-shim.d.ts
vendored
4
.vitepress/vue-shim.d.ts
vendored
@ -1,4 +1,6 @@
|
|||||||
|
import { type Component } from "vue";
|
||||||
|
|
||||||
declare module "*.vue" {
|
declare module "*.vue" {
|
||||||
const component: import("vue").Component;
|
const component: Component;
|
||||||
export default component;
|
export default component;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify-json/carbon": "^1.1.21",
|
"@iconify-json/carbon": "^1.1.21",
|
||||||
"@iconify-json/twemoji": "^1.1.12",
|
"@iconify-json/twemoji": "^1.1.12",
|
||||||
"@taskylizard/eslint-config": "^1.0.3",
|
"@taskylizard/eslint-config": "^1.0.5",
|
||||||
"@types/node": "^20.8.9",
|
"@types/node": "^20.8.9",
|
||||||
"@types/nprogress": "^0.2.3",
|
"@types/nprogress": "^0.2.3",
|
||||||
"eslint": "^8.53.0",
|
"eslint": "^8.53.0",
|
||||||
|
@ -55,8 +55,8 @@ devDependencies:
|
|||||||
specifier: ^1.1.12
|
specifier: ^1.1.12
|
||||||
version: 1.1.12
|
version: 1.1.12
|
||||||
'@taskylizard/eslint-config':
|
'@taskylizard/eslint-config':
|
||||||
specifier: ^1.0.3
|
specifier: ^1.0.5
|
||||||
version: 1.0.3(eslint-plugin-import@2.29.0)(eslint@8.53.0)(prettier@3.0.3)(typescript@5.2.2)
|
version: 1.0.5(eslint-plugin-import@2.29.0)(eslint@8.53.0)(prettier@3.0.3)(typescript@5.2.2)
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^20.8.9
|
specifier: ^20.8.9
|
||||||
version: 20.8.9
|
version: 20.8.9
|
||||||
@ -1543,8 +1543,8 @@ packages:
|
|||||||
string.prototype.codepointat: 0.2.1
|
string.prototype.codepointat: 0.2.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@taskylizard/eslint-config@1.0.3(eslint-plugin-import@2.29.0)(eslint@8.53.0)(prettier@3.0.3)(typescript@5.2.2):
|
/@taskylizard/eslint-config@1.0.5(eslint-plugin-import@2.29.0)(eslint@8.53.0)(prettier@3.0.3)(typescript@5.2.2):
|
||||||
resolution: {integrity: sha512-++eQftOq60qClRh/O8Pqrj/c0TOJkBUc62iiB5aDrsxjKu7EdndZCBJpr1C+RlLGQuosyE96G4Tag3uAZEJ8ZA==}
|
resolution: {integrity: sha512-kz3zxNPMnm7S/j7SzHbyJmZXVj1fa6STzuigQjNl1njcpuA+1ygsa1Zvn711y0wkIGik/yLiP+BTG+likBRAZA==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: '>=8.0.0'
|
eslint: '>=8.0.0'
|
||||||
prettier: '>=3.0.0 <4'
|
prettier: '>=3.0.0 <4'
|
||||||
|
Loading…
Reference in New Issue
Block a user