import { Draggable, DraggableStyle } from "@hello-pangea/dnd"; import { Box, useTheme } from "@mui/material"; import Grid from '@mui/material/Grid'; import { Exercise } from "@/components/Exercises"; import { Slot } from "@/components/Routines/models/Slot"; import { SlotDetails } from "@/components/Routines/widgets/SlotDetails"; import { SlotExercisePicker } from "@/components/Routines/widgets/slots/SlotExercisePicker"; import { SlotHeader } from "@/components/Routines/widgets/slots/SlotHeader"; import { SlotForm } from "@/components/Routines/widgets/forms/SlotForm"; export const DraggableSlotItem = (props: { slot: Slot, index: number, routineId: number, simpleMode: boolean, showAutocompleter: boolean, onDelete: (slotId: number) => void, onDuplicate: (slotId: number) => void, onAddSuperset: (slotId: number) => void, addSupersetIsPending: boolean, onExerciseSelected: (exercise: Exercise) => void, groupSize?: number, indexInGroup?: number, }) => { const theme = useTheme(); const grid = 8; const isGrouped = props.groupSize !== undefined && props.groupSize > 1; const isLastInGroup = isGrouped && props.indexInGroup === (props.groupSize! - 1); const getItemStyle = (isDragging: boolean, draggableStyle: DraggableStyle) => ({ border: isGrouped ? 'none' : isDragging ? `1px solid ${theme.palette.grey[900]}` : `1px solid ${theme.palette.grey[300]}`, borderBottom: isGrouped && !isLastInGroup ? `1px solid ${theme.palette.grey[200]}` : isGrouped ? 'none' : undefined, backgroundColor: "white", marginBottom: isGrouped ? 0 : grid, ...draggableStyle }); return ( {(provided, snapshot) => ( {!props.simpleMode && } )} ); };