From ba42e4d6d8ee763ded151c0064706a4035bfff85 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Sat, 9 Jan 2021 10:52:20 -0600 Subject: [PATCH] Moving to more workable v1 solution --- components/AppShell.jsx | 138 +++----------------------------- components/Link.jsx | 24 ++++++ components/pages/Home.jsx | 33 +++----- components/pages/ListDetail.jsx | 2 +- components/pages/Lists.jsx | 30 +++---- components/pages/Settings.jsx | 41 +++------- components/pages/Tabs.jsx | 47 +++++++++++ components/ui/Content.jsx | 12 --- components/ui/PageStack.jsx | 37 --------- components/ui/Tab.jsx | 2 +- hooks/usePage.js | 2 +- next.config.js | 10 +++ package-lock.json | 126 ++++++++++++++++++++++++++++- package.json | 3 + pages/[...all].js | 10 +++ pages/_app.js | 9 ++- pages/index.js | 10 ++- pages/lists.js | 6 -- pages/lists/[listId].js | 18 ----- pages/settings.js | 6 -- pages/users/[userId].js | 6 -- store/index.js | 7 -- 22 files changed, 288 insertions(+), 291 deletions(-) create mode 100644 components/Link.jsx create mode 100644 components/pages/Tabs.jsx delete mode 100644 components/ui/Content.jsx delete mode 100644 components/ui/PageStack.jsx create mode 100644 next.config.js create mode 100644 pages/[...all].js delete mode 100644 pages/lists.js delete mode 100644 pages/lists/[listId].js delete mode 100644 pages/settings.js delete mode 100644 pages/users/[userId].js diff --git a/components/AppShell.jsx b/components/AppShell.jsx index 859257e..8017833 100644 --- a/components/AppShell.jsx +++ b/components/AppShell.jsx @@ -1,133 +1,19 @@ -import { useCallback, useEffect, useState } from 'react'; -import { useDrag } from 'react-use-gesture'; -import { Router, Route, Switch, useRoute } from 'wouter'; -import { cog, cogOutline, home, homeOutline, list, listOutline } from 'ionicons/icons'; +import { IonApp, IonRouterOutlet } from '@ionic/react'; +import { IonReactRouter } from '@ionic/react-router'; +import { Redirect, Route } from 'react-router-dom'; -import Store from '../store'; -import * as actions from '../store/actions'; -import * as selectors from '../store/selectors'; - -import App from '../components/ui/App'; -import Backdrop from '../components/ui/Backdrop'; -import Menu from '../components/ui/Menu'; -import Modal from '../components/ui/Modal'; -import Nav from '../components/ui/Nav'; -import PageStack from '../components/ui/PageStack'; -import Tab from '../components/ui/Tab'; -import TabBar from '../components/ui/TabBar'; -import { SafeAreaProvider } from '../components/ui/SafeArea'; -import Notifications from '../components/Notifications'; -import MenuContent from '../components/MenuContent'; -import Home from './pages/Home'; -import Lists from './pages/Lists'; -import Settings from './pages/Settings'; -import useLocation from '../hooks/useLocation'; -import ListDetail from './pages/ListDetail'; - -const CurrentPage = ({ page, pageProps = {} }) => { - const currentPage = Store.useState(selectors.getCurrentPage); - - const Page = page; - - const [local, setLocal] = useState(false); - - useEffect(() => { - setLocal(true); - }, []); - - return ( - - {local ? ( - - - - - - - ) : ( - - )} - - ); -}; +import Tabs from './pages/Tabs'; const AppShell = ({ page, pageProps }) => { - const [location] = useLocation(); - - const showMenu = Store.useState(selectors.getMenuOpen); - const showNotifications = Store.useState(selectors.getNotificationsOpen); - const currentPage = Store.useState(selectors.getCurrentPage); - - const closeMenu = () => actions.setMenuOpen(false); - - const backdropClose = () => { - actions.setMenuOpen(false); - actions.setNotificationsOpen(false); - }; - - const closeNotifications = () => actions.setNotificationsOpen(false); - - // To enable edge drag detection to open the side menu - const bind = useDrag( - ({ down, movement: [mx], xy: [x, y], cancel }) => { - if (mx > 5 && x < 50 && down) { - actions.setMenuOpen(true); - cancel(); - } - }, - { - axis: 'x', - } - ); - - console.log('Got location', location); - - // This is an example app layout. We've got a hidden menu that will be toggled - // return ( - - - - - - -