fix: TS errors, serialize calls, unused imports, pre-commit hook
Build & Deploy / build (push) Successful in 32s
Build & Deploy / docker (push) Successful in 1m42s

This commit is contained in:
Kevin
2026-07-07 20:49:52 +02:00
parent 15d3a13d0a
commit c4cad4f875
16 changed files with 27 additions and 101 deletions
-21
View File
@@ -1,35 +1,14 @@
<script lang="ts" setup>
import { Link } from '@adonisjs/inertia/vue'
import { useForm } from '@inertiajs/vue3'
import { computed } from 'vue'
import EmptyLayout from '~/pages/layout/emptyLayout.vue'
defineOptions({ layout: EmptyLayout })
const props = defineProps<{ errors?: Record<string, string> }>()
const vineErrors = computed(() => {
if (props.errors && !Array.isArray(props.errors)) {
return props.errors
}
return {}
})
const authError = computed(() => {
if (props.errors && !Array.isArray(props.errors)) {
return props.errors
}
return null
})
const form = useForm({
email: '',
password: '',
})
function getErrorMessage(field: string): string | null {
return vineErrors.value[field] || null
}
</script>
<template>
+1 -1
View File
@@ -21,7 +21,7 @@ const form = useForm({
<p class="text-sm text-gray-600 mt-2">Join PC Creator today</p>
</div>
<Form route="new_account.store" #default="{ processing, errors }">
<Form route="new_account.store" #default="{ processing }">
<div class="space-y-4 sm:space-y-6">
<div>
<label class="block">
+2 -15
View File
@@ -1,11 +1,10 @@
<script setup lang="ts">
import { computed, reactive } from 'vue'
import { reactive } from 'vue'
import { Link } from '@adonisjs/inertia/vue'
import { useForm } from '@inertiajs/vue3'
import CustomSelect from '~/pages/widgets/CustomSelect.vue'
const props = defineProps<{ types: any[]; errors?: Record<string, string> }>()
const errors = computed(() => props.errors || {})
defineProps<{ types: any[]; errors?: Record<string, string> }>()
const form = reactive({
name: '',
price: 0,
@@ -14,18 +13,6 @@ const form = reactive({
quantity: 1,
})
function getErrorMessage(field: string): string | null {
return errors.value[field] || null
}
function formatDateForMySQL(date: string) {
const d = new Date(date)
const year = d.getFullYear()
const month = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0')
form.purchase_date = `${year}-${month}-${day}`
}
function submitForm() {
const inertiaForm = useForm(form)
inertiaForm.post('/components')
+1 -14
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, reactive } from 'vue'
import { reactive } from 'vue'
import { Link } from '@adonisjs/inertia/vue'
import { usePage } from '@inertiajs/vue3'
import CustomSelect from '~/pages/widgets/CustomSelect.vue'
@@ -11,7 +11,6 @@ const { props } = usePage<{
errors?: Record<string, string>
}>()
const { component, types, origin } = props
const errors = computed(() => props.errors || {})
const form = reactive({
id: component.id,
@@ -21,18 +20,6 @@ const form = reactive({
purchaseDate: component.purchaseDate,
origin: origin,
})
function getErrorMessage(field: string): string | null {
return errors.value[field] || null
}
function formatDateForMySQL(date: string) {
const d = new Date(date)
const year = d.getFullYear()
const month = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0')
form.purchase_date = `${year}-${month}-${day}`
}
</script>
<template>
-5
View File
@@ -9,7 +9,6 @@ const { props } = usePage<{
errors: Record<string, string>
}>()
const { components, states } = props
const errors = computed(() => props.errors || {})
const componentTypeOrder = [
'Processor',
@@ -48,10 +47,6 @@ const form = reactive({
globalScore: 0,
componentsId: [] as number[],
})
function getErrorMessage(field: string): string | null {
return errors.value[field] || null
}
</script>
<template>
+2 -11
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, reactive } from 'vue'
import { reactive } from 'vue'
import { Link } from '@adonisjs/inertia/vue'
import { router, usePage } from '@inertiajs/vue3'
@@ -9,8 +9,7 @@ const { props } = usePage<{
states: any[]
errors?: Record<string, string>
}>()
const { computer, availableComponents, states } = props
const errors = computed(() => props.errors || {})
const { computer, states } = props
const form = reactive({
id: computer.id,
@@ -23,17 +22,9 @@ const form = reactive({
componentsId: computer.components.map((c: any) => c.id),
})
function updateComponents(componentsId: number[]) {
form.componentsId = componentsId
}
function deleteComputer(id: number) {
router.delete(`/computers/${id}`)
}
function getErrorMessage(field: string): string | null {
return errors.value[field] || null
}
</script>
<template>
+1 -1
View File
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { Link } from '@adonisjs/inertia/vue'
const { props } = defineProps<{ computer: any }>()
const { computer } = defineProps<{ computer: any }>()
</script>
<template>
-2
View File
@@ -1,12 +1,10 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { useSidebar } from '~/composables/useSidebar'
import { Link } from '@adonisjs/inertia/vue'
import { usePage } from '@inertiajs/vue3'
import { userProfileIcon } from '~/assets/icons'
const dropdownOpen = ref(false)
const { isOpen } = useSidebar()
const page = usePage()
+2 -16
View File
@@ -1,6 +1,3 @@
import { PageProps } from '@adonisjs/inertia/types'
import { InertiaAppProps } from '@inertiajs/vue3/types/app'
interface ComponentType {
id: number
name: string
@@ -39,13 +36,13 @@ export type Component = {
type: ComponentType
}
interface ServerImage {
export interface ServerImage {
id: number
link: string
order: number
}
interface NewImage {
export interface NewImage {
file: File
order: number
}
@@ -63,15 +60,4 @@ export type UIAuthError = {
message: string
}
interface SharedProps extends PageProps {
auth: {
user: {
id: number
name: string
email: string
}
}
}
export type PageWithSharedProps = InertiaAppProps<SharedProps>
export type Image = ServerImage | NewImage
+6
View File
@@ -1,4 +1,10 @@
<script setup lang="ts">
type UIAuthError = {
status: number
code: string
message: string
}
defineProps<{
authError?: UIAuthError
}>()
+3 -4
View File
@@ -84,8 +84,7 @@
import { computed, ref, watch } from 'vue'
import { crossIcon } from '~/assets/icons'
import { Navigation, Pagination } from 'vue3-carousel'
import type { NewImage, ServerImage } from '../../../app/types/UItypes'
import type { Image } from '~/pages/types/UITypes'
import type { Image, NewImage, ServerImage } from '~/pages/types/UITypes'
const props = defineProps<{
galleryId: string
@@ -134,12 +133,12 @@ function addImage() {
function removeImage(image: Image) {
if ('id' in image) {
const index = serverImages.value.findIndex((img) => img.id === image.id)
const index = serverImages.value.findIndex((img: ServerImage) => img.id === image.id)
if (index !== -1) {
serverImages.value.splice(index, 1)
}
} else {
const index = newImages.value.findIndex((img) => img.file === image.file)
const index = newImages.value.findIndex((img: NewImage) => img.file === image.file)
if (index !== -1) {
newImages.value.splice(index, 1)
}