Split into its own file
This commit is contained in:
parent
b63269e42a
commit
5200e46639
2 changed files with 29 additions and 26 deletions
27
src/app.jsx
27
src/app.jsx
|
@ -19,7 +19,6 @@ import { useSnapshot } from 'valtio';
|
||||||
import AccountSheet from './components/account-sheet';
|
import AccountSheet from './components/account-sheet';
|
||||||
import Compose from './components/compose';
|
import Compose from './components/compose';
|
||||||
import Drafts from './components/drafts';
|
import Drafts from './components/drafts';
|
||||||
import Link from './components/link';
|
|
||||||
import Loader from './components/loader';
|
import Loader from './components/loader';
|
||||||
import MediaModal from './components/media-modal';
|
import MediaModal from './components/media-modal';
|
||||||
import Modal from './components/modal';
|
import Modal from './components/modal';
|
||||||
|
@ -34,6 +33,7 @@ import FollowedHashtags from './pages/followed-hashtags';
|
||||||
import Following from './pages/following';
|
import Following from './pages/following';
|
||||||
import Hashtag from './pages/hashtag';
|
import Hashtag from './pages/hashtag';
|
||||||
import Home from './pages/home';
|
import Home from './pages/home';
|
||||||
|
import HttpRoute from './pages/HttpRoute';
|
||||||
import List from './pages/list';
|
import List from './pages/list';
|
||||||
import Lists from './pages/lists';
|
import Lists from './pages/lists';
|
||||||
import Login from './pages/login';
|
import Login from './pages/login';
|
||||||
|
@ -53,7 +53,6 @@ import {
|
||||||
initPreferences,
|
initPreferences,
|
||||||
} from './utils/api';
|
} from './utils/api';
|
||||||
import { getAccessToken } from './utils/auth';
|
import { getAccessToken } from './utils/auth';
|
||||||
import getInstanceStatusURL from './utils/get-instance-status-url';
|
|
||||||
import showToast from './utils/show-toast';
|
import showToast from './utils/show-toast';
|
||||||
import states, { getStatus, saveStatus } from './utils/states';
|
import states, { getStatus, saveStatus } from './utils/states';
|
||||||
import store from './utils/store';
|
import store from './utils/store';
|
||||||
|
@ -491,28 +490,4 @@ function BackgroundService({ isLoggedIn }) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function HttpRoute() {
|
|
||||||
const location = useLocation();
|
|
||||||
const url = location.pathname.replace(/^\//, '');
|
|
||||||
const statusURL = getInstanceStatusURL(url);
|
|
||||||
if (statusURL) {
|
|
||||||
window.location.hash = statusURL + '?view=full';
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<div class="ui-state" tabIndex="-1">
|
|
||||||
<h2>Unable to process URL</h2>
|
|
||||||
<p>
|
|
||||||
<a href={url} target="_blank">
|
|
||||||
{url}
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
<hr />
|
|
||||||
<p>
|
|
||||||
<Link to="/">Go home</Link>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export { App };
|
export { App };
|
||||||
|
|
28
src/pages/HttpRoute.jsx
Normal file
28
src/pages/HttpRoute.jsx
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
|
import Link from '../components/link';
|
||||||
|
import getInstanceStatusURL from '../utils/get-instance-status-url';
|
||||||
|
|
||||||
|
export default function HttpRoute() {
|
||||||
|
const location = useLocation();
|
||||||
|
const url = location.pathname.replace(/^\//, '');
|
||||||
|
const statusURL = getInstanceStatusURL(url);
|
||||||
|
if (statusURL) {
|
||||||
|
window.location.hash = statusURL + '?view=full';
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div class="ui-state" tabIndex="-1">
|
||||||
|
<h2>Unable to process URL</h2>
|
||||||
|
<p>
|
||||||
|
<a href={url} target="_blank">
|
||||||
|
{url}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<hr />
|
||||||
|
<p>
|
||||||
|
<Link to="/">Go home</Link>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue