Обновлен компонент MessengerAttachments: добавлено свойство aria-hidden для иконок изображений, улучшена доступность. Удалены устаревшие интерфейсы WildberriesCard и SelectedCard из компонентов create-supply-form и wb-product-cards, улучшена структура кода.

This commit is contained in:
Bivekich
2025-07-21 23:03:36 +03:00
parent b8d450f135
commit 01d342b557
4 changed files with 67 additions and 69 deletions

View File

@ -137,7 +137,7 @@ export function MessengerAttachments({ counterparty, onViewChange }: MessengerAt
const renderFileIcon = (fileType?: string) => { const renderFileIcon = (fileType?: string) => {
if (!fileType) return <FileText className="h-4 w-4 text-gray-400" /> if (!fileType) return <FileText className="h-4 w-4 text-gray-400" />
if (fileType.startsWith('image/')) return <Image className="h-4 w-4 text-blue-400" /> if (fileType.startsWith('image/')) return <Image className="h-4 w-4 text-blue-400" aria-hidden="true" />
if (fileType.startsWith('audio/')) return <Music className="h-4 w-4 text-green-400" /> if (fileType.startsWith('audio/')) return <Music className="h-4 w-4 text-green-400" />
if (fileType.startsWith('video/')) return <Video className="h-4 w-4 text-purple-400" /> if (fileType.startsWith('video/')) return <Video className="h-4 w-4 text-purple-400" />
return <FileText className="h-4 w-4 text-gray-400" /> return <FileText className="h-4 w-4 text-gray-400" />
@ -207,7 +207,7 @@ export function MessengerAttachments({ counterparty, onViewChange }: MessengerAt
className="w-full h-full object-cover" className="w-full h-full object-cover"
/> />
<div className="absolute inset-0 bg-black/20 flex items-center justify-center opacity-0 hover:opacity-100 transition-opacity"> <div className="absolute inset-0 bg-black/20 flex items-center justify-center opacity-0 hover:opacity-100 transition-opacity">
<Image className="h-4 w-4 text-white" /> <Image className="h-4 w-4 text-white" aria-hidden="true" />
</div> </div>
</div> </div>
) : ( ) : (
@ -319,7 +319,7 @@ export function MessengerAttachments({ counterparty, onViewChange }: MessengerAt
{imageMessages.length === 0 ? ( {imageMessages.length === 0 ? (
<div className="flex items-center justify-center h-64"> <div className="flex items-center justify-center h-64">
<div className="text-center"> <div className="text-center">
<Image className="h-12 w-12 text-white/20 mx-auto mb-4" /> <Image className="h-12 w-12 text-white/20 mx-auto mb-4" aria-hidden="true" />
<p className="text-white/60">Нет изображений</p> <p className="text-white/60">Нет изображений</p>
</div> </div>
</div> </div>
@ -339,7 +339,7 @@ export function MessengerAttachments({ counterparty, onViewChange }: MessengerAt
className="w-full h-full object-cover" className="w-full h-full object-cover"
/> />
<div className="absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors flex items-center justify-center"> <div className="absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors flex items-center justify-center">
<Image className="h-6 w-6 text-white opacity-0 group-hover:opacity-100 transition-opacity" /> <Image className="h-6 w-6 text-white opacity-0 group-hover:opacity-100 transition-opacity" aria-hidden="true" />
</div> </div>
<div className="absolute bottom-2 left-2 right-2"> <div className="absolute bottom-2 left-2 right-2">
<div className="text-white text-xs truncate bg-black/50 px-2 py-1 rounded"> <div className="text-white text-xs truncate bg-black/50 px-2 py-1 rounded">

View File

@ -16,6 +16,7 @@ import {
Star Star
} from 'lucide-react' } from 'lucide-react'
import { WBProductCards } from './wb-product-cards' import { WBProductCards } from './wb-product-cards'
import { SelectedCard, WildberriesCard } from '@/types/supplies'
// import { WholesalerSelection } from './wholesaler-selection' // import { WholesalerSelection } from './wholesaler-selection'
interface Wholesaler { interface Wholesaler {
@ -32,33 +33,7 @@ interface Wholesaler {
specialization: string[] specialization: string[]
} }
interface WildberriesCard {
nmID: number
vendorCode: string
title: string
description: string
brand: string
mediaFiles: string[]
sizes: Array<{
chrtID: number
techSize: string
wbSize: string
price: number
discountedPrice: number
quantity: number
}>
}
interface SelectedCard {
card: WildberriesCard
selectedQuantity: number
selectedMarket: string
selectedPlace: string
sellerName: string
sellerPhone: string
deliveryDate: string
selectedServices: string[]
}
interface CreateSupplyFormProps { interface CreateSupplyFormProps {
onClose: () => void onClose: () => void

View File

@ -34,46 +34,9 @@ import { apolloClient } from '@/lib/apollo-client'
import { GET_MY_COUNTERPARTIES, GET_COUNTERPARTY_SERVICES, GET_COUNTERPARTY_SUPPLIES } from '@/graphql/queries' import { GET_MY_COUNTERPARTIES, GET_COUNTERPARTY_SERVICES, GET_COUNTERPARTY_SUPPLIES } from '@/graphql/queries'
import { CREATE_WILDBERRIES_SUPPLY } from '@/graphql/mutations' import { CREATE_WILDBERRIES_SUPPLY } from '@/graphql/mutations'
import { toast } from 'sonner' import { toast } from 'sonner'
import { SelectedCard, FulfillmentService, ConsumableService, WildberriesCard } from '@/types/supplies'
interface WildberriesCard {
nmID: number
vendorCode: string
sizes: Array<{
chrtID: number
techSize: string
wbSize: string
price: number
discountedPrice: number
quantity: number
}>
mediaFiles: string[]
object: string
parent: string
countryProduction: string
supplierVendorCode: string
brand: string
title: string
description: string
}
interface SelectedCard {
card: WildberriesCard
selectedQuantity: number
customPrice: number // Пользовательская цена за все количество
selectedFulfillmentOrg: string // ID выбранной FF организации
selectedFulfillmentServices: string[] // ID выбранных услуг FF (множественный выбор)
selectedConsumableOrg: string // ID выбранной организации расходников
selectedConsumableServices: string[] // ID выбранных расходников (множественный выбор)
deliveryDate: string
}
interface FulfillmentService {
id: string
name: string
description?: string
price: number
organizationName: string
}
interface Organization { interface Organization {
id: string id: string
@ -519,7 +482,12 @@ export function WBProductCards({ onBack, onComplete }: WBProductCardsProps) {
selectedFulfillmentServices: [], selectedFulfillmentServices: [],
selectedConsumableOrg: '', selectedConsumableOrg: '',
selectedConsumableServices: [], selectedConsumableServices: [],
deliveryDate: '' deliveryDate: '',
selectedMarket: '',
selectedPlace: '',
sellerName: '',
sellerPhone: '',
selectedServices: []
} }
return [...prev, newSelectedCard] return [...prev, newSelectedCard]
} }

55
src/types/supplies.ts Normal file
View File

@ -0,0 +1,55 @@
export interface WildberriesCard {
nmID: number
vendorCode: string
sizes: Array<{
chrtID: number
techSize: string
wbSize: string
price: number
discountedPrice: number
quantity: number
}>
mediaFiles: string[]
object: string
parent: string
countryProduction: string
supplierVendorCode: string
brand: string
title: string
description: string
}
export interface SelectedCard {
card: WildberriesCard
selectedQuantity: number
customPrice: number // Пользовательская цена за все количество
selectedFulfillmentOrg: string // ID выбранной FF организации
selectedFulfillmentServices: string[] // ID выбранных услуг FF (множественный выбор)
selectedConsumableOrg: string // ID выбранной организации расходников
selectedConsumableServices: string[] // ID выбранных расходников (множественный выбор)
deliveryDate: string
selectedMarket: string
selectedPlace: string
sellerName: string
sellerPhone: string
selectedServices: string[]
}
export interface FulfillmentService {
id: string
name: string
description?: string
price: number
organizationName: string
organizationId: string
}
export interface ConsumableService {
id: string
name: string
description?: string
price: number
unit: string
organizationName: string
organizationId: string
}