diff --git a/app/soapbox/features/ui/components/compose-button.tsx b/app/soapbox/features/ui/components/compose-button.tsx
index e16e2713c..a2944f699 100644
--- a/app/soapbox/features/ui/components/compose-button.tsx
+++ b/app/soapbox/features/ui/components/compose-button.tsx
@@ -40,31 +40,27 @@ const GroupComposeButton = () => {
const match = useRouteMatch<{ groupSlug: string }>('/group/:groupSlug');
const { entity: group } = useGroupLookup(match?.params.groupSlug || '');
+ if (!group) return null;
+
const onOpenCompose = () => {
- if (group) {
- dispatch(groupComposeModal(group));
- }
+ dispatch(groupComposeModal(group));
};
- if (group) {
- return (
-
- );
- }
-
- return null;
+ return (
+
+ );
};
export default ComposeButton;
diff --git a/app/soapbox/features/ui/components/floating-action-button.tsx b/app/soapbox/features/ui/components/floating-action-button.tsx
index 8800cf444..0e972ef40 100644
--- a/app/soapbox/features/ui/components/floating-action-button.tsx
+++ b/app/soapbox/features/ui/components/floating-action-button.tsx
@@ -1,20 +1,30 @@
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 { Icon } from 'soapbox/components/ui';
+import { Avatar, HStack, Icon } from 'soapbox/components/ui';
import { useAppDispatch } from 'soapbox/hooks';
+import { useGroupLookup } from 'soapbox/hooks/api/groups/useGroupLookup';
const messages = defineMessages({
publish: { id: 'compose_form.publish', defaultMessage: 'Publish' },
});
-interface IFloatingActionButton {
-}
-
/** FloatingActionButton (aka FAB), a composer button that floats in the corner on mobile. */
-const FloatingActionButton: React.FC = () => {
+const FloatingActionButton: React.FC = () => {
+ const location = useLocation();
+
+ if (location.pathname.startsWith('/group/')) {
+ return ;
+ }
+
+ return ;
+};
+
+const HomeFAB: React.FC = () => {
const intl = useIntl();
const dispatch = useAppDispatch();
@@ -39,4 +49,37 @@ const FloatingActionButton: React.FC = () => {
);
};
+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;