Merge remote-tracking branch 'origin/main' into lexical

This commit is contained in:
Alex Gleason
2023-09-21 14:38:57 -05:00
15 changed files with 168 additions and 467 deletions

View File

@ -21,16 +21,18 @@ import withHoc from 'soapbox/components/hoc/with-hoc';
import SidebarNavigation from 'soapbox/components/sidebar-navigation';
import ThumbNavigation from 'soapbox/components/thumb-navigation';
import { Layout } from 'soapbox/components/ui';
import { useAppDispatch, useAppSelector, useOwnAccount, useSoapboxConfig, useFeatures, useDraggedFiles, useInstance } from 'soapbox/hooks';
import { useAppDispatch, useAppSelector, useOwnAccount, useSoapboxConfig, useFeatures, useDraggedFiles, useInstance, useLoggedIn } from 'soapbox/hooks';
import AdminPage from 'soapbox/pages/admin-page';
import ChatsPage from 'soapbox/pages/chats-page';
import DefaultPage from 'soapbox/pages/default-page';
import EmptyPage from 'soapbox/pages/empty-page';
import EventPage from 'soapbox/pages/event-page';
import EventsPage from 'soapbox/pages/events-page';
import GroupPage from 'soapbox/pages/group-page';
import GroupsPage from 'soapbox/pages/groups-page';
import GroupsPendingPage from 'soapbox/pages/groups-pending-page';
import HomePage from 'soapbox/pages/home-page';
import LandingPage from 'soapbox/pages/landing-page';
import ManageGroupsPage from 'soapbox/pages/manage-groups-page';
import ProfilePage from 'soapbox/pages/profile-page';
import RemoteInstancePage from 'soapbox/pages/remote-instance-page';
@ -139,6 +141,7 @@ import {
PasswordResetConfirm,
RegisterInvite,
ExternalLogin,
LandingTimeline,
} from './util/async-components';
import GlobalHotkeys from './util/global-hotkeys';
import { WrappedRoute } from './util/react-router-helpers';
@ -157,8 +160,6 @@ const EditGroupSlug = withHoc(EditGroup as any, GroupLookupHoc);
const GroupBlockedMembersSlug = withHoc(GroupBlockedMembers as any, GroupLookupHoc);
const GroupMembershipRequestsSlug = withHoc(GroupMembershipRequests as any, GroupLookupHoc);
const EmptyPage = HomePage;
interface ISwitchingColumnsArea {
children: React.ReactNode
}
@ -167,6 +168,7 @@ const SwitchingColumnsArea: React.FC<ISwitchingColumnsArea> = ({ children }) =>
const instance = useInstance();
const features = useFeatures();
const { search } = useLocation();
const { isLoggedIn } = useLoggedIn();
const { authenticatedProfile, cryptoAddresses } = useSoapboxConfig();
const hasCrypto = cryptoAddresses.size > 0;
@ -181,7 +183,11 @@ const SwitchingColumnsArea: React.FC<ISwitchingColumnsArea> = ({ children }) =>
<WrappedRoute path='/email-confirmation' page={EmptyPage} component={EmailConfirmation} publicRoute exact />
<WrappedRoute path='/logout' page={EmptyPage} component={LogoutPage} publicRoute exact />
<WrappedRoute path='/' exact page={HomePage} component={HomeTimeline} content={children} />
{isLoggedIn ? (
<WrappedRoute path='/' exact page={HomePage} component={HomeTimeline} content={children} />
) : (
<WrappedRoute path='/' exact page={LandingPage} component={LandingTimeline} content={children} publicRoute />
)}
{/*
NOTE: we cannot nest routes in a fragment
@ -254,7 +260,7 @@ const SwitchingColumnsArea: React.FC<ISwitchingColumnsArea> = ({ children }) =>
<WrappedRoute path='/notifications' page={DefaultPage} component={Notifications} content={children} />
<WrappedRoute path='/search' page={SearchPage} component={Search} content={children} />
<WrappedRoute path='/search' page={SearchPage} component={Search} content={children} publicRoute />
{features.suggestions && <WrappedRoute path='/suggestions' publicRoute page={DefaultPage} component={FollowRecommendations} content={children} />}
{features.profileDirectory && <WrappedRoute path='/directory' publicRoute page={DefaultPage} component={Directory} content={children} />}
{features.events && <WrappedRoute path='/events' page={EventsPage} component={Events} content={children} />}
@ -359,7 +365,7 @@ const SwitchingColumnsArea: React.FC<ISwitchingColumnsArea> = ({ children }) =>
<WrappedRoute path='/about/:slug?' page={DefaultPage} component={AboutPage} publicRoute exact />
{(features.accountCreation && instance.registrations) && (
<WrappedRoute path='/signup' page={DefaultPage} component={RegistrationPage} publicRoute exact />
<WrappedRoute path='/signup' page={EmptyPage} component={RegistrationPage} publicRoute exact />
)}
<WrappedRoute path='/login/external' page={DefaultPage} component={ExternalLogin} publicRoute exact />

View File

@ -10,6 +10,10 @@ export function Notifications() {
return import('../../notifications');
}
export function LandingTimeline() {
return import('../../landing-timeline');
}
export function HomeTimeline() {
return import('../../home-timeline');
}