mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-20 05:28:22 +02:00
Merge pull request #241 from R0m1k3/1.1
Prevent opening the creation modal when clicking on additional items
This commit is contained in:
1 file changed
+25
-21
@@ -118,7 +118,7 @@ function DayItemsContainer({ dayOrders, dayDeliveries, onItemClick }: { dayOrder
|
|||||||
const hiddenCount = Math.max(0, totalItems - MAX_VISIBLE_ITEMS);
|
const hiddenCount = Math.max(0, totalItems - MAX_VISIBLE_ITEMS);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-1 relative" style={{minHeight: '60px'}}>
|
<div className="space-y-1 relative" style={{minHeight: '60px'}} data-modal-trigger="container">
|
||||||
{/* Éléments visibles - IDENTIQUE DEV/PROD */}
|
{/* Éléments visibles - IDENTIQUE DEV/PROD */}
|
||||||
{visibleItems.map((item, index) => (
|
{visibleItems.map((item, index) => (
|
||||||
<CalendarItem
|
<CalendarItem
|
||||||
@@ -131,23 +131,24 @@ function DayItemsContainer({ dayOrders, dayDeliveries, onItemClick }: { dayOrder
|
|||||||
|
|
||||||
{/* Badge "+X autres" - BLANC/GRIS UNIFORME */}
|
{/* Badge "+X autres" - BLANC/GRIS UNIFORME */}
|
||||||
{hiddenCount > 0 && (
|
{hiddenCount > 0 && (
|
||||||
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
<div data-modal-trigger="wrapper" onClick={(e) => e.stopPropagation()}>
|
||||||
<DialogTrigger asChild>
|
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
||||||
<Button
|
<DialogTrigger asChild>
|
||||||
variant="outline"
|
<Button
|
||||||
size="sm"
|
variant="outline"
|
||||||
data-modal-trigger="true"
|
size="sm"
|
||||||
className="w-full h-5 text-xs bg-white hover:bg-gray-50 border-gray-400 text-gray-700 font-semibold shadow-sm transition-all duration-150 border"
|
data-modal-trigger="button"
|
||||||
style={{display: 'block !important', position: 'relative', zIndex: 50}}
|
className="w-full h-5 text-xs bg-white hover:bg-gray-50 border-gray-400 text-gray-700 font-semibold shadow-sm transition-all duration-150 border"
|
||||||
onClick={(e) => {
|
style={{display: 'block !important', position: 'relative', zIndex: 50}}
|
||||||
e.preventDefault();
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.preventDefault();
|
||||||
setIsOpen(true);
|
e.stopPropagation();
|
||||||
}}
|
setIsOpen(true);
|
||||||
>
|
}}
|
||||||
<MoreHorizontal className="w-3 h-3 mr-1" />
|
>
|
||||||
+{hiddenCount} autres
|
<MoreHorizontal className="w-3 h-3 mr-1" />
|
||||||
</Button>
|
+{hiddenCount} autres
|
||||||
|
</Button>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
<DialogContent className="sm:max-w-lg max-h-[70vh] overflow-hidden fixed z-[9999]" style={{zIndex: 9999}}>
|
<DialogContent className="sm:max-w-lg max-h-[70vh] overflow-hidden fixed z-[9999]" style={{zIndex: 9999}}>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
@@ -197,7 +198,8 @@ function DayItemsContainer({ dayOrders, dayDeliveries, onItemClick }: { dayOrder
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -442,9 +444,11 @@ export default function CalendarGrid({
|
|||||||
: "bg-gray-150"
|
: "bg-gray-150"
|
||||||
} ${!isCurrentMonth ? 'opacity-50' : ''}`}
|
} ${!isCurrentMonth ? 'opacity-50' : ''}`}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
// Ne pas ouvrir le modal de création si on clique sur le bouton "+X autres"
|
// Ne pas ouvrir le modal de création si on clique sur le bouton "+X autres" ou à l'intérieur
|
||||||
const target = e.target as HTMLElement;
|
const target = e.target as HTMLElement;
|
||||||
if (target.closest('button[data-modal-trigger="true"]')) {
|
if (target.closest('button') || target.closest('[role="dialog"]') || target.closest('[data-modal-trigger]')) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
onDateClick(date);
|
onDateClick(date);
|
||||||
|
|||||||
Reference in new issue
Block a user