From 5200e4663951e0c223bce09037b704a5869c08b4 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 17 Apr 2023 19:00:41 +0800 Subject: [PATCH] Split into its own file --- src/app.jsx | 27 +-------------------------- src/pages/HttpRoute.jsx | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 26 deletions(-) create mode 100644 src/pages/HttpRoute.jsx diff --git a/src/app.jsx b/src/app.jsx index ae24e8ce..7cbbd3c8 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -19,7 +19,6 @@ import { useSnapshot } from 'valtio'; import AccountSheet from './components/account-sheet'; import Compose from './components/compose'; import Drafts from './components/drafts'; -import Link from './components/link'; import Loader from './components/loader'; import MediaModal from './components/media-modal'; import Modal from './components/modal'; @@ -34,6 +33,7 @@ import FollowedHashtags from './pages/followed-hashtags'; import Following from './pages/following'; import Hashtag from './pages/hashtag'; import Home from './pages/home'; +import HttpRoute from './pages/HttpRoute'; import List from './pages/list'; import Lists from './pages/lists'; import Login from './pages/login'; @@ -53,7 +53,6 @@ import { initPreferences, } from './utils/api'; import { getAccessToken } from './utils/auth'; -import getInstanceStatusURL from './utils/get-instance-status-url'; import showToast from './utils/show-toast'; import states, { getStatus, saveStatus } from './utils/states'; import store from './utils/store'; @@ -491,28 +490,4 @@ function BackgroundService({ isLoggedIn }) { 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 ( -
-

Unable to process URL

-

- - {url} - -

-
-

- Go home -

-
- ); -} - export { App }; diff --git a/src/pages/HttpRoute.jsx b/src/pages/HttpRoute.jsx new file mode 100644 index 00000000..3c9729d2 --- /dev/null +++ b/src/pages/HttpRoute.jsx @@ -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 ( +
+

Unable to process URL

+

+ + {url} + +

+
+

+ Go home +

+
+ ); +}