Untitled

mail@pastecode.io avatar
unknown
javascript
2 years ago
3.8 kB
6
Indexable
Never
import { colors } from "./atoms/theme/colors";
import Login from "./screens/Login";
import Signup from "./screens/Signup";
import Orders from "./screens/Orders";
import Chat from "./screens/Chat";
import Inventory from "./screens/Inventory";
import Recipes from "./screens/Recipes";
import RidersLocation from "./screens/RidersLocation";
import Billing from "./screens/Billing";
import RolesandPermissions from "./screens/RolesandPermissions";
import CompanyDetails from "./screens/CompanyDetails";
import Reports from "./screens/Reports";
import ProfileDetails from "./screens/ProfileDetails";
import HomeAdminOutlet from "./screens/HomeAdminOutlet";
import MenuItemsSettings from "./components/admin/MenuItemsSettings";
import ProtectedRoute from "./components/ProtectedRoute";
import CategorySettings from "./components/admin/CategorySettings";
import {
  BrowserRouter,
  Routes,
  Route,
  createBrowserRouter,
  RouterProvider,
} from "react-router-dom";
import { create } from "zustand";
import { MantineProvider, Text } from "@mantine/core";
import HomeAdmin from "./screens/HomeAdmin";
import { Dashboard, Report } from "@mui/icons-material";
import { NhostClient, NhostProvider } from "@nhost/react";
import Logout from "./screens/Logout";
import HomePage from "./screens/HomePage";
import { NhostApolloProvider } from "@nhost/react-apollo";
import CreateNewOrder from "./features/billing/CreateNewOrder";
import ChatThread from "./components/ChatThread";
import ChatThreadExpanded from "./components/ChatThreadExpanded";

const nhost = new NhostClient({
  subdomain: process.env.REACT_APP_NHOST_SUBDOMAIN,
  region: process.env.REACT_APP_NHOST_REGION,
});

const router = createBrowserRouter([
  {
    path: "/",
    element: <HomePage />,
  },
  {
    path: "/login",
    element: <Login />,
  },
  {
    path: "/signup",
    element: <Signup />,
  },
  {
    path: "/logout",
    element: <Logout />,
  },
  {
    path: "/homeadmin",
    element: <HomeAdmin />,

    children: [
      {
        path: "dashboard",
        element: <HomeAdminOutlet />,
      },

      {
        path: "orders",
        element: <Orders />,
      },
      {
        path: "createneworder",
        element: <CreateNewOrder />,
      },

      {
        path: "chat",
        element: <Chat />,
      },
      {
        path: "chatthreadexpanded/:chatid",
        element: <ChatThreadExpanded />,
      },
      {
        path: "inventory",
        element: <Inventory />,
      },

      {
        path: "menuitemssettings",
        element: <MenuItemsSettings />,
      },
      {
        path: "categoriessettings",
        element: <CategorySettings />,
      },
      {
        path: "recipes",
        element: <Recipes />,
      },
      {
        path: "riderslocation",
        element: <RidersLocation />,
      },
      {
        path: "billing",
        element: <Billing />,
      },
      {
        path: "rolesandpermissions",
        element: <RolesandPermissions />,
      },
      {
        path: "companydetails",
        element: <CompanyDetails />,
      },
      {
        path: "reports",
        element: <Reports />,
      },
      {
        path: "profiledetails",
        element: <ProfileDetails />,
      },
    ],
  },
]);

function App() {
  return (
    <NhostProvider nhost={nhost}>
      <NhostApolloProvider nhost={nhost}>
        <RouterProvider router={router}>
          <MantineProvider withGlobalStyles withNormalizeCSS>
            <Signup />
          </MantineProvider>
        </RouterProvider>
      </NhostApolloProvider>
    </NhostProvider>
  );
}

export default App;