From ff9058e2221f792f22257a5582df6a163831ab4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Wed, 14 Aug 2024 16:52:11 +0200 Subject: [PATCH] Replace FAB with plus button in thumb nav, I need to remove one element to move the plus button to the center MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- src/actions/admin.ts | 1 - src/actions/compose.ts | 2 +- src/actions/groups.ts | 1 - src/actions/tags.ts | 1 - src/components/sidebar-menu.tsx | 12 +++++++ src/components/thumb-navigation.tsx | 36 +++++++++++++------ src/features/admin/announcements.tsx | 1 - src/features/bookmark-folders/index.tsx | 1 - .../compose/components/language-dropdown.tsx | 1 - .../compose/components/privacy-dropdown.tsx | 1 - src/features/mutes/index.tsx | 1 - .../manage-group-modal/steps/details-step.tsx | 1 - .../ui/components/panels/sign-up-panel.tsx | 1 - src/features/ui/index.tsx | 12 ------- src/pages/search-page.tsx | 1 - src/schemas/instance.ts | 1 - src/selectors/index.ts | 1 - 17 files changed, 39 insertions(+), 36 deletions(-) diff --git a/src/actions/admin.ts b/src/actions/admin.ts index 8017daa889..cddae896f5 100644 --- a/src/actions/admin.ts +++ b/src/actions/admin.ts @@ -546,7 +546,6 @@ const expandUserIndex = () => }); }; - export { ADMIN_CONFIG_FETCH_REQUEST, ADMIN_CONFIG_FETCH_SUCCESS, diff --git a/src/actions/compose.ts b/src/actions/compose.ts index 5808dc3455..15794b5fb5 100644 --- a/src/actions/compose.ts +++ b/src/actions/compose.ts @@ -221,7 +221,7 @@ const cancelQuoteCompose = (composeId: string) => ({ id: composeId, }); -const groupComposeModal = (group: Group) => +const groupComposeModal = (group: Pick) => (dispatch: AppDispatch, getState: () => RootState) => { const composeId = `group:${group.id}`; diff --git a/src/actions/groups.ts b/src/actions/groups.ts index 9dc582b6b6..f13fe1860b 100644 --- a/src/actions/groups.ts +++ b/src/actions/groups.ts @@ -85,7 +85,6 @@ const groupUnblockFail = (groupId: string, accountId: string, error: unknown) => error, }); - export { GROUP_BLOCKS_FETCH_REQUEST, GROUP_BLOCKS_FETCH_SUCCESS, diff --git a/src/actions/tags.ts b/src/actions/tags.ts index 4cc4a1c964..196f939e67 100644 --- a/src/actions/tags.ts +++ b/src/actions/tags.ts @@ -160,7 +160,6 @@ const expandFollowedHashtagsFail = (error: unknown) => ({ error, }); - export { HASHTAG_FETCH_REQUEST, HASHTAG_FETCH_SUCCESS, diff --git a/src/components/sidebar-menu.tsx b/src/components/sidebar-menu.tsx index 4ad63d01df..aecde264f3 100644 --- a/src/components/sidebar-menu.tsx +++ b/src/components/sidebar-menu.tsx @@ -28,6 +28,7 @@ const messages = defineMessages({ groups: { id: 'column.groups', defaultMessage: 'Groups' }, events: { id: 'column.events', defaultMessage: 'Events' }, developers: { id: 'navigation.developers', defaultMessage: 'Developers' }, + dashboard: { id: 'navigation.dashboard', defaultMessage: 'Dashboard' }, drafts: { id: 'navigation.drafts', defaultMessage: 'Drafts' }, addAccount: { id: 'profile_dropdown.add_account', defaultMessage: 'Add an existing account' }, followRequests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' }, @@ -83,6 +84,7 @@ const SidebarMenu: React.FC = (): JSX.Element | null => { 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); @@ -338,6 +340,16 @@ const SidebarMenu: React.FC = (): JSX.Element | null => { /> )} + {account.staff && ( + + )} + { 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 => { @@ -52,7 +68,7 @@ const ThumbNavigation: React.FC = (): JSX.Element => { return (
- )}
); diff --git a/src/features/admin/announcements.tsx b/src/features/admin/announcements.tsx index 92267ee071..aa1b71f7a3 100644 --- a/src/features/admin/announcements.tsx +++ b/src/features/admin/announcements.tsx @@ -91,7 +91,6 @@ const Announcements: React.FC = () => { const { data: announcements, isLoading } = useAnnouncements(); - const handleCreateAnnouncement = () => { dispatch(openModal('EDIT_ANNOUNCEMENT')); }; diff --git a/src/features/bookmark-folders/index.tsx b/src/features/bookmark-folders/index.tsx index 41defaa783..8dbf537e8e 100644 --- a/src/features/bookmark-folders/index.tsx +++ b/src/features/bookmark-folders/index.tsx @@ -9,7 +9,6 @@ import { useFeatures } from 'soapbox/hooks'; import NewFolderForm from './components/new-folder-form'; - const messages = defineMessages({ heading: { id: 'column.bookmarks', defaultMessage: 'Bookmarks' }, }); diff --git a/src/features/compose/components/language-dropdown.tsx b/src/features/compose/components/language-dropdown.tsx index f5f0e34dff..2e650fa92d 100644 --- a/src/features/compose/components/language-dropdown.tsx +++ b/src/features/compose/components/language-dropdown.tsx @@ -51,7 +51,6 @@ const LanguageDropdown: React.FC = ({ composeId }) => { const [isOpen, setIsOpen] = useState(false); const [searchValue, setSearchValue] = useState(''); - const { x, y, strategy, refs, middlewareData, placement } = useFloating({ placement: 'top', middleware: [ diff --git a/src/features/compose/components/privacy-dropdown.tsx b/src/features/compose/components/privacy-dropdown.tsx index 19a0e3637c..a194aac211 100644 --- a/src/features/compose/components/privacy-dropdown.tsx +++ b/src/features/compose/components/privacy-dropdown.tsx @@ -135,7 +135,6 @@ const PrivacyDropdownMenu: React.FC = ({ }; }, []); - return ( {({ opacity, scaleX, scaleY }) => ( diff --git a/src/features/mutes/index.tsx b/src/features/mutes/index.tsx index 4b5fb63fa8..0a6e29e367 100644 --- a/src/features/mutes/index.tsx +++ b/src/features/mutes/index.tsx @@ -10,7 +10,6 @@ const messages = defineMessages({ heading: { id: 'column.mutes', defaultMessage: 'Mutes' }, }); - const Mutes: React.FC = () => { const intl = useIntl(); diff --git a/src/features/ui/components/modals/manage-group-modal/steps/details-step.tsx b/src/features/ui/components/modals/manage-group-modal/steps/details-step.tsx index 2f5c1376e3..99e4740cc7 100644 --- a/src/features/ui/components/modals/manage-group-modal/steps/details-step.tsx +++ b/src/features/ui/components/modals/manage-group-modal/steps/details-step.tsx @@ -54,7 +54,6 @@ const DetailsStep: React.FC = ({ params, onChange }) => { const handleImageClear = (property: keyof CreateGroupParams) => () => onChange({ [property]: undefined }); - return (
diff --git a/src/features/ui/components/panels/sign-up-panel.tsx b/src/features/ui/components/panels/sign-up-panel.tsx index 8fac82c955..c7bb536cdb 100644 --- a/src/features/ui/components/panels/sign-up-panel.tsx +++ b/src/features/ui/components/panels/sign-up-panel.tsx @@ -14,7 +14,6 @@ import { isStandalone } from 'soapbox/utils/state'; import type { PlfeResponse } from 'soapbox/api'; - const SignUpPanel = () => { const dispatch = useAppDispatch(); const instance = useInstance(); diff --git a/src/features/ui/index.tsx b/src/features/ui/index.tsx index 7cbd68495d..8b09cd6ec9 100644 --- a/src/features/ui/index.tsx +++ b/src/features/ui/index.tsx @@ -39,7 +39,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, @@ -450,11 +449,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; @@ -484,12 +478,6 @@ const UI: React.FC = ({ children }) => { - {(me && !shouldHideFAB()) && ( -
- -
- )} - diff --git a/src/pages/search-page.tsx b/src/pages/search-page.tsx index 3b19e57617..362f3656c1 100644 --- a/src/pages/search-page.tsx +++ b/src/pages/search-page.tsx @@ -42,7 +42,6 @@ const SearchPage: React.FC = ({ children }) => { )} - diff --git a/src/schemas/instance.ts b/src/schemas/instance.ts index a64b6c103c..2800d80f95 100644 --- a/src/schemas/instance.ts +++ b/src/schemas/instance.ts @@ -80,7 +80,6 @@ const contactSchema = coerceObject({ email: z.string().email().catch(''), }); - const pleromaSchema = coerceObject({ metadata: coerceObject({ account_activation_required: z.boolean().catch(false), diff --git a/src/selectors/index.ts b/src/selectors/index.ts index a64df87731..50c6a213dd 100644 --- a/src/selectors/index.ts +++ b/src/selectors/index.ts @@ -291,7 +291,6 @@ const getRemoteInstanceFederation = (state: RootState, host: string): HostFedera ) as HostFederation; }; - const makeGetHosts = () => createSelector([getSimplePolicy], (simplePolicy) => { const { accept, reject_deletes, report_removal, ...rest } = simplePolicy;