Initial page routing / page structure
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
/** @jsxImportSource theme-ui */
|
||||
import type { GetStaticPaths, GetStaticProps, NextPage } from "next";
|
||||
import Head from "next/head";
|
||||
import { Box } from "theme-ui";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import HooksEditor from "../components/HooksEditor";
|
||||
import { useEffect } from "react";
|
||||
import { fetchFiles } from "../state";
|
||||
import Footer from "../components/Footer";
|
||||
|
||||
const Home: NextPage = () => {
|
||||
const router = useRouter();
|
||||
const index = router.query.index;
|
||||
const gistId = index && Array.isArray(index) ? index[0] : "";
|
||||
useEffect(() => {
|
||||
fetchFiles(gistId);
|
||||
}, [gistId]);
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>XRPL Hooks Playground</title>
|
||||
</Head>
|
||||
|
||||
<main sx={{ display: "flex", flex: 1 }}>
|
||||
<HooksEditor />
|
||||
</main>
|
||||
|
||||
<Footer />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Home;
|
||||
|
||||
export const getStaticPaths: GetStaticPaths = async () => {
|
||||
// ...
|
||||
return { paths: [], fallback: "blocking" };
|
||||
};
|
||||
|
||||
export const getStaticProps: GetStaticProps = async (context) => {
|
||||
// ...
|
||||
return {
|
||||
props: {},
|
||||
revalidate: 60,
|
||||
};
|
||||
};
|
||||
12
pages/_middleware.ts
Normal file
12
pages/_middleware.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { NextRequest, NextFetchEvent } from 'next/server';
|
||||
import { NextResponse as Response } from 'next/server';
|
||||
import { getToken } from "next-auth/jwt"
|
||||
|
||||
export default function middleware(req: NextRequest, ev: NextFetchEvent) {
|
||||
|
||||
if (req.nextUrl.pathname === "/") {
|
||||
console.log('kissa', ev);
|
||||
return Response.redirect("/develop");
|
||||
|
||||
}
|
||||
}
|
||||
12
pages/deploy/index.tsx
Normal file
12
pages/deploy/index.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { useSnapshot } from "valtio";
|
||||
import Container from "../../components/Container";
|
||||
import { state } from "../../state";
|
||||
|
||||
const Deploy = () => {
|
||||
const snap = useSnapshot(state);
|
||||
return (
|
||||
<Container>This will be the deploy page {JSON.stringify(snap)}</Container>
|
||||
);
|
||||
};
|
||||
|
||||
export default Deploy;
|
||||
39
pages/develop/index.tsx
Normal file
39
pages/develop/index.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import type { NextPage } from "next";
|
||||
import Head from "next/head";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
import Footer from "../../components/Footer";
|
||||
|
||||
const HooksEditor = dynamic(() => import("../../components/HooksEditor"), {
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
const Home: NextPage = () => {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>XRPL Hooks Playground</title>
|
||||
</Head>
|
||||
<main style={{ display: "flex", flex: 1 }}>
|
||||
<HooksEditor />
|
||||
</main>
|
||||
|
||||
<Footer />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Home;
|
||||
|
||||
// export const getStaticPaths: GetStaticPaths = async () => {
|
||||
// // ...
|
||||
// return { paths: [], fallback: "blocking" };
|
||||
// };
|
||||
|
||||
// export const getStaticProps: GetStaticProps = async (context) => {
|
||||
// // ...
|
||||
// return {
|
||||
// props: {},
|
||||
// revalidate: 60,
|
||||
// };
|
||||
// };
|
||||
7
pages/test/index.tsx
Normal file
7
pages/test/index.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import Container from "../../components/Container";
|
||||
|
||||
const Test = () => {
|
||||
return <Container>This will be the test page</Container>;
|
||||
};
|
||||
|
||||
export default Test;
|
||||
Reference in New Issue
Block a user