Skip to content

Commit

Permalink
Add trpc
Browse files Browse the repository at this point in the history
  • Loading branch information
zachpmanson committed Aug 30, 2024
1 parent a30d59a commit 9b6a486
Show file tree
Hide file tree
Showing 17 changed files with 506 additions and 346 deletions.
242 changes: 190 additions & 52 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "next dev --turbo",
"build": "next build",
"start": "next start",
"lint": "next lint",
Expand All @@ -14,12 +14,18 @@
"dependencies": {
"@headlessui/react": "^1.7.17",
"@prisma/client": "^5.7.0",
"next": "14.1.1",
"@tanstack/react-query": "^5.52.3",
"@trpc/client": "^11.0.0-rc.490",
"@trpc/next": "^11.0.0-rc.490",
"@trpc/react-query": "^11.0.0-rc.490",
"@trpc/server": "^11.0.0-rc.490",
"next": "^14.2.7",
"nuqs": "^1.17.8",
"prisma": "^5.7.0",
"react": "^18",
"react-dom": "^18",
"seedrandom": "^3.0.5",
"zod": "^3.22.4"
"zod": "^3.23.8"
},
"devDependencies": {
"@types/node": "^20",
Expand Down
2 changes: 1 addition & 1 deletion src/context/Global/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CACHE_VERSION, DEFAULT_OPTIONS, PUBLIC_DIR } from "@/constants";
import { compareTables, getVariantsWithReflections } from "@/lib/recipe";
import { compareTables, getVariantsWithReflections } from "@/utils/recipe";
import {
ColorTable,
GameState,
Expand Down
90 changes: 45 additions & 45 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,50 @@ import type { AppProps } from "next/app";
import Head from "next/head";
import Layout from "./layout";

export default function App({ Component, pageProps }: AppProps) {
return (
<GlobalProvider>
<Layout>
<Head>
<title>Minecraftle</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta
name="viewport"
content="width=device-width; initial-scale=1.0;"
/>
<link
rel="apple-touch-icon"
sizes="180x180"
href="/icons/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/icons/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/icons/favicon-16x16.png"
/>
<link rel="manifest" href="/icons/site.webmanifest" />
<link
rel="mask-icon"
href="/icons//safari-pinned-tab.svg"
color="#5bbad5"
/>
<link rel="shortcut icon" href="/icons/favicon.ico" />
<meta name="msapplication-TileColor" content="#da532c" />
<meta
name="msapplication-config"
content="/icons/browserconfig.xml"
/>
<meta name="theme-color" content="#221A13" />
</Head>
<Component {...pageProps} />
</Layout>
</GlobalProvider>
import { trpc } from "../utils/trpc";

function App({ Component, pageProps }: AppProps) {
const layout = (
<Layout>
<Head>
<title>Minecraftle</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta
name="viewport"
content="width=device-width; initial-scale=1.0;"
/>
<link
rel="apple-touch-icon"
sizes="180x180"
href="/icons/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/icons/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/icons/favicon-16x16.png"
/>
<link rel="manifest" href="/icons/site.webmanifest" />
<link
rel="mask-icon"
href="/icons//safari-pinned-tab.svg"
color="#5bbad5"
/>
<link rel="shortcut icon" href="/icons/favicon.ico" />
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="msapplication-config" content="/icons/browserconfig.xml" />
<meta name="theme-color" content="#221A13" />
</Head>
<Component {...pageProps} />
</Layout>
);
return <GlobalProvider>{layout}</GlobalProvider>;
}

export default trpc.withTRPC(App);
72 changes: 0 additions & 72 deletions src/pages/api/scoreboard/[userId].ts

This file was deleted.

121 changes: 0 additions & 121 deletions src/pages/api/submitgame.ts

This file was deleted.

9 changes: 9 additions & 0 deletions src/pages/api/trpc/[trpc].ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as trpcNext from "@trpc/server/adapters/next";
import { appRouter } from "../../../server/routers/_app";

// export API handler
// @link https://trpc.io/docs/v11/server/adapters
export default trpcNext.createNextApiHandler({
router: appRouter,
createContext: () => ({}),
});
Loading

0 comments on commit 9b6a486

Please sign in to comment.