refactor: remove any types and fix TypeScript errors
All checks were successful
Build Docker Image / build (push) Successful in 3m59s

- Export InfoProductItem, InfoHubItem, InfoSupplierItem, InfoOfferItem types
- Update InfoEntity interface to have explicit fields (no index signature)
- Export CatalogHubItem, CatalogNearestHubItem from useCatalogHubs
- Fix MapItem interfaces to accept nullable GraphQL types
- Fix v-for :key bindings to handle null uuid
- Add null guards in select-location pages
- Update HubCard to accept nullable transportTypes
- Add shims.d.ts for missing module declarations
This commit is contained in:
Ruslan Bakiev
2026-01-27 10:35:14 +07:00
parent 9210f79a3d
commit 20e0e73c58
9 changed files with 133 additions and 69 deletions

View File

@@ -48,7 +48,7 @@
@click="emit('open-info', 'supplier', entity.teamUuid)"
>
<Icon name="lucide:factory" size="14" />
{{ entity.teamName || $t('catalog.info.viewSupplier') }}
{{ entity.supplierName || entity.teamName || $t('catalog.info.viewSupplier') }}
</button>
</div>
@@ -66,8 +66,8 @@
</div>
<div v-else-if="!loadingProducts" class="flex flex-col gap-2">
<ProductCard
v-for="product in relatedProducts"
:key="product.uuid"
v-for="(product, index) in relatedProducts"
:key="product.uuid ?? index"
:product="product"
compact
selectable
@@ -90,8 +90,8 @@
</div>
<div v-else-if="!loadingSuppliers" class="flex flex-col gap-2">
<SupplierCard
v-for="supplier in relatedSuppliers"
:key="supplier.uuid"
v-for="(supplier, index) in relatedSuppliers"
:key="supplier.uuid ?? index"
:supplier="supplier"
selectable
@select="onSupplierSelect(supplier)"
@@ -113,8 +113,8 @@
</div>
<div v-else-if="!loadingHubs" class="flex flex-col gap-2">
<HubCard
v-for="hub in relatedHubs"
:key="hub.uuid"
v-for="(hub, index) in relatedHubs"
:key="hub.uuid ?? index"
:hub="hub"
selectable
@select="onHubSelect(hub)"
@@ -134,15 +134,22 @@
<script setup lang="ts">
import type { InfoEntityType } from '~/composables/useCatalogSearch'
import type {
InfoEntity,
InfoProductItem,
InfoHubItem,
InfoSupplierItem,
InfoOfferItem
} from '~/composables/useCatalogInfo'
const props = defineProps<{
entityType: InfoEntityType
entityId: string
entity: any
relatedProducts?: any[]
relatedHubs?: any[]
relatedSuppliers?: any[]
relatedOffers?: any[]
entity: InfoEntity | null
relatedProducts?: InfoProductItem[]
relatedHubs?: InfoHubItem[]
relatedSuppliers?: InfoSupplierItem[]
relatedOffers?: InfoOfferItem[]
selectedProduct?: string | null
currentTab?: string
loading?: boolean
@@ -209,20 +216,17 @@ const formatPrice = (price: number | string) => {
}
// Handlers for selecting related items
const onProductSelect = (product: any) => {
if (product.uuid) {
// Navigate to offer info for this product
emit('select-product', product.uuid)
}
const onProductSelect = (product: InfoProductItem) => {
emit('select-product', product.uuid)
}
const onHubSelect = (hub: any) => {
const onHubSelect = (hub: InfoHubItem) => {
if (hub.uuid) {
emit('open-info', 'hub', hub.uuid)
}
}
const onSupplierSelect = (supplier: any) => {
const onSupplierSelect = (supplier: InfoSupplierItem) => {
if (supplier.uuid) {
emit('open-info', 'supplier', supplier.uuid)
}