diff --git a/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx b/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx index a93b0fb28..ebc0c2471 100644 --- a/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx +++ b/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx @@ -7,6 +7,8 @@ import Icon from 'pl-fe/components/ui/icon'; import Toggle from 'pl-fe/components/ui/toggle'; import { userTouching } from 'pl-fe/is-mobile'; +type Menu = Array; + type MenuItem = { action?: React.EventHandler; active?: boolean; @@ -21,7 +23,7 @@ type MenuItem = { target?: React.HTMLAttributeAnchorTarget; text: string; type?: 'toggle' | 'radio'; - items?: Array>; + items?: Menu; onSelectFile?: (files: FileList) => void; accept?: string; } & ({ @@ -180,4 +182,4 @@ const DropdownMenuItem = ({ index, item, onClick, autoFocus, onSetTab }: IDropdo ); }; -export { type MenuItem, DropdownMenuItem as default }; +export { type Menu, type MenuItem, DropdownMenuItem as default }; diff --git a/packages/pl-fe/src/components/dropdown-menu/dropdown-menu.tsx b/packages/pl-fe/src/components/dropdown-menu/dropdown-menu.tsx index bdc278e5b..1a34bcf7d 100644 --- a/packages/pl-fe/src/components/dropdown-menu/dropdown-menu.tsx +++ b/packages/pl-fe/src/components/dropdown-menu/dropdown-menu.tsx @@ -12,14 +12,12 @@ import { userTouching } from 'pl-fe/is-mobile'; import { useModalsActions } from 'pl-fe/stores/modals'; import { useUiStoreActions } from 'pl-fe/stores/ui'; -import DropdownMenuItem, { MenuItem } from './dropdown-menu-item'; +import DropdownMenuItem, { Menu } from './dropdown-menu-item'; const messages = defineMessages({ back: { id: 'card.back.label', defaultMessage: 'Back' }, }); -type Menu = Array; - interface IDropdownMenuContent { handleClose: () => any; items?: Menu; diff --git a/packages/pl-fe/src/components/hashtag-link.tsx b/packages/pl-fe/src/components/hashtag-link.tsx index 67af7e3e1..4b2c21cdc 100644 --- a/packages/pl-fe/src/components/hashtag-link.tsx +++ b/packages/pl-fe/src/components/hashtag-link.tsx @@ -7,7 +7,7 @@ interface IHashtagLink { } const HashtagLink: React.FC = ({ hashtag }) => ( - e.stopPropagation()}> + e.stopPropagation()} */> #{hashtag} ); diff --git a/packages/pl-fe/src/components/modal-root.tsx b/packages/pl-fe/src/components/modal-root.tsx index de27378f6..5c4a2c6d9 100644 --- a/packages/pl-fe/src/components/modal-root.tsx +++ b/packages/pl-fe/src/components/modal-root.tsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import React, { useCallback, useEffect, useRef, useState } from 'react'; import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; -import { useHistory } from 'react-router-dom'; +// import { useHistory } from 'react-router-dom'; import { cancelReplyCompose } from 'pl-fe/actions/compose'; import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; @@ -35,7 +35,7 @@ interface IModalRoot { const ModalRoot: React.FC = ({ children, onCancel, onClose, type }) => { const intl = useIntl(); - const history = useHistory(); + // const history = useHistory(); const dispatch = useAppDispatch(); const persistDraftStatus = usePersistDraftStatus(); @@ -45,8 +45,8 @@ const ModalRoot: React.FC = ({ children, onCancel, onClose, type }) const ref = useRef(null); const activeElement = useRef(revealed ? document.activeElement as HTMLDivElement | null : null); - const modalHistoryKey = useRef(); - const unlistenHistory = useRef>(); + // const modalHistoryKey = useRef(); + // const unlistenHistory = useRef>(); const prevChildren = usePrevious(children); @@ -121,33 +121,33 @@ const ModalRoot: React.FC = ({ children, onCancel, onClose, type }) }, []); const handleModalOpen = () => { - modalHistoryKey.current = Date.now(); - unlistenHistory.current = history.listen(({ state }, action) => { - if (!(state as any)?.plFeModalKey) { - onClose(); - } else if (action === 'POP') { - handleOnClose(); + // modalHistoryKey.current = Date.now(); + // unlistenHistory.current = history.listen(({ state }, action) => { + // if (!(state as any)?.plFeModalKey) { + // onClose(); + // } else if (action === 'POP') { + // handleOnClose(); - if (onCancel) onCancel(); - } - }); + // if (onCancel) onCancel(); + // } + // }); }; const handleModalClose = () => { - if (unlistenHistory.current) { - unlistenHistory.current(); - } - const { state } = history.location; - if (state && (state as any).plFeModalKey === modalHistoryKey.current) { - history.goBack(); - } + // if (unlistenHistory.current) { + // unlistenHistory.current(); + // } + // const { state } = history.location; + // if (state && (state as any).plFeModalKey === modalHistoryKey.current) { + // history.goBack(); + // } }; const ensureHistoryBuffer = () => { - const { state } = history.location; - if (!state || (state as any).plFeModalKey !== modalHistoryKey.current) { - history.push({ ...history.location, state: { ...(state as any), plFeModalKey: modalHistoryKey.current } }); - } + // const { state } = history.location; + // if (!state || (state as any).plFeModalKey !== modalHistoryKey.current) { + // history.push({ ...history.location, state: { ...(state as any), plFeModalKey: modalHistoryKey.current } }); + // } }; const getSiblings = () => Array(...(ref.current!.parentElement!.childNodes as any as ChildNode[])) diff --git a/packages/pl-fe/src/features/ui/index.tsx b/packages/pl-fe/src/features/ui/index.tsx index e14d73f9d..41a0ada12 100644 --- a/packages/pl-fe/src/features/ui/index.tsx +++ b/packages/pl-fe/src/features/ui/index.tsx @@ -536,9 +536,9 @@ const UI: React.FC = React.memo(() => { - {/* + - */} +