import { DraggableProvidedDragHandleProps } from "@hello-pangea/dnd"; import { SsidChart } from "@mui/icons-material"; import AddIcon from "@mui/icons-material/Add"; import ContentCopyIcon from "@mui/icons-material/ContentCopy"; import DeleteIcon from "@mui/icons-material/Delete"; import DragIndicatorIcon from '@mui/icons-material/DragIndicator'; import { Button, ButtonGroup, IconButton, Typography, useTheme } from "@mui/material"; import Grid from '@mui/material/Grid'; import { LoadingProgressIcon } from "@/core/ui/LoadingWidget/LoadingWidget"; import { Slot } from "@/components/Routines/models/Slot"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { makeLink, WgerLink } from "@/core/lib/url"; export const SlotHeader = (props: { slot: Slot, index: number, dragHandleProps: DraggableProvidedDragHandleProps | null | undefined, routineId: number, onDelete: (slotId: number) => void, onDuplicate: (slotId: number) => void, onAddSuperset: (slotId: number) => void, addSupersetIsPending: boolean, groupSize?: number, indexInGroup?: number, }) => { const [t, i18n] = useTranslation(); const theme = useTheme(); const isGrouped = props.groupSize !== undefined && props.groupSize > 1; if (isGrouped) { return ( props.onDelete(props.slot.id!)}> {t('routines.setNr', { number: (props.indexInGroup ?? 0) + 1 })} ); } return ( props.onDelete(props.slot.id!)}> {props.slot.entries.length > 1 ? t('routines.supersetNr', { number: props.index + 1 }) : t('routines.exerciseNr', { number: props.index + 1 }) } {props.slot.entries.length > 0 && {props.slot.entries.length === 1 && } } ); };