feat(ui): simplify auto-add context menu

This commit is contained in:
psychedelicious 2023-07-21 15:47:12 +10:00
parent fc98089960
commit 5396e998b3
2 changed files with 9 additions and 10 deletions

View File

@ -5,7 +5,7 @@ import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions'; import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
import { autoAddBoardIdChanged } from 'features/gallery/store/gallerySlice'; import { autoAddBoardIdChanged } from 'features/gallery/store/gallerySlice';
import { memo, useCallback, useMemo } from 'react'; import { memo, useCallback, useMemo } from 'react';
import { FaMinus, FaPlus, FaTrash } from 'react-icons/fa'; import { FaPlus, FaTrash } from 'react-icons/fa';
import { BoardDTO } from 'services/api/types'; import { BoardDTO } from 'services/api/types';
type Props = { type Props = {
@ -59,16 +59,15 @@ const GalleryBoardContextMenuItems = ({ board, setBoardToDelete }: Props) => {
</MenuItem> */} </MenuItem> */}
</> </>
)} )}
<MenuItem {!isSelectedForAutoAdd && (
icon={isSelectedForAutoAdd ? <FaMinus /> : <FaPlus />} <MenuItem icon={<FaPlus />} onClick={handleToggleAutoAdd}>
onClickCapture={handleToggleAutoAdd} Auto-add to this Board
>
{isSelectedForAutoAdd ? 'Disable Auto-Add' : 'Auto-Add to this Board'}
</MenuItem> </MenuItem>
)}
<MenuItem <MenuItem
sx={{ color: 'error.600', _dark: { color: 'error.300' } }} sx={{ color: 'error.600', _dark: { color: 'error.300' } }}
icon={<FaTrash />} icon={<FaTrash />}
onClickCapture={handleDelete} onClick={handleDelete}
> >
Delete Board Delete Board
</MenuItem> </MenuItem>

View File

@ -17,8 +17,8 @@ const NoBoardContextMenuItems = () => {
return ( return (
<> <>
{autoAddBoardId && ( {autoAddBoardId && (
<MenuItem icon={<FaPlus />} onClickCapture={handleDisableAutoAdd}> <MenuItem icon={<FaPlus />} onClick={handleDisableAutoAdd}>
Disable Auto-Add Auto-add to this Board
</MenuItem> </MenuItem>
)} )}
</> </>