Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: New Wallet Connector UI #24

Merged
merged 27 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
de244a0
feat: unnused package removed
pedropereiradev Mar 29, 2024
f22a21a
feat: public assets created
pedropereiradev Mar 29, 2024
1d0cb6d
build: dependencies added and settings implemented
pedropereiradev Mar 29, 2024
7d9680c
feat: fonts created
pedropereiradev Mar 29, 2024
bbd5431
feat: tailwind css styles applied
pedropereiradev Mar 29, 2024
8eb2c5d
feat: counter contract implemented
pedropereiradev Mar 29, 2024
bb4d25c
feat: new wallet connect ui implemented
pedropereiradev Mar 29, 2024
d4298c4
fix: build your own wallet integration link changed
pedropereiradev Mar 29, 2024
14ba5c4
fix: fuel connector theme changed to dark
pedropereiradev Mar 29, 2024
47a65e4
fix: title when disconnected changed
pedropereiradev Mar 29, 2024
2279105
fix: fuel logo changed to remove text
pedropereiradev Mar 29, 2024
2e48b46
fix: add a limit height to avoid the icon changes the box size
pedropereiradev Mar 29, 2024
0ae9c31
fix: unused fonts removed
pedropereiradev Mar 30, 2024
664c806
fix: unused dependencies removed
pedropereiradev Mar 30, 2024
5ceec56
fix: get tab icon logo from local asset
pedropereiradev Mar 30, 2024
8e4910b
fix: fuels-wallet changed to use fuel react
pedropereiradev Mar 30, 2024
3c749b8
fix: change simulate to get method
luizstacio Mar 30, 2024
d0f1302
fix: eslint errors fixed
pedropereiradev Mar 30, 2024
c0d4836
feat: changeset created
pedropereiradev Mar 30, 2024
63d043e
fix: vscode folder removed
pedropereiradev Mar 30, 2024
ea1a0cd
Revert "fix: vscode folder removed"
pedropereiradev Mar 30, 2024
1629ede
fix: remove .vscode from react-app
pedropereiradev Mar 30, 2024
cdfe615
change: change defaultConnectors
luizstacio Mar 30, 2024
a1100f4
fix: lint errors in use effect fixed
pedropereiradev Mar 31, 2024
0eb1f7d
fix: image error when disconnected fixed
pedropereiradev Mar 31, 2024
70d8a35
chore: contracts folder added to ignore list
pedropereiradev Apr 1, 2024
58ca214
feat: fuel wallet development logo added
pedropereiradev Apr 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/smart-roses-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
19 changes: 0 additions & 19 deletions examples/nodejs/package.json

This file was deleted.

37 changes: 0 additions & 37 deletions examples/nodejs/src/index.ts

This file was deleted.

8 changes: 0 additions & 8 deletions examples/nodejs/tsconfig.json

This file was deleted.

11 changes: 0 additions & 11 deletions examples/nodejs/tsup.config.js

This file was deleted.

25 changes: 15 additions & 10 deletions examples/react-app/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Fuel Connectors</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

<head>
<link rel="icon" href="./logo.png" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Fuel enables developers to build integrations with any wallet." />
<title>Fuel Connectors</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
7 changes: 6 additions & 1 deletion examples/react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
"build": "vite build"
},
"dependencies": {
"@radix-ui/react-toast": "1.1.5",
"clsx": "2.1.0",
"fuels": "0.79.0",
"@fuels/connectors": "workspace:*",
"@fuels/react": "0.18.0",
"@tanstack/react-query": "5.28.8",
"fuels": "0.79.0",
"react": "18.2.0",
"react-dom": "18.2.0"
},
Expand All @@ -20,6 +22,9 @@
"@types/react": "18.2.71",
"@types/react-dom": "18.2.22",
"@vitejs/plugin-react": "4.2.1",
"tailwindcss": "3.4.1",
"autoprefixer": "10.4.19",
"postcss": "8.4.38",
"typescript": "5.4.3",
"vite": "5.2.6"
}
Expand Down
6 changes: 6 additions & 0 deletions examples/react-app/postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
14 changes: 14 additions & 0 deletions examples/react-app/public/Fuel_Logo_White_RGB.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions examples/react-app/public/connectors/fuel-wallet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/react-app/public/connectors/fuelet-dark.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 examples/react-app/public/logo.png
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 examples/react-app/public/logo_black.png
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 examples/react-app/public/logo_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/react-app/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
64 changes: 0 additions & 64 deletions examples/react-app/src/App.css

This file was deleted.

149 changes: 102 additions & 47 deletions examples/react-app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,55 +1,110 @@
import {
useAccounts,
useConnectUI,
useDisconnect,
useIsConnected,
} from '@fuels/react';
import './App.css';
import Account from './components/account';
import Balance from './components/balance';
import Button from './components/button';
import Counter from './components/counter';
import Transfer from './components/transfer';
import { useWallet } from './hooks/useWallet';

function App() {
const { connect, error, isError, theme, setTheme, isConnecting } =
useConnectUI();
const { disconnect } = useDisconnect();
const { isConnected } = useIsConnected();
const { accounts } = useAccounts();
const lightTheme = theme === 'light';
export default function App() {
const {
currentConnector,
isConnected,
isConnecting,
isLoading,
isFetching,
connect,
} = useWallet();

return (
<div className="App" data-theme={theme}>
<div className="Actions">
<button
type="button"
onClick={() => {
connect();
}}
<main
data-theme="dark"
className="flex items-center justify-center lg:h-screen dark:text-zinc-50/90"
>
<div id="container" className="mx-8 mb-32 w-full max-w-5xl lg:mb-0">
<nav
id="nav"
className="flex items-center justify-center py-6 lg:pb-10 lg:pt-0"
>
{isConnecting ? 'Connecting' : 'Connect'}
</button>
{isConnected && (
<button type="button" onClick={() => disconnect()}>
Disconnect
</button>
)}
<button
type="button"
onClick={() => setTheme(lightTheme ? 'dark' : 'light')}
>
{lightTheme ? '🌙' : '☀️'}
</button>
</div>
{isError && <p className="Error">{error?.message}</p>}
{isConnected && (
<div className="Accounts">
<h3>Connected accounts</h3>
{accounts?.map((account) => (
<div key={account}>
<b>Account:</b> {account}
<a href="https://fuel.network/" target="_blank" rel="noreferrer">
<img src="./logo_white.png" alt="Fuel Logo" className="w-[124px]" />
</a>
</nav>

<div className="gradient-border rounded-2xl">
<div className="grain rounded-2xl p-1.5 drop-shadow-xl">
<div
id="grid"
className="lg:grid lg:grid-cols-7 lg:grid-rows-1 lg:gap-12"
>
<div
id="text"
className="col-span-3 px-4 py-8 sm:px-8 sm:py-8 md:px-10 md:py-12"
>
<div className="flex h-20 items-end">
<img
src={currentConnector.logo}
alt={currentConnector.title}
className="w-20"
/>
</div>
<h1 className="pb-1 pt-6 text-3xl font-medium">
{currentConnector.title}
</h1>
<p>
Fuel enables developers to build integrations with any wallet.
</p>

<ul className="list-inside list-disc pt-8">
<li>Reduce friction for users</li>
<li>Build using any signature scheme</li>
<li>
Use predicates, a new type of stateless smart contract
</li>
</ul>
<a
href="https://github.com/FuelLabs/fuel-connectors"
target="_blank"
className="block pt-4 text-green-500/80 transition-colors hover:text-green-500"
rel="noreferrer"
>
Build your own wallet integration
</a>
</div>

<div className="col-span-4">
<div className="gradient-border h-full rounded-xl bg-gradient-to-b from-zinc-900 to-zinc-950/80">
{!isConnected && (
<section className="flex h-full flex-col items-center justify-center px-4 py-8 sm:px-8 sm:py-8 md:px-10 md:py-12">
<Button
onClick={connect}
loading={isConnecting}
loadingText="Connecting"
>
Connect Wallet
</Button>
</section>
)}

{(isLoading ?? isFetching) && (
<section className="flex h-full flex-col items-center justify-center px-4 py-8 sm:px-8 sm:py-8 md:px-10 md:py-12">
<p>Loading...</p>
</section>
)}

{isConnected && !isLoading && (
<section className="flex h-full flex-col justify-center space-y-6 px-4 py-8 sm:px-8 sm:py-8 md:px-10 md:py-12">
<Account />
<Balance />
<Counter />
<Transfer />
</section>
)}
</div>
</div>
</div>
))}
</div>
</div>
)}
</div>
</div>
</main>
);
}

export default App;
Loading
Loading