import clsx from 'clsx'; import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { useLocation, useRouteMatch } from 'react-router-dom'; import { groupComposeModal } from 'soapbox/actions/compose'; import { openModal } from 'soapbox/actions/modals'; import { useGroupLookup } from 'soapbox/api/hooks'; import { Avatar, HStack, Icon } from 'soapbox/components/ui'; import { useAppDispatch } from 'soapbox/hooks'; const messages = defineMessages({ publish: { id: 'compose_form.publish', defaultMessage: 'Publish' }, }); /** FloatingActionButton (aka FAB), a composer button that floats in the corner on mobile. */ const FloatingActionButton: React.FC = () => { const location = useLocation(); if (location.pathname.startsWith('/group/')) { return ; } return ; }; const HomeFAB: React.FC = () => { const intl = useIntl(); const dispatch = useAppDispatch(); const handleOpenComposeModal = () => { dispatch(openModal('COMPOSE')); }; return ( ); }; const GroupFAB: React.FC = () => { const intl = useIntl(); const dispatch = useAppDispatch(); const match = useRouteMatch<{ groupSlug: string }>('/group/:groupSlug'); const { entity: group } = useGroupLookup(match?.params.groupSlug || ''); if (!group) return null; const handleOpenComposeModal = () => { dispatch(groupComposeModal(group)); }; return ( ); }; export default FloatingActionButton;