import { IonRouterOutlet } from '@ionic/react';
import { IonReactRouter } from '@ionic/react-router';
import { Redirect, Route } from 'react-router-dom';
import { AllSubPages, AllTabs, tabRoutes } from './AllRoutes.jsx';

const NavRoutes = () => {
  return (
    <IonReactRouter>
      <IonRouterOutlet id="main">
        <Route path="/demo-react-whatsapp-clone/tabs" render={() => <AllTabs />} />
        <AllSubPages />

        <Route path="/demo-react-whatsapp-clone" component={tabRoutes.filter((t) => t.default)[0].component} exact={true} />
        <Redirect exact from="/demo-react-whatsapp-clone" to={'/demo-react-whatsapp-clone' + tabRoutes.filter((t) => t.default)[0].path.toString()} />
      </IonRouterOutlet>
    </IonReactRouter>
  );
};

export default NavRoutes;
