diff --git a/app/soapbox/components/sidebar-navigation.tsx b/app/soapbox/components/sidebar-navigation.tsx index 9809d99c1..3ce3b9e28 100644 --- a/app/soapbox/components/sidebar-navigation.tsx +++ b/app/soapbox/components/sidebar-navigation.tsx @@ -73,7 +73,7 @@ const SidebarNavigation = () => { if (account.staff) { menu.push({ - to: '/admin', + to: '/soapbox/admin', icon: require('@tabler/icons/icons/dashboard.svg'), text: , count: dashboardCount, @@ -106,6 +106,32 @@ const SidebarNavigation = () => { const menu = makeMenu(); + /** Conditionally render the supported messages link */ + const renderMessagesLink = (): React.ReactNode => { + if (features.chats) { + return ( + } + /> + ); + } + + if (features.directTimeline || features.conversations) { + return ( + } + /> + ); + } + + return null; + }; + return (
@@ -138,22 +164,7 @@ const SidebarNavigation = () => { )} - {account && ( - features.chats ? ( - } - /> - ) : ( - } - /> - ) - )} + {account && renderMessagesLink()} {menu.length > 0 && ( diff --git a/app/soapbox/components/thumb_navigation.tsx b/app/soapbox/components/thumb_navigation.tsx index d9953fb05..c1ac80fae 100644 --- a/app/soapbox/components/thumb_navigation.tsx +++ b/app/soapbox/components/thumb_navigation.tsx @@ -12,6 +12,34 @@ const ThumbNavigation: React.FC = (): JSX.Element => { const dashboardCount = useAppSelector((state) => state.admin.openReports.count() + state.admin.awaitingApproval.count()); const features = getFeatures(useAppSelector((state) => state.instance)); + /** Conditionally render the supported messages link */ + const renderMessagesLink = (): React.ReactNode => { + if (features.chats) { + return ( + } + to='/chats' + exact + count={chatsCount} + /> + ); + } + + if (features.directTimeline || features.conversations) { + return ( + } + to='/messages' + paths={['/messages', '/conversations']} + /> + ); + } + + return null; + }; + return (
{ /> )} - {account && ( - features.chats ? ( - } - to='/chats' - exact - count={chatsCount} - /> - ) : ( - } - to='/messages' - paths={['/messages', '/conversations']} - /> - ) - )} + {account && renderMessagesLink()} {(account && account.staff) && ( } - to='/admin' + to='/soapbox/admin' count={dashboardCount} /> )} diff --git a/app/soapbox/containers/soapbox.tsx b/app/soapbox/containers/soapbox.tsx index 44b661cf9..0b27ee33e 100644 --- a/app/soapbox/containers/soapbox.tsx +++ b/app/soapbox/containers/soapbox.tsx @@ -20,7 +20,7 @@ import PublicLayout from 'soapbox/features/public_layout'; import NotificationsContainer from 'soapbox/features/ui/containers/notifications_container'; import WaitlistPage from 'soapbox/features/verification/waitlist_page'; import { createGlobals } from 'soapbox/globals'; -import { useAppSelector, useAppDispatch, useOwnAccount, useSoapboxConfig, useSettings } from 'soapbox/hooks'; +import { useAppSelector, useAppDispatch, useOwnAccount, useFeatures, useSoapboxConfig, useSettings } from 'soapbox/hooks'; import MESSAGES from 'soapbox/locales/messages'; import { getFeatures } from 'soapbox/utils/features'; import { generateThemeCss } from 'soapbox/utils/theme'; @@ -68,9 +68,11 @@ const SoapboxMount = () => { const dispatch = useAppDispatch(); const me = useAppSelector(state => state.me); + const instance = useAppSelector(state => state.instance); const account = useOwnAccount(); const settings = useSettings(); const soapboxConfig = useSoapboxConfig(); + const features = useFeatures(); const locale = validLocale(settings.get('locale')) ? settings.get('locale') : 'en'; @@ -157,7 +159,7 @@ const SoapboxMount = () => { <> - + {waitlisted && } />} @@ -170,7 +172,10 @@ const SoapboxMount = () => { - + {(features.accountCreation && instance.registrations) && ( + + )} + diff --git a/app/soapbox/features/admin/components/admin-tabs.tsx b/app/soapbox/features/admin/components/admin-tabs.tsx index 4602cd0aa..debba46a0 100644 --- a/app/soapbox/features/admin/components/admin-tabs.tsx +++ b/app/soapbox/features/admin/components/admin-tabs.tsx @@ -19,18 +19,18 @@ const AdminTabs: React.FC = () => { const reportsCount = useAppSelector(state => state.admin.openReports.count()); const tabs = [{ - name: '/admin', + name: '/soapbox/admin', text: intl.formatMessage(messages.dashboard), - to: '/admin', + to: '/soapbox/admin', }, { - name: '/admin/reports', + name: '/soapbox/admin/reports', text: intl.formatMessage(messages.reports), - to: '/admin/reports', + to: '/soapbox/admin/reports', count: reportsCount, }, { - name: '/admin/approval', + name: '/soapbox/admin/approval', text: intl.formatMessage(messages.waitlist), - to: '/admin/approval', + to: '/soapbox/admin/approval', count: approvalCount, }]; diff --git a/app/soapbox/features/admin/components/latest_accounts_panel.tsx b/app/soapbox/features/admin/components/latest_accounts_panel.tsx index 26b383713..62636c366 100644 --- a/app/soapbox/features/admin/components/latest_accounts_panel.tsx +++ b/app/soapbox/features/admin/components/latest_accounts_panel.tsx @@ -46,7 +46,7 @@ const LatestAccountsPanel: React.FC = ({ limit = 5 }) => { } const handleAction = () => { - history.push('/admin/users'); + history.push('/soapbox/admin/users'); }; return ( diff --git a/app/soapbox/features/admin/index.tsx b/app/soapbox/features/admin/index.tsx index dae7fc2e7..84f72eda8 100644 --- a/app/soapbox/features/admin/index.tsx +++ b/app/soapbox/features/admin/index.tsx @@ -26,9 +26,9 @@ const Admin: React.FC = () => { - - - + + + ); diff --git a/app/soapbox/features/admin/tabs/dashboard.tsx b/app/soapbox/features/admin/tabs/dashboard.tsx index 248885b21..86810d3c5 100644 --- a/app/soapbox/features/admin/tabs/dashboard.tsx +++ b/app/soapbox/features/admin/tabs/dashboard.tsx @@ -77,7 +77,7 @@ const Dashboard: React.FC = () => {
)} {isNumber(userCount) && ( - + diff --git a/app/soapbox/features/auth_layout/index.tsx b/app/soapbox/features/auth_layout/index.tsx index 6f7f51b95..283791ce9 100644 --- a/app/soapbox/features/auth_layout/index.tsx +++ b/app/soapbox/features/auth_layout/index.tsx @@ -10,7 +10,7 @@ import { Card, CardBody } from '../../components/ui'; import LoginPage from '../auth_login/components/login_page'; import PasswordReset from '../auth_login/components/password_reset'; import PasswordResetConfirm from '../auth_login/components/password_reset_confirm'; -// import EmailConfirmation from '../email_confirmation'; +import RegistrationForm from '../auth_login/components/registration_form'; import Verification from '../verification'; import EmailPassthru from '../verification/email_passthru'; @@ -42,12 +42,12 @@ const AuthLayout = () => { - - + + + - {/* */} diff --git a/app/soapbox/features/conversations/index.js b/app/soapbox/features/conversations/index.js index c1ca68320..6d4b2ec22 100644 --- a/app/soapbox/features/conversations/index.js +++ b/app/soapbox/features/conversations/index.js @@ -1,18 +1,20 @@ import PropTypes from 'prop-types'; import React from 'react'; -import { defineMessages, injectIntl } from 'react-intl'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import { directComposeById } from 'soapbox/actions/compose'; +import AccountSearch from 'soapbox/components/account_search'; import { mountConversations, unmountConversations, expandConversations } from '../../actions/conversations'; import { connectDirectStream } from '../../actions/streaming'; -import { Card, CardBody, Column, Stack, Text } from '../../components/ui'; +import { Column } from '../../components/ui'; + +import ConversationsListContainer from './containers/conversations_list_container'; const messages = defineMessages({ title: { id: 'column.direct', defaultMessage: 'Direct messages' }, searchPlaceholder: { id: 'direct.search_placeholder', defaultMessage: 'Send a message to…' }, - body: { id: 'direct.body', defaultMessage: 'A new direct messaging experience will be available soon. Please stay tuned.' }, }); export default @connect() @@ -54,35 +56,20 @@ class ConversationsTimeline extends React.PureComponent { const { intl } = this.props; return ( - - - - - {intl.formatMessage(messages.title)} - {intl.formatMessage(messages.body)} - - - + + + + } + /> ); - - // return ( - // - // - - // - - // } - // /> - // - // ); } } diff --git a/app/soapbox/features/landing_page/index.tsx b/app/soapbox/features/landing_page/index.tsx index 307cda35a..a33b9e871 100644 --- a/app/soapbox/features/landing_page/index.tsx +++ b/app/soapbox/features/landing_page/index.tsx @@ -49,7 +49,7 @@ const LandingPage = () => { Social Media Without Discrimination - + ); }; diff --git a/app/soapbox/features/public_layout/components/header.tsx b/app/soapbox/features/public_layout/components/header.tsx index c10eaea4e..d01f37ebd 100644 --- a/app/soapbox/features/public_layout/components/header.tsx +++ b/app/soapbox/features/public_layout/components/header.tsx @@ -96,7 +96,7 @@ const Header = () => { {(isOpen || features.pepe && pepeOpen) && ( {isOpen && ( - )} diff --git a/app/soapbox/features/ui/index.tsx b/app/soapbox/features/ui/index.tsx index 99fe59b12..91eda245f 100644 --- a/app/soapbox/features/ui/index.tsx +++ b/app/soapbox/features/ui/index.tsx @@ -187,8 +187,12 @@ const SwitchingColumnsArea: React.FC = ({ children }) => { {features.federating && } {features.federating && } - - + {features.conversations && } + {features.directTimeline ? ( + + ) : ( + + )} {/* Gab groups */} {/* @@ -227,7 +231,7 @@ const SwitchingColumnsArea: React.FC = ({ children }) => { {/* Mastodon rendered pages */} - + @@ -286,7 +290,7 @@ const SwitchingColumnsArea: React.FC = ({ children }) => { {features.scheduledStatuses && } - + @@ -302,11 +306,11 @@ const SwitchingColumnsArea: React.FC = ({ children }) => { {/* */} - - - - - + + + + + diff --git a/app/soapbox/features/verification/__tests__/index.test.tsx b/app/soapbox/features/verification/__tests__/index.test.tsx index 27a88957e..2eda52852 100644 --- a/app/soapbox/features/verification/__tests__/index.test.tsx +++ b/app/soapbox/features/verification/__tests__/index.test.tsx @@ -9,7 +9,7 @@ import Verification from '../index'; const TestableComponent = () => ( - + Homepage ); @@ -18,7 +18,7 @@ const renderComponent = (store) => render( , {}, store, - { initialEntries: ['/auth/verify'] }, + { initialEntries: ['/verify'] }, ); describe('', () => { diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index d4b4d1e32..4591eb880 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -71,6 +71,15 @@ const getInstanceFeatures = (instance: Instance) => { */ accountByUsername: v.software === PLEROMA, + /** + * Ability to create accounts. + * @see POST /api/v1/accounts + */ + accountCreation: any([ + v.software === MASTODON, + v.software === PLEROMA, + ]), + /** * Ability to pin other accounts on one's profile. * @see POST /api/v1/accounts/:id/pin