import React from 'react'
import Image from 'next/image'
import Button from '@/components/ui/Button'
import { SearchCardProps } from '@/app/types'
import noPhoto from '../../../../public/images/noPhoto.png'
const SearchCard = ({
id,
username,
owner_type,
from_city_name,
from_country_name,
to_city_name,
to_country_name,
formatted_cargo_type,
formatted_transport,
type_transport,
userImg,
comment,
formatted_departure,
formatted_arrival,
country_from_icon,
country_to_icon,
}: SearchCardProps) => {
const getUserRequestStyles = () => {
if (owner_type === 'customer') {
return 'text-[#065bff]'
}
return 'text-[#45c226]'
}
const setMovingTypeIcon = () => {
if (type_transport === 'avia') {
return '/images/airplane.png'
}
return '/images/car.png'
}
const userRequest = owner_type === 'customer' ? 'Нужен перевозчик' : 'Могу перевезти'
return (
<>
{/* десктоп */}
{username}
|
{userRequest}
Тип посылки:{' '}
{formatted_cargo_type}
Объявление № {id}
{userRequest === 'Нужен перевозчик' ? (
Забрать из:
) : (
Выезжаю из:
)}
{from_country_name.substring(0, 3).toUpperCase()}
{from_city_name} / {from_country_name}
{userRequest === 'Могу перевезти' && (
Отправление:{' '}
{formatted_departure}
)}
{formatted_transport}
{userRequest === 'Нужен перевозчик' && (
Дата доставки:{' '}
{formatted_arrival}
)}
{userRequest === 'Нужен перевозчик' ? (
Доставить в:
) : (
Прибываю в:
)}
{to_country_name.substring(0, 3).toUpperCase()}
{to_city_name} / {to_country_name}
{userRequest === 'Могу перевезти' && (
Прибытие:{' '}
{formatted_arrival}
)}
{/* мобилка */}
{userRequest}
Тип посылки: {formatted_cargo_type}
Объявление № {id}
{userRequest === 'Нужен перевозчик' ? (
Забрать из:
) : (
Выезжаю из:
)}
{from_country_name.substring(0, 3).toUpperCase()}
{from_city_name} / {from_country_name}
{formatted_transport}
Дата доставки: {formatted_arrival}
{userRequest === 'Нужен перевозчик' ? (
Доставить в:
) : (
Прибываю в:
)}
{to_country_name.substring(0, 3).toUpperCase()}
{to_city_name} / {to_country_name}
{userRequest === 'Могу перевезти' && (
Прибытие:{' '}
{formatted_arrival}
)}
>
)
}
export default SearchCard