import { AppState } from '@/UIModels/AppState' import VisuallyHidden from '@reach/visually-hidden' import { observer } from 'mobx-react-lite' import { FunctionComponent, useCallback } from 'react' import Icon from '@/Components/Icon/Icon' type Props = { appState: AppState className?: string onClickPreprocessing?: () => Promise } const PinNoteButton: FunctionComponent = ({ appState, className = '', onClickPreprocessing }: Props) => { const notes = appState.notes.selectedNotes const pinned = notes.some((note) => note.pinned) const togglePinned = useCallback(async () => { if (onClickPreprocessing) { await onClickPreprocessing() } if (!pinned) { appState.notes.setPinSelectedNotes(true) } else { appState.notes.setPinSelectedNotes(false) } }, [appState, onClickPreprocessing, pinned]) return ( ) } export default observer(PinNoteButton)