import tld from 'utils/tld'
import state, { useSelector } from 'state'
import { IconButton, breakpoints } from 'components/shared'
import { memo } from 'react'
import styled from 'styles'
import { MoveType } from 'types'
import { Trash2 } from 'react-feather'
import Tooltip from 'components/tooltip'
import {
ArrowDownIcon,
ArrowUpIcon,
AspectRatioIcon,
BoxIcon,
CopyIcon,
EyeClosedIcon,
EyeOpenIcon,
LockClosedIcon,
LockOpen1Icon,
PinBottomIcon,
PinTopIcon,
RotateCounterClockwiseIcon,
} from '@radix-ui/react-icons'
function handleRotateCcw() {
state.send('ROTATED_CCW')
}
function handleDuplicate() {
state.send('DUPLICATED')
}
function handleHide() {
state.send('TOGGLED_SHAPE_HIDE')
}
function handleLock() {
state.send('TOGGLED_SHAPE_LOCK')
}
function handleAspectLock() {
state.send('TOGGLED_SHAPE_ASPECT_LOCK')
}
function handleMoveToBack() {
state.send('MOVED', { type: MoveType.ToBack })
}
function handleMoveBackward() {
state.send('MOVED', { type: MoveType.Backward })
}
function handleMoveForward() {
state.send('MOVED', { type: MoveType.Forward })
}
function handleMoveToFront() {
state.send('MOVED', { type: MoveType.ToFront })
}
function handleDelete() {
state.send('DELETED')
}
function ShapesFunctions() {
const isAllLocked = useSelector((s) => {
const page = tld.getPage(s.data)
return s.values.selectedIds.every((id) => page.shapes[id].isLocked)
})
const isAllAspectLocked = useSelector((s) => {
const page = tld.getPage(s.data)
return s.values.selectedIds.every(
(id) => page.shapes[id].isAspectRatioLocked
)
})
const isAllHidden = useSelector((s) => {
const page = tld.getPage(s.data)
return s.values.selectedIds.every((id) => page.shapes[id].isHidden)
})
const hasSelection = useSelector((s) => {
return tld.getSelectedIds(s.data).size > 0
})
return (
<>
{isAllHidden ? : }
{isAllLocked ? : }
{isAllAspectLocked ? : }
>
)
}
export default memo(ShapesFunctions)
const ButtonsRow = styled('div', {
position: 'relative',
display: 'flex',
width: '100%',
background: 'none',
border: 'none',
cursor: 'pointer',
outline: 'none',
alignItems: 'center',
justifyContent: 'flex-start',
padding: 4,
})