From a06ad248d68c9bb46684abf45cd3d2aa84556fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Mon, 26 Aug 2024 21:07:23 +0200 Subject: [PATCH] Move scheduled statuses to menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- src/components/sidebar-menu.tsx | 11 ++++++++ src/components/sidebar-navigation.tsx | 11 ++++++++ .../compose/components/compose-form.tsx | 25 ++----------------- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/components/sidebar-menu.tsx b/src/components/sidebar-menu.tsx index fecc64477..bf7fe784c 100644 --- a/src/components/sidebar-menu.tsx +++ b/src/components/sidebar-menu.tsx @@ -29,6 +29,7 @@ const messages = defineMessages({ events: { id: 'column.events', defaultMessage: 'Events' }, developers: { id: 'navigation.developers', defaultMessage: 'Developers' }, dashboard: { id: 'navigation.dashboard', defaultMessage: 'Dashboard' }, + scheduledStatuses: { id: 'column.scheduled_statuses', defaultMessage: 'Scheduled posts' }, 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 sidebarOpen = useAppSelector((state) => state.sidebar.sidebarOpen); const settings = useAppSelector((state) => getSettings(state)); const followRequestsCount = useAppSelector((state) => state.user_lists.follow_requests.items.count()); + const scheduledStatusCount = useAppSelector((state) => state.scheduled_statuses.size); 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); @@ -264,6 +266,15 @@ const SidebarMenu: React.FC = (): JSX.Element | null => { /> )} + {scheduledStatusCount > 0 && ( + + )} + {draftCount > 0 && ( { const notificationCount = useAppSelector((state) => state.notifications.unread); const followRequestsCount = useAppSelector((state) => state.user_lists.follow_requests.items.count()); const dashboardCount = useAppSelector((state) => state.admin.openReports.count() + state.admin.awaitingApproval.count()); + const scheduledStatusCount = useAppSelector((state) => state.scheduled_statuses.size); const draftCount = useAppSelector((state) => state.draft_statuses.size); const restrictUnauth = instance.pleroma.metadata.restrict_unauthenticated; @@ -101,6 +103,15 @@ const SidebarNavigation = () => { }); } + if (scheduledStatusCount > 0) { + menu.push({ + to: '/scheduled_statuses', + icon: require('@tabler/icons/outline/calendar-stats.svg'), + text: intl.formatMessage(messages.scheduledStatuses), + count: scheduledStatusCount, + }); + } + if (draftCount > 0) { menu.push({ to: '/draft_statuses', diff --git a/src/features/compose/components/compose-form.tsx b/src/features/compose/components/compose-form.tsx index 101cdce8f..2d80c0576 100644 --- a/src/features/compose/components/compose-form.tsx +++ b/src/features/compose/components/compose-form.tsx @@ -1,8 +1,8 @@ import clsx from 'clsx'; import { CLEAR_EDITOR_COMMAND, TextNode, type LexicalEditor } from 'lexical'; import React, { Suspense, useCallback, useEffect, useRef, useState } from 'react'; -import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; -import { Link, useHistory } from 'react-router-dom'; +import { defineMessages, useIntl } from 'react-intl'; +import { useHistory } from 'react-router-dom'; import { length } from 'stringz'; import { @@ -38,7 +38,6 @@ import SpoilerInput from './spoiler-input'; import TextCharacterCounter from './text-character-counter'; import UploadForm from './upload-form'; import VisualCharacterCounter from './visual-character-counter'; -import Warning from './warning'; import type { AutoSuggestion } from 'soapbox/components/autosuggest-input'; import type { Emoji } from 'soapbox/features/emoji'; @@ -74,7 +73,6 @@ const ComposeForm = ({ id, shouldCondense, autoFocus, clickab const compose = useCompose(id); const showSearch = useAppSelector((state) => state.search.submitted && !state.search.hidden); const maxTootChars = configuration.statuses.max_characters; - const scheduledStatusCount = useAppSelector((state) => state.scheduled_statuses.size); const features = useFeatures(); const { @@ -221,25 +219,6 @@ const ComposeForm = ({ id, shouldCondense, autoFocus, clickab return ( - {scheduledStatusCount > 0 && !event && !group && ( - - - - ) }} - />) - } - /> - )} - {!shouldCondense && !event && !group && groupId && }