chore: restructure project into backend and frontend folders
- Move all frontend code to frontend/ directory - Add backend/ with Go project structure (cmd, internal, pkg) - Add docker-compose.yml for orchestration
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import { MapPin, Phone } from 'lucide-react';
|
||||
import type { Delivery } from '../../types';
|
||||
import { pickupLocationLabels } from '../../types';
|
||||
import { StatusBadge } from './StatusBadge';
|
||||
|
||||
interface DeliveryRowProps {
|
||||
delivery: Delivery;
|
||||
onStatusChange: (id: string) => void;
|
||||
onEdit: (delivery: Delivery) => void;
|
||||
onDelete: (id: string) => void;
|
||||
}
|
||||
|
||||
export const DeliveryRow = ({ delivery, onStatusChange, onEdit, onDelete }: DeliveryRowProps) => {
|
||||
const handleAddressClick = (e: React.MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
const encodedAddress = encodeURIComponent(delivery.address);
|
||||
window.open(`https://maps.google.com/?q=${encodedAddress}`, '_blank');
|
||||
};
|
||||
|
||||
const handlePhoneClick = (e: React.MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
window.location.href = `tel:${delivery.phone}`;
|
||||
};
|
||||
|
||||
return (
|
||||
<tr className="hover:bg-[#f5f3f5] transition-colors border-b border-[#e4e2e4] last:border-b-0">
|
||||
<td className="px-4 py-3">
|
||||
<StatusBadge
|
||||
status={delivery.status}
|
||||
onClick={() => onStatusChange(delivery.id)}
|
||||
size="sm"
|
||||
/>
|
||||
</td>
|
||||
<td className="px-4 py-3 text-sm text-[#1b1b1d]">{delivery.date}</td>
|
||||
<td className="px-4 py-3 text-sm text-[#1b1b1d]">{pickupLocationLabels[delivery.pickupLocation]}</td>
|
||||
<td className="px-4 py-3 text-sm text-[#1b1b1d]">{delivery.productName}</td>
|
||||
<td className="px-4 py-3">
|
||||
<button
|
||||
onClick={handleAddressClick}
|
||||
className="flex items-center gap-1.5 text-sm text-[#1B263B] hover:text-[#F28C28] transition-colors text-left"
|
||||
>
|
||||
<MapPin size={14} />
|
||||
<span className="max-w-[200px] truncate">{delivery.address}</span>
|
||||
</button>
|
||||
</td>
|
||||
<td className="px-4 py-3">
|
||||
<button
|
||||
onClick={handlePhoneClick}
|
||||
className="flex items-center gap-1.5 text-sm text-[#16a34a] hover:underline transition-colors"
|
||||
>
|
||||
<Phone size={14} />
|
||||
{delivery.phone}
|
||||
</button>
|
||||
</td>
|
||||
<td className="px-4 py-3 text-sm text-[#45474d] max-w-[200px] truncate">
|
||||
{delivery.comment || '-'}
|
||||
</td>
|
||||
<td className="px-4 py-3">
|
||||
<div className="flex items-center gap-1">
|
||||
<button
|
||||
onClick={() => onEdit(delivery)}
|
||||
className="p-1.5 rounded-md hover:bg-[#e4e2e4] text-[#75777d] transition-colors"
|
||||
title="Редактировать"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"/></svg>
|
||||
</button>
|
||||
<button
|
||||
onClick={() => onDelete(delivery.id)}
|
||||
className="p-1.5 rounded-md hover:bg-red-50 text-red-500 transition-colors"
|
||||
title="Удалить"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user