From 81e1e2d6add157115eb909de3b09133a3a03057d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Tue, 27 Dec 2022 21:42:17 +0100 Subject: [PATCH 01/47] =?UTF-8?q?Support=20Takah=C4=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/actions/scheduled-statuses.ts | 11 ++++++++++- app/soapbox/actions/trending-statuses.ts | 2 ++ app/soapbox/features/settings/index.tsx | 2 +- app/soapbox/normalizers/instance.ts | 12 ++++++++++++ app/soapbox/utils/features.ts | 16 ++++++++++++++++ 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/app/soapbox/actions/scheduled-statuses.ts b/app/soapbox/actions/scheduled-statuses.ts index ddc550105..33e763701 100644 --- a/app/soapbox/actions/scheduled-statuses.ts +++ b/app/soapbox/actions/scheduled-statuses.ts @@ -1,3 +1,5 @@ +import { getFeatures } from 'soapbox/utils/features'; + import api, { getLinks } from '../api'; import type { AxiosError } from 'axios'; @@ -18,10 +20,17 @@ const SCHEDULED_STATUS_CANCEL_FAIL = 'SCHEDULED_STATUS_CANCEL_FAIL'; const fetchScheduledStatuses = () => (dispatch: AppDispatch, getState: () => RootState) => { - if (getState().status_lists.get('scheduled_statuses')?.isLoading) { + const state = getState(); + + if (state.status_lists.get('scheduled_statuses')?.isLoading) { return; } + const instance = state.instance; + const features = getFeatures(instance); + + if (!features.scheduledStatuses) return; + dispatch(fetchScheduledStatusesRequest()); api(getState).get('/api/v1/scheduled_statuses').then(response => { diff --git a/app/soapbox/actions/trending-statuses.ts b/app/soapbox/actions/trending-statuses.ts index 435fcf6df..7ccab27ab 100644 --- a/app/soapbox/actions/trending-statuses.ts +++ b/app/soapbox/actions/trending-statuses.ts @@ -17,6 +17,8 @@ const fetchTrendingStatuses = () => const instance = state.instance; const features = getFeatures(instance); + if (!features.trendingStatuses && !features.trendingTruths) return; + dispatch({ type: TRENDING_STATUSES_FETCH_REQUEST }); return api(getState).get(features.trendingTruths ? '/api/v1/truth/trending/truths' : '/api/v1/trends/statuses').then(({ data: statuses }) => { dispatch(importFetchedStatuses(statuses)); diff --git a/app/soapbox/features/settings/index.tsx b/app/soapbox/features/settings/index.tsx index c0a7a3056..06b8bf8a2 100644 --- a/app/soapbox/features/settings/index.tsx +++ b/app/soapbox/features/settings/index.tsx @@ -52,7 +52,7 @@ const Settings = () => { const isMfaEnabled = mfa.getIn(['settings', 'totp']); useEffect(() => { - dispatch(fetchMfa()); + if (features.security) dispatch(fetchMfa()); }, [dispatch]); if (!account) return null; diff --git a/app/soapbox/normalizers/instance.ts b/app/soapbox/normalizers/instance.ts index e7933b080..8a13a89b8 100644 --- a/app/soapbox/normalizers/instance.ts +++ b/app/soapbox/normalizers/instance.ts @@ -101,6 +101,17 @@ const normalizeVersion = (instance: ImmutableMap) => { }); }; +/** Rename Akkoma to Pleroma+akkoma */ +const fixTakahe = (instance: ImmutableMap) => { + const version: string = instance.get('version', ''); + + if (version.startsWith('takahe/')) { + return instance.set('version', `0.0.0 (compatible; takahe ${version.slice(7)})`); + } else { + return instance; + } +}; + /** Rename Akkoma to Pleroma+akkoma */ const fixAkkoma = (instance: ImmutableMap) => { const version: string = instance.get('version', ''); @@ -131,6 +142,7 @@ export const normalizeInstance = (instance: Record) => { // Normalize version normalizeVersion(instance); + fixTakahe(instance); fixAkkoma(instance); // Merge defaults diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index deb53b0cb..cd5addcce 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -64,6 +64,12 @@ export const GLITCH = 'glitch'; */ export const AKKOMA = 'akkoma'; +/** + * Takahē, backend with support for serving multiple domains. + * @see {@link https://jointakahe.org/} + */ +export const TAKAHE = 'takahe'; + /** Parse features for the given instance */ const getInstanceFeatures = (instance: Instance) => { const v = parseVersion(instance.version); @@ -288,6 +294,7 @@ const getInstanceFeatures = (instance: Instance) => { v.software === MASTODON && gte(v.compatVersion, '2.6.0'), v.software === PLEROMA && gte(v.version, '0.9.9'), v.software === PIXELFED, + v.software === TAKAHE, ]), /** @@ -299,6 +306,14 @@ const getInstanceFeatures = (instance: Instance) => { v.software === PLEROMA && gte(v.version, '0.9.9'), ]), + editProfile: any([ + v.software === MASTODON, + v.software === MITRA, + v.software === PIXELFED, + v.software === PLEROMA, + v.software === TRUTHSOCIAL, + ]), + editStatuses: any([ v.software === MASTODON && gte(v.version, '3.5.0'), features.includes('editing'), @@ -574,6 +589,7 @@ const getInstanceFeatures = (instance: Instance) => { publicTimeline: any([ v.software === MASTODON, v.software === PLEROMA, + v.software === TAKAHE, ]), /** From 3f430ee5d58c1bef71a96a828bbcedd9bff77454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Tue, 27 Dec 2022 23:56:33 +0100 Subject: [PATCH 02/47] use capitalized name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/normalizers/instance.ts | 14 +++++++------- app/soapbox/utils/features.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/soapbox/normalizers/instance.ts b/app/soapbox/normalizers/instance.ts index 8a13a89b8..48214b091 100644 --- a/app/soapbox/normalizers/instance.ts +++ b/app/soapbox/normalizers/instance.ts @@ -102,22 +102,22 @@ const normalizeVersion = (instance: ImmutableMap) => { }; /** Rename Akkoma to Pleroma+akkoma */ -const fixTakahe = (instance: ImmutableMap) => { +const fixAkkoma = (instance: ImmutableMap) => { const version: string = instance.get('version', ''); - if (version.startsWith('takahe/')) { - return instance.set('version', `0.0.0 (compatible; takahe ${version.slice(7)})`); + if (version.includes('Akkoma')) { + return instance.set('version', '2.7.2 (compatible; Pleroma 2.4.50+akkoma)'); } else { return instance; } }; -/** Rename Akkoma to Pleroma+akkoma */ -const fixAkkoma = (instance: ImmutableMap) => { +/** Set Takahe version to a Pleroma-like string */ +const fixTakahe = (instance: ImmutableMap) => { const version: string = instance.get('version', ''); - if (version.includes('Akkoma')) { - return instance.set('version', '2.7.2 (compatible; Pleroma 2.4.50+akkoma)'); + if (version.startsWith('takahe/')) { + return instance.set('version', `0.0.0 (compatible; Takahe ${version.slice(7)})`); } else { return instance; } diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index cd5addcce..42947f340 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -68,7 +68,7 @@ export const AKKOMA = 'akkoma'; * Takahē, backend with support for serving multiple domains. * @see {@link https://jointakahe.org/} */ -export const TAKAHE = 'takahe'; +export const TAKAHE = 'Takahe'; /** Parse features for the given instance */ const getInstanceFeatures = (instance: Instance) => { From 85bc891dbb4f3f802f8ffc8abb73f801e2a23f07 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 27 Dec 2022 21:40:39 -0600 Subject: [PATCH 03/47] Use accent color for "floating action button" (mobile compose button). --- CHANGELOG.md | 1 + app/soapbox/features/ui/components/floating-action-button.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 268d5caad..685316297 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### Fixed +- Layout: use accent color for "floating action button" (mobile compose button). ## [3.0.0] - 2022-12-25 diff --git a/app/soapbox/features/ui/components/floating-action-button.tsx b/app/soapbox/features/ui/components/floating-action-button.tsx index 845867030..de00b55a7 100644 --- a/app/soapbox/features/ui/components/floating-action-button.tsx +++ b/app/soapbox/features/ui/components/floating-action-button.tsx @@ -27,7 +27,7 @@ const FloatingActionButton: React.FC = () => { onClick={handleOpenComposeModal} className={clsx( 'p-4 inline-flex items-center border font-medium rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 appearance-none transition-all', - 'bg-primary-500 hover:bg-primary-400 dark:hover:bg-primary-600 border-transparent focus:bg-primary-500 text-gray-100 focus:ring-primary-300', + 'border-transparent bg-secondary-500 hover:bg-secondary-400 focus:bg-secondary-500 text-gray-100 focus:ring-secondary-300', )} aria-label={intl.formatMessage(messages.publish)} > From 9e321ac4c4f6f644751817f39968fd81d558192f Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Wed, 28 Dec 2022 11:26:58 -0500 Subject: [PATCH 04/47] Refactor sidebar to fix position of close (X) icon --- app/soapbox/components/sidebar-menu.tsx | 343 +++++++++++++----------- app/styles/application.scss | 1 - app/styles/components/sidebar-menu.scss | 17 -- 3 files changed, 180 insertions(+), 181 deletions(-) delete mode 100644 app/styles/components/sidebar-menu.scss diff --git a/app/soapbox/components/sidebar-menu.tsx b/app/soapbox/components/sidebar-menu.tsx index 80a292ec9..34fd62260 100644 --- a/app/soapbox/components/sidebar-menu.tsx +++ b/app/soapbox/components/sidebar-menu.tsx @@ -1,3 +1,4 @@ +/* eslint-disable jsx-a11y/interactive-supports-focus */ import classNames from 'clsx'; import React from 'react'; import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; @@ -136,218 +137,234 @@ const SidebarMenu: React.FC = (): JSX.Element | null => { return (
- -
- -
-
-
- - - - - - - + /> + +
+
+ + +
+
- + + + - - {(account.locked || followRequestsCount > 0) && ( - - )} - - {features.bookmarks && ( - - )} + + - {features.lists && ( - )} - {features.events && ( - - )} + {(account.locked || followRequestsCount > 0) && ( + + )} - {settings.get('isDeveloper') && ( - - )} + {features.bookmarks && ( + + )} - {features.publicTimeline && <> - + {features.lists && ( + + )} - : } - onClick={onClose} - /> + {features.events && ( + + )} - {features.federating && ( + {settings.get('isDeveloper') && ( } + to='/developers' + icon={require('@tabler/icons/code.svg')} + text={intl.formatMessage(messages.developers)} onClick={onClose} /> )} - } - + {features.publicTimeline && <> + - + : } + onClick={onClose} + /> - + {features.federating && ( + } + onClick={onClose} + /> + )} + } - + - {features.federating && ( - )} - {features.filters && ( - )} - {account.admin && ( - )} - {features.import && ( - - )} - - + {features.federating && ( + + )} - + {features.filters && ( + + )} - + {account.admin && ( + + )} - - - - {switcher && ( -
- {otherAccounts.map(account => renderAccount(account))} - - - - {intl.formatMessage(messages.addAccount)} - -
+ {features.import && ( + )} + + + + + + + + + + + {switcher && ( +
+ {otherAccounts.map(account => renderAccount(account))} + + + + {intl.formatMessage(messages.addAccount)} + +
+ )} +
-
+
+ + {/* Dummy element to keep Close Icon visible */} +
); diff --git a/app/styles/application.scss b/app/styles/application.scss index 710d918a1..dfcaae3b7 100644 --- a/app/styles/application.scss +++ b/app/styles/application.scss @@ -34,7 +34,6 @@ @import 'components/modal'; @import 'components/account-header'; @import 'components/compose-form'; -@import 'components/sidebar-menu'; @import 'components/emoji-reacts'; @import 'components/status'; @import 'components/reply-mentions'; diff --git a/app/styles/components/sidebar-menu.scss b/app/styles/components/sidebar-menu.scss deleted file mode 100644 index 10c960fc4..000000000 --- a/app/styles/components/sidebar-menu.scss +++ /dev/null @@ -1,17 +0,0 @@ -.sidebar-menu { - @apply flex inset-0 fixed flex-col w-80 bg-white dark:bg-primary-900 transition-all ease-linear -translate-x-80 rtl:translate-x-80 z-1000; - - @media (max-width: 400px) { - @apply w-[90vw] -translate-x-[90vw] rtl:translate-x-[90vw]; - } - - hr { - @apply border-gray-200 dark:border-gray-700; - } -} - -.sidebar-menu__root--visible { - .sidebar-menu { - transform: translateX(0); - } -} From 515c67d011aaf449a47b8b0ad5dbebe76f548c2a Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Wed, 28 Dec 2022 11:48:16 -0500 Subject: [PATCH 05/47] Add 'truncate' class to Select --- app/soapbox/components/ui/select/select.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/soapbox/components/ui/select/select.tsx b/app/soapbox/components/ui/select/select.tsx index 8c2369ce5..e405fa240 100644 --- a/app/soapbox/components/ui/select/select.tsx +++ b/app/soapbox/components/ui/select/select.tsx @@ -11,7 +11,7 @@ const Select = React.forwardRef((props, ref) => { return (