From f1a70f3bd1b6d7c2f1e208db13e04e4d4b43483e Mon Sep 17 00:00:00 2001 From: Sonny Date: Thu, 11 Apr 2024 01:23:36 +0200 Subject: [PATCH] refactor: change routes to the home page and (new) "app" page Tldr : "/" becomes "/app" and "/about" becomes "/" --- src/components/Navbar/NavbarUntranslated.tsx | 5 +- src/constants/paths.ts | 1 + src/lib/search.tsx | 2 +- src/pages/_app.tsx | 4 +- src/pages/about.tsx | 104 ------- src/pages/app.tsx | 205 ++++++++++++++ src/pages/category/create.tsx | 2 +- src/pages/category/edit/[cid].tsx | 4 +- src/pages/category/remove/[cid].tsx | 4 +- src/pages/index.tsx | 274 ++++++------------- src/pages/link/create.tsx | 4 +- src/pages/link/edit/[lid].tsx | 4 +- src/pages/link/remove/[lid].tsx | 4 +- src/pages/login.tsx | 2 +- 14 files changed, 309 insertions(+), 310 deletions(-) delete mode 100644 src/pages/about.tsx create mode 100644 src/pages/app.tsx diff --git a/src/components/Navbar/NavbarUntranslated.tsx b/src/components/Navbar/NavbarUntranslated.tsx index 02e7d37..315490b 100644 --- a/src/components/Navbar/NavbarUntranslated.tsx +++ b/src/components/Navbar/NavbarUntranslated.tsx @@ -13,10 +13,7 @@ export default function NavbarUntranslated() { MyLinks
  • - Privacy -
  • -
  • - Terms of use + GitHub
  • {status === 'authenticated' ? (
  • diff --git a/src/constants/paths.ts b/src/constants/paths.ts index 0ff70bf..cf8c330 100644 --- a/src/constants/paths.ts +++ b/src/constants/paths.ts @@ -2,6 +2,7 @@ const PATHS = { LOGIN: '/login', LOGOUT: '/logout', HOME: '/', + APP: '/app', PRIVACY: '/privacy', TERMS: '/terms', ADMIN: '/admin', diff --git a/src/lib/search.tsx b/src/lib/search.tsx index 4ba14ee..d81938f 100644 --- a/src/lib/search.tsx +++ b/src/lib/search.tsx @@ -16,7 +16,7 @@ export function buildSearchItem( url: type === 'link' ? (item as LinkWithCategory).url - : `${PATHS.HOME}?categoryId=${item.id}`, + : `${PATHS.APP}?categoryId=${item.id}`, type, category: type === 'link' ? (item as LinkWithCategory).category : undefined, }; diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 77dcff7..76b7391 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -23,8 +23,8 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }) { // TODO: use dynamic locale import dayjs.locale(i18n.language); - useHotkeys(Keys.CLOSE_SEARCH_KEY, () => router.push(PATHS.HOME), { - enabled: router.pathname !== PATHS.HOME, + useHotkeys(Keys.CLOSE_SEARCH_KEY, () => router.push(PATHS.APP), { + enabled: router.pathname !== PATHS.APP, enableOnFormTags: ['INPUT'], }); diff --git a/src/pages/about.tsx b/src/pages/about.tsx deleted file mode 100644 index ce3e887..0000000 --- a/src/pages/about.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import clsx from 'clsx'; -import Footer from 'components/Footer/Footer'; -import Navbar from 'components/Navbar/Navbar'; -import PageTransition from 'components/PageTransition'; -import { getServerSideTranslation } from 'i18n'; -import { useTranslation } from 'next-i18next'; -import Image from 'next/image'; -import Link from 'next/link'; -import { IconType } from 'react-icons'; -import { AiFillFolderOpen } from 'react-icons/ai'; -import { FaUser } from 'react-icons/fa'; -import { IoIosLink, IoIosSearch } from 'react-icons/io'; -import { IoExtensionPuzzleOutline } from 'react-icons/io5'; -import websiteScreenshot from '../../public/website-screenshot.png'; - -import Quotes from 'components/Quotes/Quotes'; -import styles from 'styles/about.module.scss'; - -export default function AboutPage() { - const { t } = useTranslation('about'); - return ( - - - -
    -
      - - - - - -
    -

    {t('about:look-title')}

    -
    - {t('about:website-screenshot-alt')} -
    -
    -