Skip to content

Commit

Permalink
Merge branch 'master' into YaTut1901/fix/bump-commander
Browse files Browse the repository at this point in the history
  • Loading branch information
petertonysmith94 authored Jun 26, 2024
2 parents 6a415d2 + c846bfb commit b29e2d4
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 58 deletions.
5 changes: 5 additions & 0 deletions .changeset/slow-students-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-fuels": patch
---

feat: migrate to NextJS app router
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { Button } from "@/components/Button";
import { Input } from "@/components/Input";
import { useActiveWallet } from "@/hooks/useActiveWallet";
Expand Down
45 changes: 45 additions & 0 deletions templates/nextjs/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"use client";

import { Layout } from "@/components/Layout";
import "@/styles/globals.css";
import { FuelProvider } from "@fuels/react";
import React, { ReactNode, useEffect, useState } from "react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { FuelConfig } from "fuels";
import { defaultConnectors } from "@fuels/connectors";
import { ENABLE_FUEL_DEV_CONNECTOR } from "@/lib";
import { ActiveWalletProvider } from "@/hooks/useActiveWallet";

const queryClient = new QueryClient();

interface RootLayoutProps {
children: ReactNode;
}

export default function RootLayout({ children }: RootLayoutProps) {
const [fuelConfig, setFuelConfig] = useState<FuelConfig>({});

useEffect(() => {
setFuelConfig({
connectors: defaultConnectors({
devMode: ENABLE_FUEL_DEV_CONNECTOR,
}),
});
}, []);

return (
<html lang="en" className="bg-black text-white">
<body>
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<FuelProvider fuelConfig={fuelConfig}>
<ActiveWalletProvider>
<Layout>{children}</Layout>
</ActiveWalletProvider>
</FuelProvider>
</QueryClientProvider>
</React.StrictMode>
</body>
</html>
);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import type { TestContractAbi } from "@/sway-api";
import { TestContractAbi__factory } from "@/sway-api";
import contractIds from "@/sway-api/contract-ids.json";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { Button } from "@/components/Button";
import { FuelLogo } from "@/components/FuelLogo";
import { Input } from "@/components/Input";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { Button } from "@/components/Button";
import { FuelLogo } from "@/components/FuelLogo";
import { Input } from "@/components/Input";
Expand Down
38 changes: 0 additions & 38 deletions templates/nextjs/src/pages/_app.tsx

This file was deleted.

13 changes: 0 additions & 13 deletions templates/nextjs/src/pages/_document.tsx

This file was deleted.

6 changes: 1 addition & 5 deletions templates/nextjs/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { Config } from 'tailwindcss';

const config: Config = {
content: [
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
],
content: ['./src/components/**/*.{js,ts,jsx,tsx,mdx}', './src/app/**/*.{js,ts,jsx,tsx,mdx}'],
theme: {
extend: {
backgroundImage: {
Expand Down
9 changes: 7 additions & 2 deletions templates/nextjs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@
"incremental": true,
"paths": {
"@/*": ["./src/*"]
}
},
"plugins": [
{
"name": "next"
}
]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}

0 comments on commit b29e2d4

Please sign in to comment.