Удалены неиспользуемые импорты и функции из компонентов, улучшены стили и функциональность. Обновлены компоненты для работы с изображениями, добавлены новые интерфейсы и типы данных для сотрудников. Реализована логика загрузки расписания сотрудников через GraphQL, улучшен интерфейс взаимодействия с пользователем.
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState } from 'react'
|
||||
import Image from 'next/image'
|
||||
|
||||
import { useMutation } from '@apollo/client'
|
||||
import { Card } from '@/components/ui/card'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@ -80,9 +81,11 @@ export function ProductCard({ product, onEdit, onDeleted }: ProductCardProps) {
|
||||
{/* Изображение товара */}
|
||||
<div className="relative h-48 bg-white/5 overflow-hidden">
|
||||
{product.mainImage || product.images[0] ? (
|
||||
<img
|
||||
<Image
|
||||
src={product.mainImage || product.images[0]}
|
||||
alt={product.name}
|
||||
width={300}
|
||||
height={200}
|
||||
className="w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"
|
||||
/>
|
||||
) : (
|
||||
|
@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState, useRef } from 'react'
|
||||
import Image from 'next/image'
|
||||
import { useMutation, useQuery } from '@apollo/client'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
@ -9,7 +10,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@
|
||||
import { Card } from '@/components/ui/card'
|
||||
import { CREATE_PRODUCT, UPDATE_PRODUCT } from '@/graphql/mutations'
|
||||
import { GET_CATEGORIES } from '@/graphql/queries'
|
||||
import { Upload, X, Star, Plus, Image as ImageIcon } from 'lucide-react'
|
||||
import { X, Star, Upload } from 'lucide-react'
|
||||
import { toast } from 'sonner'
|
||||
|
||||
interface Product {
|
||||
@ -56,7 +57,7 @@ export function ProductForm({ product, onSave, onCancel }: ProductFormProps) {
|
||||
isActive: product?.isActive ?? true
|
||||
})
|
||||
|
||||
const [isUploading, setIsUploading] = useState(false)
|
||||
const [isUploading] = useState(false)
|
||||
const [uploadingImages, setUploadingImages] = useState<Set<number>>(new Set())
|
||||
const fileInputRef = useRef<HTMLInputElement>(null)
|
||||
|
||||
@ -420,9 +421,11 @@ export function ProductForm({ product, onSave, onCancel }: ProductFormProps) {
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<img
|
||||
<Image
|
||||
src={imageUrl}
|
||||
alt={`Товар ${index + 1}`}
|
||||
width={200}
|
||||
height={150}
|
||||
className="w-full aspect-square object-cover rounded-lg"
|
||||
/>
|
||||
|
||||
|
Reference in New Issue
Block a user