|
|
@ -5,7 +5,7 @@ import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
|
|
import { HotKeys } from 'react-hotkeys';
|
|
|
|
import { HotKeys } from 'react-hotkeys';
|
|
|
|
import { defineMessages, useIntl } from 'react-intl';
|
|
|
|
import { defineMessages, useIntl } from 'react-intl';
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
import { Switch, useHistory, useLocation, matchPath, Redirect } from 'react-router-dom';
|
|
|
|
import { Switch, useHistory, useLocation, Redirect } from 'react-router-dom';
|
|
|
|
|
|
|
|
|
|
|
|
import { fetchFollowRequests } from 'soapbox/actions/accounts';
|
|
|
|
import { fetchFollowRequests } from 'soapbox/actions/accounts';
|
|
|
|
import { fetchReports, fetchUsers, fetchConfig } from 'soapbox/actions/admin';
|
|
|
|
import { fetchReports, fetchUsers, fetchConfig } from 'soapbox/actions/admin';
|
|
|
@ -34,7 +34,6 @@ import ProfilePage from 'soapbox/pages/profile_page';
|
|
|
|
import RemoteInstancePage from 'soapbox/pages/remote_instance_page';
|
|
|
|
import RemoteInstancePage from 'soapbox/pages/remote_instance_page';
|
|
|
|
import StatusPage from 'soapbox/pages/status_page';
|
|
|
|
import StatusPage from 'soapbox/pages/status_page';
|
|
|
|
import { getAccessToken, getVapidKey } from 'soapbox/utils/auth';
|
|
|
|
import { getAccessToken, getVapidKey } from 'soapbox/utils/auth';
|
|
|
|
import { cacheCurrentUrl } from 'soapbox/utils/redirect';
|
|
|
|
|
|
|
|
import { isStandalone } from 'soapbox/utils/state';
|
|
|
|
import { isStandalone } from 'soapbox/utils/state';
|
|
|
|
// import GroupSidebarPanel from '../groups/sidebar_panel';
|
|
|
|
// import GroupSidebarPanel from '../groups/sidebar_panel';
|
|
|
|
|
|
|
|
|
|
|
@ -329,7 +328,6 @@ const UI: React.FC = ({ children }) => {
|
|
|
|
const intl = useIntl();
|
|
|
|
const intl = useIntl();
|
|
|
|
const history = useHistory();
|
|
|
|
const history = useHistory();
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const { guestExperience } = useSoapboxConfig();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [draggingOver, setDraggingOver] = useState<boolean>(false);
|
|
|
|
const [draggingOver, setDraggingOver] = useState<boolean>(false);
|
|
|
|
const [mobile, setMobile] = useState<boolean>(isMobile(window.innerWidth));
|
|
|
|
const [mobile, setMobile] = useState<boolean>(isMobile(window.innerWidth));
|
|
|
@ -608,23 +606,6 @@ const UI: React.FC = ({ children }) => {
|
|
|
|
// Wait for login to succeed or fail
|
|
|
|
// Wait for login to succeed or fail
|
|
|
|
if (me === null) return null;
|
|
|
|
if (me === null) return null;
|
|
|
|
|
|
|
|
|
|
|
|
const isProfileOrStatusPage = !!matchPath(
|
|
|
|
|
|
|
|
history.location.pathname,
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
'/@:username',
|
|
|
|
|
|
|
|
'/@:username/posts/:statusId',
|
|
|
|
|
|
|
|
'/users/:username',
|
|
|
|
|
|
|
|
'/users/:username/statuses/:statusId',
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Require login if Guest Experience is disabled and we're not trying
|
|
|
|
|
|
|
|
// to render a Profile or Status.
|
|
|
|
|
|
|
|
if (!me && (!guestExperience && !isProfileOrStatusPage)) {
|
|
|
|
|
|
|
|
cacheCurrentUrl(history.location);
|
|
|
|
|
|
|
|
return <Redirect to='/login' />;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type HotkeyHandlers = { [key: string]: (keyEvent?: KeyboardEvent) => void };
|
|
|
|
type HotkeyHandlers = { [key: string]: (keyEvent?: KeyboardEvent) => void };
|
|
|
|
|
|
|
|
|
|
|
|
const handlers: HotkeyHandlers = {
|
|
|
|
const handlers: HotkeyHandlers = {
|
|
|
|