App directory #4
This commit is contained in:
parent
69706053c6
commit
4d743c5e67
86 changed files with 223 additions and 107 deletions
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"prettier.prettierPath": ""
|
||||
}
|
||||
|
|
@ -17,6 +17,6 @@ type LayoutProps = {
|
|||
export default function Layout({ children }: LayoutProps) {
|
||||
const allHeaders = headers();
|
||||
const embedded = Boolean(allHeaders.get('x-leafcutter-embedded'));
|
||||
console.log({embedded})
|
||||
|
||||
return <InternalLayout embedded={embedded}>{children}</InternalLayout>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { FC } from "react";
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
import { RawDataViewer } from "@/app/_components/RawDataViewer";
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
import { getSession } from "next-auth/react";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { authOptions } from "app/_lib/auth";
|
||||
import { getUserVisualizations } from "@/app/_lib/opensearch";
|
||||
import { Home } from "@/app/_components/Home";
|
||||
|
||||
export default async function Page() {
|
||||
const context = undefined;
|
||||
const session = (await getSession(context)) ?? null;
|
||||
const session = await getServerSession(authOptions);
|
||||
const { user: { email } }: any = session;
|
||||
const visualizations = await getUserVisualizations(
|
||||
session?.user?.email ?? "none",
|
||||
email ?? "none",
|
||||
20
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { FC, useEffect } from "react";
|
||||
import { CircularProgress, Typography, Grid } from "@mui/material";
|
||||
import { signIn, signOut, getSession } from "next-auth/react";
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
"use client";
|
||||
|
||||
import { FC, PropsWithChildren, useEffect } from "react";
|
||||
import { CircularProgress } from "@mui/material";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useRouter } from "next/router";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export const Auth: FC<PropsWithChildren> = ({ children }) => {
|
||||
const router = useRouter();
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
/* eslint-disable react/display-name */
|
||||
import { forwardRef } from "react";
|
||||
import useDigitInput, { InputAttributes } from "react-digit-input";
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
"use client";
|
||||
|
||||
import { FC, useEffect, useState } from "react";
|
||||
import { Admin, Resource } from "react-admin";
|
||||
import { useApolloClient } from "@apollo/client";
|
||||
import polyglotI18nProvider from "ra-i18n-polyglot";
|
||||
import { ThemeProvider, createTheme } from "@mui/material";
|
||||
import { metamigoDataProvider } from "../lib/dataprovider";
|
||||
import { metamigoDataProvider } from "../_lib/dataprovider";
|
||||
import { theme } from "./layout/themes";
|
||||
import { Layout } from "./layout";
|
||||
import englishMessages from "../i18n/en";
|
||||
import englishMessages from "../_i18n/en";
|
||||
import users from "./users";
|
||||
import accounts from "./accounts";
|
||||
import whatsappBots from "./whatsapp/bots";
|
||||
8
apps/metamigo-frontend/app/_components/MultiProvider.tsx
Normal file
8
apps/metamigo-frontend/app/_components/MultiProvider.tsx
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
"use client";
|
||||
|
||||
import { FC, PropsWithChildren } from "react";
|
||||
import { SessionProvider } from "next-auth/react";
|
||||
|
||||
export const MultiProvider: FC<PropsWithChildren> = ({ children }) => (
|
||||
<SessionProvider>{children}</SessionProvider>
|
||||
);
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { FC } from "react";
|
||||
import { makeStyles } from "@mui/styles";
|
||||
import {
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { FC } from "react";
|
||||
import {
|
||||
List,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
/* eslint-disable import/no-named-as-default */
|
||||
/* eslint-disable import/no-anonymous-default-export */
|
||||
import AccountIcon from "@mui/icons-material/AccountTree";
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { forwardRef } from "react";
|
||||
import { AppBar, UserMenu, MenuItemLink, useTranslate } from "react-admin";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
/* eslint-disable import/no-named-as-default */
|
||||
"use client";
|
||||
|
||||
import { Layout as RaLayout, LayoutProps, Sidebar } from "react-admin";
|
||||
import AppBar from "./AppBar";
|
||||
import Menu from "./Menu";
|
||||
|
|
@ -6,7 +7,7 @@ import { theme } from "./themes";
|
|||
|
||||
const CustomSidebar = (props: any) => <Sidebar {...props} size={200} />;
|
||||
|
||||
const Layout = (props: LayoutProps) => (
|
||||
export const Layout = (props: LayoutProps) => (
|
||||
<RaLayout
|
||||
{...props}
|
||||
appBar={AppBar}
|
||||
|
|
@ -16,5 +17,3 @@ const Layout = (props: LayoutProps) => (
|
|||
theme={theme}
|
||||
/>
|
||||
);
|
||||
|
||||
export default Layout;
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { SVGProps } from "react";
|
||||
|
||||
const Logo = (props: SVGProps<SVGSVGElement>) => (
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
import { FC, useState } from "react";
|
||||
// import { useSelector } from "react-redux";
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { FC, PropsWithChildren, Fragment, ReactElement } from "react";
|
||||
import ExpandMore from "@mui/icons-material/ExpandMore";
|
||||
import List from "@mui/material/List";
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
export { default as AppBar } from "./AppBar";
|
||||
export { default as Layout } from "./Layout";
|
||||
export { Layout } from "./Layout";
|
||||
export { default as Menu } from "./Menu";
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import {
|
||||
SimpleForm,
|
||||
Create,
|
||||
|
|
@ -6,7 +8,7 @@ import {
|
|||
CreateProps,
|
||||
} from "react-admin";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { validateE164Number } from "../../../lib/phone-numbers";
|
||||
import { validateE164Number } from "../../../_lib/phone-numbers";
|
||||
|
||||
const SignalBotCreate = (props: CreateProps) => {
|
||||
const { data: session } = useSession();
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { SimpleForm, Edit, TextInput, required, EditProps } from "react-admin";
|
||||
|
||||
const SignalBotEdit = (props: EditProps) => (
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import {
|
||||
List,
|
||||
Datagrid,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import {
|
||||
Show,
|
||||
|
|
@ -28,7 +30,7 @@ import { SixDigitInput } from "../../DigitInput";
|
|||
import {
|
||||
sanitizeE164Number,
|
||||
isValidE164Number,
|
||||
} from "../../../lib/phone-numbers";
|
||||
} from "../../../_lib/phone-numbers";
|
||||
|
||||
const Sidebar = ({ record }: any) => {
|
||||
const [phoneNumber, setPhoneNumber] = useState("");
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import SignalBotIcon from "@mui/icons-material/ChatOutlined";
|
||||
import SignalBotList from "./SignalBotList";
|
||||
import SignalBotEdit from "./SignalBotEdit";
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
/* eslint-disable react/display-name */
|
||||
import {
|
||||
SelectInput,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { FC } from "react";
|
||||
import {
|
||||
SimpleForm,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { makeStyles } from "@mui/styles";
|
||||
import {
|
||||
SimpleForm,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import {
|
||||
List,
|
||||
Datagrid,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import UserIcon from "@mui/icons-material/People";
|
||||
import UserList from "./UserList";
|
||||
import UserEdit from "./UserEdit";
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { SelectInput, useRecordContext } from "react-admin";
|
||||
|
||||
export const UserRoleInput = (props: any) => {
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import {
|
||||
SimpleForm,
|
||||
TextInput,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import {
|
||||
SimpleForm,
|
||||
TextInput,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { List, Datagrid, DateField, TextField, ListProps } from "react-admin";
|
||||
|
||||
const ProviderList = (props: ListProps) => (
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
/* eslint-disable import/no-anonymous-default-export */
|
||||
import ProviderIcon from "@mui/icons-material/Business";
|
||||
import ProviderList from "./ProviderList";
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { SelectInput } from "react-admin";
|
||||
|
||||
export const ProviderKindInput = (props: any) => (
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { useInput } from "react-admin";
|
||||
import React, { useState } from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import {
|
||||
SimpleForm,
|
||||
Create,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import {
|
||||
SimpleForm,
|
||||
TextInput,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import {
|
||||
List,
|
||||
ListProps,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import VoiceLineIcon from "@mui/icons-material/PhoneCallback";
|
||||
import VoiceLineList from "./VoiceLineList";
|
||||
import VoiceLineEdit from "./VoiceLineEdit";
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
/* eslint-disable react/display-name */
|
||||
import React, { useState, useEffect } from "react";
|
||||
import PlayIcon from "@mui/icons-material/PlayCircleFilled";
|
||||
|
|
@ -12,7 +14,7 @@ import {
|
|||
TextField,
|
||||
} from "react-admin";
|
||||
import { IconButton, CircularProgress } from "@mui/material";
|
||||
import absoluteUrl from "../../../lib/absolute-url";
|
||||
import absoluteUrl from "../../../_lib/absolute-url";
|
||||
import TwilioLanguages from "./twilio-languages";
|
||||
|
||||
type TTSProvider = (voice: any, language: any, prompt: any) => Promise<void>;
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import {
|
||||
SimpleForm,
|
||||
FormDataConsumer,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import {
|
||||
SimpleForm,
|
||||
TextInput,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { List, Datagrid, DateField, TextField, ListProps } from "react-admin";
|
||||
import { BackendIdField } from "./shared";
|
||||
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import WebhookIcon from "@mui/icons-material/Send";
|
||||
import WebhookList from "./WebhookList";
|
||||
import WebhookEdit from "./WebhookEdit";
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { SelectInput, required } from "react-admin";
|
||||
|
||||
import {
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { List, Datagrid, TextField } from "react-admin";
|
||||
|
||||
const WhatsappAttachmentList = (props: any) => (
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { Show, ShowProps, SimpleShowLayout, TextField } from "react-admin";
|
||||
|
||||
const WhatsappAttachmentShow = (props: ShowProps) => (
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import WhatsappAttachmentIcon from "@mui/icons-material/AttachFile";
|
||||
import WhatsappAttachmentList from "./WhatsappAttachmentList";
|
||||
import WhatsappAttachmentShow from "./WhatsappAttachmentShow";
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
"use client";
|
||||
|
||||
// import dynamic from "next/dynamic";
|
||||
import { SimpleForm, Create, TextInput, required } from "react-admin";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { validateE164Number } from "../../../lib/phone-numbers";
|
||||
import { validateE164Number } from "../../../_lib/phone-numbers";
|
||||
|
||||
const WhatsappBotCreate = (props: any) => {
|
||||
// const MuiPhoneNumber = dynamic(() => import("material-ui-phone-number"), {
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import { SimpleForm, Edit, TextInput, required, EditProps } from "react-admin";
|
||||
|
||||
const WhatsappBotEdit = (props: EditProps) => (
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import {
|
||||
List,
|
||||
Datagrid,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import {
|
||||
Card,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import WhatsappBotIcon from "@mui/icons-material/WhatsApp";
|
||||
import WhatsappBotList from "./WhatsappBotList";
|
||||
import WhatsappBotEdit from "./WhatsappBotEdit";
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
/* eslint-disable react/display-name */
|
||||
import {
|
||||
SelectInput,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import {
|
||||
List,
|
||||
ListProps,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import {
|
||||
Show,
|
||||
ShowProps,
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import WhatsappMessageIcon from "@mui/icons-material/Message";
|
||||
import WhatsappMessageList from "./WhatsappMessageList";
|
||||
import WhatsappMessageShow from "./WhatsappMessageShow";
|
||||
16
apps/metamigo-frontend/app/admin/_components/Admin.tsx
Normal file
16
apps/metamigo-frontend/app/admin/_components/Admin.tsx
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"use client";
|
||||
|
||||
import { FC } from "react";
|
||||
import { ApolloProvider } from "@apollo/client";
|
||||
import { apolloClient } from "app/_lib/apollo-client";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
const MetamigoAdmin = dynamic(() => import("app/_components/MetamigoAdmin"), {
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
export const Admin:FC = () => (
|
||||
<ApolloProvider client={apolloClient}>
|
||||
<MetamigoAdmin />
|
||||
</ApolloProvider>
|
||||
);
|
||||
5
apps/metamigo-frontend/app/admin/page.tsx
Normal file
5
apps/metamigo-frontend/app/admin/page.tsx
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { Admin } from "./_components/Admin";
|
||||
|
||||
export default function Home() {
|
||||
return <Admin />
|
||||
}
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { NextRequest } from "next/server";
|
||||
import NextAuth from "next-auth";
|
||||
import Google from "next-auth/providers/google";
|
||||
import GitHub from "next-auth/providers/github";
|
||||
import GitLab from "next-auth/providers/gitlab";
|
||||
import Cognito from "next-auth/providers/cognito";
|
||||
import { loadConfig, IAppConfig } from "@digiresilience/metamigo-config";
|
||||
import { MetamigoAdapter } from "../../../lib/nextauth-adapter";
|
||||
import { CloudflareAccessProvider } from "../../../lib/cloudflare";
|
||||
import { MetamigoAdapter } from "app/_lib/nextauth-adapter";
|
||||
import { CloudflareAccessProvider } from "app/_lib/cloudflare";
|
||||
|
||||
const nextAuthOptions = (config: IAppConfig, req: NextApiRequest) => {
|
||||
const nextAuthOptions = (config: IAppConfig, req: NextRequest) => {
|
||||
const { nextAuth, cfaccess } = config;
|
||||
const adapter = MetamigoAdapter(config);
|
||||
const providers = [];
|
||||
|
|
@ -16,7 +16,7 @@ const nextAuthOptions = (config: IAppConfig, req: NextApiRequest) => {
|
|||
const { audience, domain } = cfaccess;
|
||||
const cloudflareAccessEnabled = audience && domain;
|
||||
if (cloudflareAccessEnabled)
|
||||
providers.push(CloudflareAccessProvider(audience, domain, adapter, req));
|
||||
providers.push(CloudflareAccessProvider(audience, domain, adapter, req as any));
|
||||
else {
|
||||
if (nextAuth.google?.id)
|
||||
providers.push(
|
||||
|
|
@ -78,11 +78,11 @@ const nextAuthOptions = (config: IAppConfig, req: NextApiRequest) => {
|
|||
};
|
||||
};
|
||||
|
||||
const nextAuth = async (
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse
|
||||
): Promise<void> =>
|
||||
// @ts-expect-error: Type mismatch
|
||||
NextAuth(req, res, nextAuthOptions(await loadConfig(), req));
|
||||
const handler = async (req: NextRequest) => {
|
||||
const config = await loadConfig();
|
||||
const authOptions = nextAuthOptions(config, req);
|
||||
// @ts-expect-error: non-existent property
|
||||
return NextAuth(authOptions)(req);
|
||||
};
|
||||
|
||||
export default nextAuth;
|
||||
export { handler as GET, handler as POST };
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { createProxyMiddleware } from "http-proxy-middleware";
|
||||
|
||||
export default createProxyMiddleware({
|
||||
export const POST = createProxyMiddleware({
|
||||
target:
|
||||
process.env.NODE_ENV === "production"
|
||||
? "http://metamigo-api:3001"
|
||||
|
|
@ -28,9 +28,3 @@ export default createProxyMiddleware({
|
|||
}
|
||||
},
|
||||
});
|
||||
|
||||
export const config = {
|
||||
api: {
|
||||
bodyParser: false,
|
||||
},
|
||||
};
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { createProxyMiddleware } from "http-proxy-middleware";
|
||||
|
||||
export default createProxyMiddleware({
|
||||
const handler = createProxyMiddleware({
|
||||
target:
|
||||
process.env.NODE_ENV === "production"
|
||||
? "http://metamigo-api:3001"
|
||||
|
|
@ -30,8 +30,4 @@ export default createProxyMiddleware({
|
|||
},
|
||||
});
|
||||
|
||||
export const config = {
|
||||
api: {
|
||||
bodyParser: false,
|
||||
},
|
||||
};
|
||||
export { handler as GET, handler as POST, handler as PUT, handler as DELETE};
|
||||
20
apps/metamigo-frontend/app/layout.tsx
Normal file
20
apps/metamigo-frontend/app/layout.tsx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { ReactNode } from "react";
|
||||
import "app/_styles/globals.css";
|
||||
import { MultiProvider } from "./_components/MultiProvider";
|
||||
|
||||
type LayoutProps = {
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export default function Layout({ children }: LayoutProps) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>
|
||||
<MultiProvider>
|
||||
{children}
|
||||
</MultiProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
"use client";
|
||||
|
||||
import { FC } from "react";
|
||||
import { Button } from "@mui/material";
|
||||
import { signIn, signOut, useSession } from "next-auth/react";
|
||||
|
||||
const MyComponent: FC = () => {
|
||||
export const Login: FC = () => {
|
||||
const { data: session } = useSession();
|
||||
|
||||
return (
|
||||
|
|
@ -26,5 +28,3 @@ const MyComponent: FC = () => {
|
|||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default MyComponent;
|
||||
5
apps/metamigo-frontend/app/login/page.tsx
Normal file
5
apps/metamigo-frontend/app/login/page.tsx
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { Login } from "./_components/Login";
|
||||
|
||||
export default function Page() {
|
||||
return <Login />;
|
||||
}
|
||||
3
apps/metamigo-frontend/app/page.tsx
Normal file
3
apps/metamigo-frontend/app/page.tsx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export default function Page() {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
import "../styles/globals.css";
|
||||
import { AppProps } from "next/app";
|
||||
import { SessionProvider } from "next-auth/react";
|
||||
|
||||
function MetamigoStarter({ Component, pageProps }: AppProps) {
|
||||
return (
|
||||
<SessionProvider session={(pageProps as any).session}>
|
||||
<Component {...pageProps} />
|
||||
</SessionProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default MetamigoStarter;
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
import { ApolloProvider } from "@apollo/client";
|
||||
import { apolloClient } from "../lib/apollo-client";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
const MetamigoAdmin = dynamic(() => import("../components/MetamigoAdmin"), {
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<ApolloProvider client={apolloClient}>
|
||||
<MetamigoAdmin />
|
||||
</ApolloProvider>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
import { NextPage } from "next";
|
||||
import { Typography, Box, Button, Grid, Link } from "@mui/material";
|
||||
import { FC, useEffect, PropsWithChildren } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
export const RedirectToAdmin: FC<PropsWithChildren> = ({ children }) => {
|
||||
const router = useRouter();
|
||||
useEffect(() => {
|
||||
router.push("/admin");
|
||||
});
|
||||
|
||||
return <>{children}</>;
|
||||
};
|
||||
|
||||
const Home: NextPage = () => (
|
||||
<Box>
|
||||
<Typography variant="h3">Metamigo</Typography>
|
||||
<Grid container justifyContent="space-around" style={{ padding: 60 }}>
|
||||
<Grid item>
|
||||
<Link href="/admin">
|
||||
<Button variant="contained">Admin</Button>
|
||||
<RedirectToAdmin />
|
||||
</Link>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Box>
|
||||
);
|
||||
|
||||
export default Home;
|
||||
|
|
@ -2,7 +2,11 @@
|
|||
"extends": "tsconfig-link",
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"allowJs": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
|
|
@ -17,9 +21,24 @@
|
|||
"strict": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./*", "../../node_modules/*"]
|
||||
}
|
||||
"@/*": [
|
||||
"./*",
|
||||
"../../node_modules/*"
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue