Skip to content

Commit

Permalink
feat: initial commit frontend-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
andyv09 committed Aug 16, 2024
1 parent d0bb16b commit d2877a5
Show file tree
Hide file tree
Showing 77 changed files with 2,180 additions and 63 deletions.
3 changes: 3 additions & 0 deletions apps/frontend-v2/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
36 changes: 36 additions & 0 deletions apps/frontend-v2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
36 changes: 36 additions & 0 deletions apps/frontend-v2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
17 changes: 17 additions & 0 deletions apps/frontend-v2/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "src/app/globals.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
23 changes: 23 additions & 0 deletions apps/frontend-v2/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
webpack: {
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
issuer: {
test: /\.(js|ts)x?$/,
// for webpack 5 use
// { and: [/\.(js|ts)x?$/] }
},

use: ['@svgr/webpack'],
});
config.resolve.fallback = {
crypto: false,
http: require.resolve('stream-http'),
url: false,
https: require.resolve('https-browserify'),
};
return config;
},
},
};
50 changes: 50 additions & 0 deletions apps/frontend-v2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "frontend-v2",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@fuel-ts/contract": "^0.93.0",
"@fuels/connectors": "^0.25.0",
"@fuels/react": "^0.25.0",
"@pythnetwork/hermes-client": "^1.0.4",
"@pythnetwork/pyth-fuel-js": "^1.0.4",
"@radix-ui/react-slot": "^1.1.0",
"@svgr/webpack": "^6.5.1",
"@tanstack/react-query": "^5.51.21",
"@tanstack/react-query-devtools": "^5.51.11",
"@wagmi/core": "^2.13.3",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"fuels": "^0.93.0",
"dotenv": "^10.0.0",
"dotenv-expand": "^5.1.0",
"https-browserify": "^1.0.0",
"lucide-react": "^0.428.0",
"next": "14.2.5",
"next-themes": "^0.3.0",
"pino-pretty": "^11.2.2",
"react": "^18",
"react-dom": "^18",
"react-toastify": "^9.1.1",
"stream-http": "^3.2.0",
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7",
"zustand": "^4.5.5"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.5",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
}
8 changes: 8 additions & 0 deletions apps/frontend-v2/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
},
};

export default config;
1 change: 1 addition & 0 deletions apps/frontend-v2/public/next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/frontend-v2/public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/frontend-v2/src/app/favicon.ico
Binary file not shown.
69 changes: 69 additions & 0 deletions apps/frontend-v2/src/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%;
--popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%;
--primary: 222.2 47.4% 11.2%;
--primary-foreground: 210 40% 98%;
--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;
--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%;
--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
--ring: 222.2 84% 4.9%;
--radius: 0.5rem;
--chart-1: 12 76% 61%;
--chart-2: 173 58% 39%;
--chart-3: 197 37% 24%;
--chart-4: 43 74% 66%;
--chart-5: 27 87% 67%;
}

.dark {
--background: 205 16% 15%;
--foreground: 224 65% 93%;
--card: 198 15% 17%;
--card-foreground: 224 65% 93%;
--popover: 204 9% 11%;
--popover-foreground: 224 65% 93%;
--primary: 165 79% 58%;
--primary-foreground: 204 9% 11%;
--secondary: 7 100% 67%;
--secondary-foreground: 213 17% 23%;
--muted: 213 17% 23%;
--muted-foreground: 0 0% 35%;
--accent: 165 79% 58%;
--accent-foreground: 204 9% 11%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 40% 98%;
--border: 213 17% 23%;
--input: 217.2 32.6% 17.5%;
--ring: 213 17% 23%;
--chart-1: 220 70% 50%;
--chart-2: 160 60% 45%;
--chart-3: 30 80% 55%;
--chart-4: 280 65% 60%;
--chart-5: 340 75% 55%;
}
}

@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}
35 changes: 35 additions & 0 deletions apps/frontend-v2/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type { Metadata } from 'next';
import { Inter as FontSans } from 'next/font/google';
import './globals.css';

import { cn } from '@/lib/utils';
import { Providers } from '@/components/ui/Providers';

const fontSans = FontSans({
subsets: ['latin'],
variable: '--font-sans',
});

export const metadata: Metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
};

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body
className={cn(
'min-h-screen bg-background font-sans antialiased',
fontSans.variable
)}
>
<Providers>{children}</Providers>
</body>
</html>
);
}
49 changes: 49 additions & 0 deletions apps/frontend-v2/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use client';
import { Button } from '@/components/ui/button';
import {
useConnectUI,
useFuel,
useDisconnect,
useIsConnected,
useWallet,
useAccount,
useAccounts,
} from '@fuels/react';
import { toast } from 'react-toastify';
import { bn } from 'fuels';

export default function Home() {
const notify = () => toast('Wow so easy !');

const { connect, error, isError, theme, isConnecting } = useConnectUI();
const { fuel } = useFuel();
const { disconnect } = useDisconnect();
const { isConnected } = useIsConnected();
const { wallet } = useWallet();
const { account } = useAccount();
const { accounts } = useAccounts();

return (
<div className="flex justify-between">
<Button onClick={notify}>Toast</Button>
<div className="Actions">
{!isConnected && (
<Button
variant="default"
onClick={() => {
console.log('connect');
connect();
}}
>
{isConnecting ? 'Connecting' : 'Connect'}
</Button>
)}
{isConnected && (
<Button variant="ghost" onClick={() => disconnect()}>
{account}
</Button>
)}
</div>
</div>
);
}
Loading

0 comments on commit d2877a5

Please sign in to comment.