diff --git a/src/components/dropdown-menu/dropdown-menu.tsx b/src/components/dropdown-menu/dropdown-menu.tsx index 3268cb106..528044066 100644 --- a/src/components/dropdown-menu/dropdown-menu.tsx +++ b/src/components/dropdown-menu/dropdown-menu.tsx @@ -50,6 +50,7 @@ const DropdownMenu = (props: IDropdownMenu) => { const history = useHistory(); const [isOpen, setIsOpen] = useState(false); + const [isDisplayed, setIsDisplayed] = useState(false); const arrowRef = useRef(null); @@ -254,6 +255,10 @@ const DropdownMenu = (props: IDropdownMenu) => { } }, [isOpen, refs.floating.current]); + useEffect(() => { + setTimeout(() => setIsDisplayed(isOpen), isOpen ? 0 : 150); + }, [isOpen]); + if (items.length === 0) { return null; } @@ -284,14 +289,23 @@ const DropdownMenu = (props: IDropdownMenu) => { /> )} - {isOpen ? ( + {isOpen || isDisplayed ? (
{ const settings = useAppSelector((state) => getSettings(state)); const followRequestsCount = useAppSelector((state) => state.user_lists.follow_requests.items.count()); const draftCount = useAppSelector((state) => state.draft_statuses.size); + // const dashboardCount = useAppSelector((state) => state.admin.openReports.count() + state.admin.awaitingApproval.count()); const [sidebarVisible, setSidebarVisible] = useState(sidebarOpen); const [touchStart, setTouchStart] = useState(0); const [touchEnd, setTouchEnd] = useState(0); @@ -91,7 +93,6 @@ const SidebarMenu: React.FC = (): JSX.Element | null => { const restrictUnauth = instance.pleroma.metadata.restrict_unauthenticated; const containerRef = React.useRef(null); - const closeButtonRef = React.useRef(null); const [switcher, setSwitcher] = React.useState(false); @@ -148,6 +149,7 @@ const SidebarMenu: React.FC = (): JSX.Element | null => { }, []); useEffect(() => { + if (sidebarOpen) containerRef.current?.querySelector('a')?.focus(); setTimeout(() => setSidebarVisible(sidebarOpen), sidebarOpen ? 0 : 150); }, [sidebarOpen]); @@ -169,7 +171,7 @@ const SidebarMenu: React.FC = (): JSX.Element | null => {
{ >
- -
{account ? ( @@ -338,6 +331,16 @@ const SidebarMenu: React.FC = (): JSX.Element | null => { /> )} + {account.staff && ( + + )} + {
- - {/* Dummy element to keep Close Icon visible */} -
); diff --git a/src/components/status-action-button.tsx b/src/components/status-action-button.tsx index 357011266..a65dce13a 100644 --- a/src/components/status-action-button.tsx +++ b/src/components/status-action-button.tsx @@ -89,7 +89,7 @@ const StatusActionButton = React.forwardRef { const { account } = useOwnAccount(); const features = useFeatures(); + const match = useRouteMatch<{ groupId: string }>('/groups/:groupId'); + const { unreadChatsCount } = useStatContext(); const notificationCount = useAppSelector((state) => state.notifications.unread); - const dashboardCount = useAppSelector((state) => state.admin.openReports.count() + state.admin.awaitingApproval.count()); - const onOpenSidebar = () => dispatch(openSidebar()); + const handleOpenSidebar = () => dispatch(openSidebar()); + + const handleOpenComposeModal = () => { + if (match?.params.groupId) { + dispatch((_, getState) => { + const group = getState().entities[Entities.GROUPS]?.store[match.params.groupId]; + if (group) dispatch(groupComposeModal(group)); + }); + } else { + dispatch(openModal('COMPOSE')); + } + }; /** Conditionally render the supported messages link */ const renderMessagesLink = (): React.ReactNode => { @@ -51,7 +67,7 @@ const ThumbNavigation: React.FC = (): JSX.Element => { return (
- )}
); diff --git a/src/features/ui/index.tsx b/src/features/ui/index.tsx index 4c9890e39..e7d09cf76 100644 --- a/src/features/ui/index.tsx +++ b/src/features/ui/index.tsx @@ -38,7 +38,6 @@ import { getVapidKey } from 'soapbox/utils/auth'; import { isStandalone } from 'soapbox/utils/state'; import BackgroundShapes from './components/background-shapes'; -import FloatingActionButton from './components/floating-action-button'; import { Status, CommunityTimeline, @@ -444,11 +443,6 @@ const UI: React.FC = ({ children }) => { dispatch(registerPushNotifications()); }, [vapidKey]); - const shouldHideFAB = (): boolean => { - const path = location.pathname; - return Boolean(path.match(/^\/posts\/|^\/search|^\/getting-started|^\/chats/)); - }; - // Wait for login to succeed or fail if (me === null) return null; @@ -478,12 +472,6 @@ const UI: React.FC = ({ children }) => { - {(me && !shouldHideFAB()) && ( -
- -
- )} -