create-stylus 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +27 -0
- package/dist/cli.js.map +1 -1
- package/package.json +11 -2
- package/src/main.ts +11 -0
- package/src/tasks/config-to-sepolia.ts +25 -0
- package/src/tasks/index.ts +1 -0
- package/templates/base/package.json +10 -1
- package/templates/base/packages/nextjs/app/debug/_components/DebugContracts.tsx +15 -5
- package/templates/base/packages/nextjs/app/debug/_components/contract/ContractInput.tsx +3 -3
- package/templates/base/packages/nextjs/app/debug/_components/contract/ContractUI.tsx +103 -27
- package/templates/base/packages/nextjs/app/debug/_components/contract/DisplayVariable.tsx +15 -2
- package/templates/base/packages/nextjs/app/debug/_components/contract/ReadOnlyFunctionForm.tsx +11 -4
- package/templates/base/packages/nextjs/app/debug/_components/contract/TxReceipt.tsx +37 -21
- package/templates/base/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx +18 -16
- package/templates/base/packages/nextjs/app/layout.tsx +10 -4
- package/templates/base/packages/nextjs/components/AngularBorder.tsx +41 -0
- package/templates/base/packages/nextjs/components/Footer.tsx +153 -44
- package/templates/base/packages/nextjs/components/Header.tsx +73 -10
- package/templates/base/packages/nextjs/components/SwitchTheme.tsx +34 -3
- package/templates/base/packages/nextjs/components/scaffold-eth/Faucet.tsx +40 -5
- package/templates/base/packages/nextjs/components/scaffold-eth/Input/InputBase.tsx +1 -1
- package/templates/base/packages/nextjs/components/scaffold-eth/Input/IntegerInput.tsx +35 -25
- package/templates/base/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AngularWalletAddress.tsx +223 -0
- package/templates/base/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/index.tsx +2 -1
- package/templates/base/packages/nextjs/icons/EthIcon.tsx +28 -0
- package/templates/base/packages/nextjs/package.json +9 -0
- package/templates/base/packages/nextjs/public/logo.svg +20 -7
- package/templates/base/packages/nextjs/styles/globals.css +333 -2
- package/templates/base/packages/nextjs/tailwind.config.js +3 -2
- package/templates/base/packages/nextjs/utils/scaffold-stylus/supportedChains.ts +1 -1
- package/templates/base/packages/stylus/package.json +9 -0
- package/templates/base/packages/stylus/scripts/deploy_contract.ts +1 -0
- package/templates/base/packages/stylus/scripts/test_network.ts +6 -7
- package/templates/base/packages/stylus/scripts/utils/contract.ts +6 -2
- package/templates/base/packages/stylus/scripts/utils/deployment.ts +1 -0
- package/templates/base/packages/stylus/scripts/utils/network.ts +23 -5
- package/templates/base/yarn.lock +837 -849
|
@@ -1,42 +1,58 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
1
2
|
import { TransactionReceipt } from "viem";
|
|
2
|
-
import { CheckCircleIcon, DocumentDuplicateIcon } from "@heroicons/react/24/outline";
|
|
3
|
+
import { CheckCircleIcon, DocumentDuplicateIcon, ChevronUpIcon, ChevronDownIcon } from "@heroicons/react/24/outline";
|
|
3
4
|
import { ObjectFieldDisplay } from "~~/app/debug/_components/contract";
|
|
4
5
|
import { useCopyToClipboard } from "~~/hooks/scaffold-eth/useCopyToClipboard";
|
|
5
6
|
import { replacer } from "~~/utils/scaffold-eth/common";
|
|
6
7
|
|
|
7
8
|
export const TxReceipt = ({ txResult }: { txResult: TransactionReceipt }) => {
|
|
9
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
8
10
|
const { copyToClipboard: copyTxResultToClipboard, isCopiedToClipboard: isTxResultCopiedToClipboard } =
|
|
9
11
|
useCopyToClipboard();
|
|
10
12
|
|
|
11
13
|
return (
|
|
12
|
-
<div
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
<div
|
|
15
|
+
className="text-sm rounded-lg min-h-0 p-4"
|
|
16
|
+
style={{
|
|
17
|
+
background: "var(--bg-surface-input-20, rgba(255, 255, 255, 0.04))",
|
|
18
|
+
backdropFilter: "blur(25px)",
|
|
19
|
+
border: "none",
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
{/* Fixed Header */}
|
|
23
|
+
<div className="flex items-center">
|
|
24
|
+
<div className="flex items-center">
|
|
25
|
+
{isTxResultCopiedToClipboard ? (
|
|
26
|
+
<CheckCircleIcon
|
|
27
|
+
className="text-xl font-normal text-base-content h-5 w-5 cursor-pointer"
|
|
28
|
+
aria-hidden="true"
|
|
29
|
+
/>
|
|
30
|
+
) : (
|
|
31
|
+
<DocumentDuplicateIcon
|
|
32
|
+
className="text-xl font-normal h-5 w-5 cursor-pointer"
|
|
33
|
+
aria-hidden="true"
|
|
34
|
+
onClick={() => copyTxResultToClipboard(JSON.stringify(txResult, replacer, 2))}
|
|
35
|
+
/>
|
|
36
|
+
)}
|
|
37
|
+
</div>
|
|
38
|
+
<div className="flex-1 flex items-center pl-2">
|
|
30
39
|
<strong>Transaction Receipt</strong>
|
|
31
40
|
</div>
|
|
32
|
-
<div className="
|
|
41
|
+
<div className="cursor-pointer" onClick={() => setIsExpanded(!isExpanded)}>
|
|
42
|
+
{isExpanded ? <ChevronUpIcon className="h-5 w-5" /> : <ChevronDownIcon className="h-5 w-5" />}
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
{/* Collapsible Content */}
|
|
47
|
+
{isExpanded && (
|
|
48
|
+
<div className="overflow-auto rounded-t-none mt-2">
|
|
33
49
|
<pre className="text-xs">
|
|
34
50
|
{Object.entries(txResult).map(([k, v]) => (
|
|
35
51
|
<ObjectFieldDisplay name={k} value={v} size="xs" leftPad={false} key={k} />
|
|
36
52
|
))}
|
|
37
53
|
</pre>
|
|
38
54
|
</div>
|
|
39
|
-
|
|
55
|
+
)}
|
|
40
56
|
</div>
|
|
41
57
|
);
|
|
42
58
|
};
|
package/templates/base/packages/nextjs/app/debug/_components/contract/WriteOnlyFunctionForm.tsx
CHANGED
|
@@ -95,7 +95,7 @@ export const WriteOnlyFunctionForm = ({
|
|
|
95
95
|
return (
|
|
96
96
|
<div className="py-5 space-y-3 first:pt-0 last:pb-1">
|
|
97
97
|
<div className={`flex gap-3 ${zeroInputs ? "flex-row justify-between items-center" : "flex-col"}`}>
|
|
98
|
-
<p className="font-medium my-0 break-words">
|
|
98
|
+
<p className="font-medium my-0 break-words function-name">
|
|
99
99
|
{abiFunction.name}
|
|
100
100
|
<InheritanceTooltip inheritedFrom={inheritedFrom} />
|
|
101
101
|
</p>
|
|
@@ -104,7 +104,7 @@ export const WriteOnlyFunctionForm = ({
|
|
|
104
104
|
<div className="flex flex-col gap-1.5 w-full">
|
|
105
105
|
<div className="flex items-center ml-2">
|
|
106
106
|
<span className="text-xs font-medium mr-2 leading-none">payable value</span>
|
|
107
|
-
<span className="block text-xs font-extralight leading-none">wei</span>
|
|
107
|
+
<span className="block text-xs font-extralight leading-none param-type">wei</span>
|
|
108
108
|
</div>
|
|
109
109
|
<IntegerInput
|
|
110
110
|
value={txValue}
|
|
@@ -116,26 +116,28 @@ export const WriteOnlyFunctionForm = ({
|
|
|
116
116
|
/>
|
|
117
117
|
</div>
|
|
118
118
|
) : null}
|
|
119
|
-
<div className="flex
|
|
119
|
+
<div className="flex flex-col gap-2">
|
|
120
120
|
{!zeroInputs && (
|
|
121
|
-
<div className="
|
|
121
|
+
<div className="w-full">{displayedTxResult ? <TxReceipt txResult={displayedTxResult} /> : null}</div>
|
|
122
122
|
)}
|
|
123
|
-
<div
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
123
|
+
<div className="flex justify-end">
|
|
124
|
+
<div
|
|
125
|
+
className={`flex ${
|
|
126
|
+
writeDisabled &&
|
|
127
|
+
"tooltip tooltip-bottom tooltip-secondary before:content-[attr(data-tip)] before:-translate-x-1/3 before:left-auto before:transform-none"
|
|
128
|
+
}`}
|
|
129
|
+
data-tip={`${writeDisabled && "Wallet not connected or in the wrong network"}`}
|
|
130
|
+
>
|
|
131
|
+
<button className="send-button" disabled={writeDisabled || isPending} onClick={handleWrite}>
|
|
132
|
+
{isPending && <span className="loading loading-spinner loading-xs"></span>}
|
|
133
|
+
Send
|
|
134
|
+
</button>
|
|
135
|
+
</div>
|
|
134
136
|
</div>
|
|
135
137
|
</div>
|
|
136
138
|
</div>
|
|
137
139
|
{zeroInputs && txResult ? (
|
|
138
|
-
<div className="
|
|
140
|
+
<div className="w-full">
|
|
139
141
|
<TxReceipt txResult={txResult} />
|
|
140
142
|
</div>
|
|
141
143
|
) : null}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Inter, Orbitron } from "next/font/google";
|
|
2
2
|
import "@rainbow-me/rainbowkit/styles.css";
|
|
3
3
|
import { Metadata } from "next";
|
|
4
4
|
import { ScaffoldEthAppWithProviders } from "~~/components/ScaffoldEthAppWithProviders";
|
|
5
5
|
import { ThemeProvider } from "~~/components/ThemeProvider";
|
|
6
6
|
import "~~/styles/globals.css";
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const inter = Inter({
|
|
9
9
|
subsets: ["latin"],
|
|
10
|
-
variable: "--font-
|
|
10
|
+
variable: "--font-inter",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const orbitron = Orbitron({
|
|
14
|
+
subsets: ["latin"],
|
|
15
|
+
variable: "--font-orbitron",
|
|
16
|
+
weight: ["400", "700", "900"],
|
|
11
17
|
});
|
|
12
18
|
|
|
13
19
|
const baseUrl = process.env.VERCEL_URL
|
|
@@ -55,7 +61,7 @@ export const metadata: Metadata = {
|
|
|
55
61
|
const ScaffoldEthApp = ({ children }: { children: React.ReactNode }) => {
|
|
56
62
|
return (
|
|
57
63
|
<html suppressHydrationWarning>
|
|
58
|
-
<body className={`${
|
|
64
|
+
<body className={`${inter.variable} ${orbitron.variable} font-sans`} suppressHydrationWarning>
|
|
59
65
|
<ThemeProvider>
|
|
60
66
|
<ScaffoldEthAppWithProviders>{children}</ScaffoldEthAppWithProviders>
|
|
61
67
|
</ThemeProvider>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
interface AngularBorderProps {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const AngularBorder: React.FC<AngularBorderProps> = ({
|
|
12
|
+
width,
|
|
13
|
+
height,
|
|
14
|
+
color = "#FD0077",
|
|
15
|
+
className = "",
|
|
16
|
+
style = {},
|
|
17
|
+
}) => {
|
|
18
|
+
return (
|
|
19
|
+
<svg
|
|
20
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
21
|
+
width={width}
|
|
22
|
+
height={height}
|
|
23
|
+
viewBox={`0 0 ${width} ${height}`}
|
|
24
|
+
fill="none"
|
|
25
|
+
className={className}
|
|
26
|
+
style={{
|
|
27
|
+
position: "absolute",
|
|
28
|
+
top: "-3px",
|
|
29
|
+
left: 0,
|
|
30
|
+
pointerEvents: "none",
|
|
31
|
+
...style,
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<path
|
|
35
|
+
d={`M${width - 20}.132 0.5L${width - 1}.5 ${height / 2}.2109V${height - 1}.5H19.0811L0.5 ${height / 2}.7871V0.5H${width - 20}.132Z`}
|
|
36
|
+
stroke={color}
|
|
37
|
+
strokeWidth="1"
|
|
38
|
+
/>
|
|
39
|
+
</svg>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
2
|
import Link from "next/link";
|
|
3
3
|
import { useTheme } from "next-themes";
|
|
4
|
-
import {
|
|
4
|
+
import { MagnifyingGlassIcon } from "@heroicons/react/24/outline";
|
|
5
5
|
//import { HeartIcon } from "@heroicons/react/24/outline";
|
|
6
6
|
//import { BuidlGuidlLogo } from "~~/components/assets/BuidlGuidlLogo";
|
|
7
|
+
import { AngularBorder } from "~~/components/AngularBorder";
|
|
7
8
|
import { Faucet } from "~~/components/scaffold-eth";
|
|
8
9
|
import { useTargetNetwork } from "~~/hooks/scaffold-eth/useTargetNetwork";
|
|
9
10
|
import { useGlobalState } from "~~/services/store/store";
|
|
10
11
|
import { arbitrumNitro } from "~~/utils/scaffold-stylus/supportedChains";
|
|
12
|
+
import EthIcon from "~~/icons/EthIcon";
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Site footer
|
|
@@ -33,60 +35,167 @@ export const Footer = () => {
|
|
|
33
35
|
<div className="fixed flex justify-between items-center w-full z-10 p-4 bottom-0 left-0 pointer-events-none">
|
|
34
36
|
<div className="flex flex-col md:flex-row gap-2 pointer-events-auto">
|
|
35
37
|
{nativeCurrencyPrice > 0 && (
|
|
36
|
-
<div>
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
<div className="relative">
|
|
39
|
+
<AngularBorder width={140} height={40} color="rgba(227, 6, 110, 1)" />
|
|
40
|
+
<div
|
|
41
|
+
className="flex items-center gap-2 px-6 cursor-auto rounded-lg"
|
|
42
|
+
style={{
|
|
43
|
+
width: "140px",
|
|
44
|
+
height: "40px",
|
|
45
|
+
display: "flex",
|
|
46
|
+
alignItems: "flex-start",
|
|
47
|
+
paddingTop: "6px",
|
|
48
|
+
position: "relative",
|
|
49
|
+
zIndex: 1,
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<EthIcon width={20} height={20} />
|
|
53
|
+
<span
|
|
54
|
+
style={{
|
|
55
|
+
fontFamily: "Orbitron, sans-serif",
|
|
56
|
+
fontSize: "13px",
|
|
57
|
+
fontWeight: 700,
|
|
58
|
+
textTransform: "uppercase",
|
|
59
|
+
whiteSpace: "nowrap",
|
|
60
|
+
overflow: "hidden",
|
|
61
|
+
textOverflow: "ellipsis",
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
{nativeCurrencyPrice.toFixed(2)}
|
|
65
|
+
</span>
|
|
40
66
|
</div>
|
|
41
67
|
</div>
|
|
42
68
|
)}
|
|
43
69
|
{isLocalNetwork && (
|
|
44
70
|
<>
|
|
45
71
|
<Faucet />
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
72
|
+
<div className="relative">
|
|
73
|
+
<AngularBorder width={210} height={40} color="rgba(227, 6, 110, 1)" />
|
|
74
|
+
<Link
|
|
75
|
+
href="/blockexplorer"
|
|
76
|
+
passHref
|
|
77
|
+
className="flex items-center gap-2 px-4 py-2 rounded-lg"
|
|
78
|
+
style={{
|
|
79
|
+
width: "210px",
|
|
80
|
+
height: "40px",
|
|
81
|
+
display: "flex",
|
|
82
|
+
alignItems: "flex-start",
|
|
83
|
+
paddingTop: "8px",
|
|
84
|
+
position: "relative",
|
|
85
|
+
zIndex: 1,
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
<MagnifyingGlassIcon className="h-4 w-4" style={{ color: "rgba(227, 6, 110, 1)" }} />
|
|
89
|
+
<span
|
|
90
|
+
style={{
|
|
91
|
+
color: isDarkMode ? "#FFF" : "black",
|
|
92
|
+
fontFamily: "Orbitron, sans-serif",
|
|
93
|
+
fontSize: "14px",
|
|
94
|
+
fontWeight: 700,
|
|
95
|
+
textTransform: "uppercase",
|
|
96
|
+
whiteSpace: "nowrap",
|
|
97
|
+
overflow: "hidden",
|
|
98
|
+
textOverflow: "ellipsis",
|
|
99
|
+
}}
|
|
100
|
+
>
|
|
101
|
+
Block Explorer
|
|
102
|
+
</span>
|
|
103
|
+
</Link>
|
|
104
|
+
</div>
|
|
54
105
|
</>
|
|
55
106
|
)}
|
|
56
107
|
</div>
|
|
57
108
|
</div>
|
|
58
109
|
</div>
|
|
59
|
-
<div className="w-full">
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
110
|
+
<div className="w-full flex justify-end">
|
|
111
|
+
<div className="flex gap-2">
|
|
112
|
+
{/* Fork me button */}
|
|
113
|
+
<a
|
|
114
|
+
href="https://github.com/Arb-Stylus/scaffold-stylus"
|
|
115
|
+
target="_blank"
|
|
116
|
+
rel="noreferrer"
|
|
117
|
+
className="flex items-center gap-2 px-4 py-2 rounded-2xl border"
|
|
118
|
+
style={{
|
|
119
|
+
width: "120px",
|
|
120
|
+
height: "32px",
|
|
121
|
+
display: "flex",
|
|
122
|
+
alignItems: "center",
|
|
123
|
+
justifyContent: "center",
|
|
124
|
+
borderColor: isDarkMode ? "#353535" : "rgba(0, 0, 0, 0.1)",
|
|
125
|
+
backgroundColor: isDarkMode ? "transparent" : "rgba(0, 0, 0, 0.04)",
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
<svg
|
|
129
|
+
width="16"
|
|
130
|
+
height="16"
|
|
131
|
+
viewBox="0 0 24 24"
|
|
132
|
+
fill="none"
|
|
133
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
134
|
+
style={{ color: isDarkMode ? "#FFF" : "rgba(227, 6, 110, 1)" }}
|
|
135
|
+
>
|
|
136
|
+
<path
|
|
137
|
+
d="M12 0C5.374 0 0 5.373 0 12 0 17.302 3.438 21.8 8.207 23.387c.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z"
|
|
138
|
+
fill="currentColor"
|
|
139
|
+
/>
|
|
140
|
+
</svg>
|
|
141
|
+
<span
|
|
142
|
+
style={{
|
|
143
|
+
color: isDarkMode ? "#FFF" : "black",
|
|
144
|
+
fontFamily: "Inter, sans-serif",
|
|
145
|
+
fontSize: "12px",
|
|
146
|
+
fontWeight: 500,
|
|
147
|
+
textTransform: "uppercase",
|
|
148
|
+
whiteSpace: "nowrap",
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
151
|
+
Fork me
|
|
152
|
+
</span>
|
|
153
|
+
</a>
|
|
154
|
+
|
|
155
|
+
{/* Support button */}
|
|
156
|
+
<a
|
|
157
|
+
href="https://t.me/arbitrum_stylus"
|
|
158
|
+
target="_blank"
|
|
159
|
+
rel="noreferrer"
|
|
160
|
+
className="flex items-center gap-2 px-4 py-2 rounded-2xl border"
|
|
161
|
+
style={{
|
|
162
|
+
width: "120px",
|
|
163
|
+
height: "32px",
|
|
164
|
+
display: "flex",
|
|
165
|
+
alignItems: "center",
|
|
166
|
+
justifyContent: "center",
|
|
167
|
+
borderColor: isDarkMode ? "#353535" : "rgba(0, 0, 0, 0.1)",
|
|
168
|
+
backgroundColor: isDarkMode ? "transparent" : "rgba(0, 0, 0, 0.04)",
|
|
169
|
+
}}
|
|
170
|
+
>
|
|
171
|
+
<svg
|
|
172
|
+
width="18"
|
|
173
|
+
height="18"
|
|
174
|
+
viewBox="0 0 18 18"
|
|
175
|
+
fill="none"
|
|
176
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
177
|
+
style={{ color: isDarkMode ? "#FFF" : "rgba(227, 6, 110, 1)" }}
|
|
178
|
+
>
|
|
179
|
+
<path
|
|
180
|
+
d="M8.99987 0.144531C5.52104 0.144531 2.58863 2.52009 2.01657 5.68428H1.50821C0.752731 5.68428 0.144531 6.2925 0.144531 7.048V10.9528C0.144531 11.7083 0.752731 12.3165 1.50821 12.3165H2.16195C2.91743 12.3165 3.52563 11.7083 3.52563 10.9528V6.8144C3.52563 4.02827 5.92511 1.75454 9.0005 1.75454C12.076 1.75454 14.4754 4.02827 14.4754 6.8144V11.1864C14.4754 13.9725 12.076 16.2454 9.0005 16.2454C8.55585 16.2454 8.19544 16.606 8.19551 17.0506C8.19556 17.4952 8.55592 17.8556 9.0005 17.8556C12.4794 17.8556 15.4117 15.4806 15.9838 12.3165H16.492C17.2475 12.3165 17.8556 11.7083 17.8556 10.9528V7.048C17.8556 6.2925 17.2475 5.68428 16.492 5.68428H15.9838C15.4117 2.52009 12.4794 0.144531 9.0005 0.144531H8.99987ZM7.47643 11.8637C7.02965 11.8637 6.65446 12.2387 6.80565 12.6568C7.13012 13.5546 7.98997 14.1963 8.99967 14.1963C10.0094 14.1963 10.8694 13.5546 11.1939 12.6568C11.345 12.2387 10.9699 11.8637 10.5231 11.8637H7.47643Z"
|
|
181
|
+
fill="currentColor"
|
|
182
|
+
/>
|
|
183
|
+
</svg>
|
|
184
|
+
|
|
185
|
+
<span
|
|
186
|
+
style={{
|
|
187
|
+
color: isDarkMode ? "#FFF" : "black",
|
|
188
|
+
fontFamily: "Inter, sans-serif",
|
|
189
|
+
fontSize: "12px",
|
|
190
|
+
fontWeight: 500,
|
|
191
|
+
textTransform: "uppercase",
|
|
192
|
+
whiteSpace: "nowrap",
|
|
193
|
+
}}
|
|
194
|
+
>
|
|
195
|
+
Support
|
|
196
|
+
</span>
|
|
197
|
+
</a>
|
|
198
|
+
</div>
|
|
90
199
|
</div>
|
|
91
200
|
</div>
|
|
92
201
|
);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import React, { useCallback, useRef, useState } from "react";
|
|
3
|
+
import React, { useCallback, useRef, useState, useMemo } from "react";
|
|
4
4
|
import Image from "next/image";
|
|
5
5
|
import Link from "next/link";
|
|
6
6
|
import { usePathname } from "next/navigation";
|
|
7
|
+
import { useTheme } from "next-themes";
|
|
7
8
|
import { SwitchTheme } from "./SwitchTheme";
|
|
8
|
-
import { Bars3Icon
|
|
9
|
+
import { Bars3Icon } from "@heroicons/react/24/outline";
|
|
9
10
|
import { RainbowKitCustomConnectButton } from "~~/components/scaffold-eth";
|
|
10
11
|
import { useOutsideClick, useTargetNetwork } from "~~/hooks/scaffold-eth";
|
|
11
12
|
import { arbitrumNitro } from "~~/utils/scaffold-stylus/supportedChains";
|
|
@@ -24,25 +25,46 @@ export const menuLinks: HeaderMenuLink[] = [
|
|
|
24
25
|
{
|
|
25
26
|
label: "Debug Contracts",
|
|
26
27
|
href: "/debug",
|
|
27
|
-
icon: <BugAntIcon className="h-4 w-4" />,
|
|
28
|
+
// icon: <BugAntIcon className="h-4 w-4" />,
|
|
28
29
|
},
|
|
29
30
|
];
|
|
30
31
|
|
|
31
32
|
export const HeaderMenuLinks = () => {
|
|
32
33
|
const pathname = usePathname();
|
|
34
|
+
const { resolvedTheme } = useTheme();
|
|
35
|
+
const isDarkMode = useMemo(() => resolvedTheme === "dark", [resolvedTheme]);
|
|
33
36
|
|
|
34
37
|
return (
|
|
35
38
|
<>
|
|
36
39
|
{menuLinks.map(({ label, href, icon }) => {
|
|
37
40
|
const isActive = pathname === href;
|
|
41
|
+
|
|
38
42
|
return (
|
|
39
43
|
<li key={href}>
|
|
40
44
|
<Link
|
|
41
45
|
href={href}
|
|
42
46
|
passHref
|
|
43
47
|
className={`${
|
|
44
|
-
isActive ? "
|
|
48
|
+
isActive ? "shadow-md" : ""
|
|
45
49
|
} hover:bg-secondary hover:shadow-md focus:!bg-secondary active:!text-neutral py-1.5 px-3 text-sm rounded-full gap-2 grid grid-flow-col`}
|
|
50
|
+
style={{
|
|
51
|
+
color: isActive
|
|
52
|
+
? isDarkMode
|
|
53
|
+
? "#2B2B2B"
|
|
54
|
+
: "black"
|
|
55
|
+
: isDarkMode
|
|
56
|
+
? "var(--text-sub-600, rgba(255, 255, 255, 0.60))"
|
|
57
|
+
: "black",
|
|
58
|
+
fontFamily: "Orbitron, sans-serif",
|
|
59
|
+
fontSize: "14px",
|
|
60
|
+
fontWeight: 700,
|
|
61
|
+
letterSpacing: "-0.28px",
|
|
62
|
+
textTransform: "uppercase",
|
|
63
|
+
background: isActive ? "linear-gradient(180deg, #FFF 18.79%, #D5D5D5 100%)" : undefined,
|
|
64
|
+
borderBottom: isActive ? "2px solid #ABABAB" : undefined,
|
|
65
|
+
borderRadius: isActive ? "8px" : undefined,
|
|
66
|
+
padding: isActive ? "8px 16px" : undefined,
|
|
67
|
+
}}
|
|
46
68
|
>
|
|
47
69
|
{icon}
|
|
48
70
|
<span>{label}</span>
|
|
@@ -61,6 +83,8 @@ export const Header = () => {
|
|
|
61
83
|
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
|
|
62
84
|
const burgerMenuRef = useRef<HTMLDivElement>(null);
|
|
63
85
|
const { targetNetwork } = useTargetNetwork();
|
|
86
|
+
const { resolvedTheme } = useTheme();
|
|
87
|
+
const isDarkMode = useMemo(() => resolvedTheme === "dark", [resolvedTheme]);
|
|
64
88
|
const isLocalNetwork = targetNetwork?.id === arbitrumNitro.id;
|
|
65
89
|
useOutsideClick(
|
|
66
90
|
burgerMenuRef,
|
|
@@ -68,7 +92,18 @@ export const Header = () => {
|
|
|
68
92
|
);
|
|
69
93
|
|
|
70
94
|
return (
|
|
71
|
-
<div
|
|
95
|
+
<div
|
|
96
|
+
className="sticky lg:static top-0 navbar min-h-0 flex-shrink-0 justify-between z-20 px-0 sm:px-2"
|
|
97
|
+
style={{
|
|
98
|
+
display: "flex",
|
|
99
|
+
// height: "46px",
|
|
100
|
+
padding: "12px var(--spacing-2xl, 16px)",
|
|
101
|
+
justifyContent: "center",
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
gap: "var(--spacing-md, 8px)",
|
|
104
|
+
alignSelf: "stretch",
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
72
107
|
<div className="navbar-start w-auto lg:w-1/2">
|
|
73
108
|
<div className="lg:hidden dropdown" ref={burgerMenuRef}>
|
|
74
109
|
<label
|
|
@@ -93,20 +128,48 @@ export const Header = () => {
|
|
|
93
128
|
)}
|
|
94
129
|
</div>
|
|
95
130
|
<Link href="/" passHref className="hidden lg:flex items-center gap-2 ml-4 mr-6 shrink-0">
|
|
96
|
-
<div className="flex relative w-
|
|
97
|
-
<Image alt="
|
|
131
|
+
<div className="flex relative w-12 h-12">
|
|
132
|
+
<Image alt="Scaffold Stylus logo" className="cursor-pointer" fill src="/logo.svg" />
|
|
98
133
|
</div>
|
|
99
134
|
<div className="flex flex-col">
|
|
100
|
-
<span
|
|
101
|
-
|
|
135
|
+
<span
|
|
136
|
+
style={{
|
|
137
|
+
color: isDarkMode ? "#FFF" : "black",
|
|
138
|
+
fontFamily: "Orbitron, sans-serif",
|
|
139
|
+
fontSize: "16px",
|
|
140
|
+
fontWeight: 700,
|
|
141
|
+
lineHeight: "normal",
|
|
142
|
+
letterSpacing: "-0.32px",
|
|
143
|
+
textTransform: "uppercase",
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
SCAFFOLD STYLUS
|
|
147
|
+
</span>
|
|
148
|
+
<span
|
|
149
|
+
style={{
|
|
150
|
+
color: isDarkMode ? "#FFF" : "black",
|
|
151
|
+
fontFamily: "Inter, sans-serif",
|
|
152
|
+
fontSize: "12px",
|
|
153
|
+
fontWeight: 600,
|
|
154
|
+
lineHeight: "20px",
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
Arbitrum dev stack
|
|
158
|
+
</span>
|
|
102
159
|
</div>
|
|
103
160
|
</Link>
|
|
104
161
|
<ul className="hidden lg:flex lg:flex-nowrap menu menu-horizontal px-1 gap-2">
|
|
105
162
|
<HeaderMenuLinks />
|
|
106
163
|
</ul>
|
|
107
164
|
</div>
|
|
108
|
-
<div className="flex gap-4 navbar-end flex-grow mr-4">
|
|
165
|
+
<div className="flex items-center gap-4 navbar-end flex-grow mr-4">
|
|
109
166
|
<RainbowKitCustomConnectButton />
|
|
167
|
+
<div
|
|
168
|
+
className="h-6 w-px opacity-20"
|
|
169
|
+
style={{
|
|
170
|
+
backgroundColor: isDarkMode ? "white" : "black",
|
|
171
|
+
}}
|
|
172
|
+
></div>
|
|
110
173
|
<SwitchTheme className={`pointer-events-auto ${isLocalNetwork ? "self-end md:self-auto" : ""}`} />
|
|
111
174
|
</div>
|
|
112
175
|
</div>
|
|
@@ -25,15 +25,46 @@ export const SwitchTheme = ({ className }: { className?: string }) => {
|
|
|
25
25
|
if (!mounted) return null;
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
|
-
<div className={`flex space-x-2 h-5 items-center justify-center text-sm
|
|
28
|
+
<div className={`flex space-x-2 h-5 items-center justify-center text-sm px-4 ${className}`}>
|
|
29
29
|
{
|
|
30
30
|
<label
|
|
31
31
|
htmlFor="theme-toggle"
|
|
32
32
|
className={`swap swap-rotate ${!isDarkMode ? "swap-active" : ""}`}
|
|
33
33
|
onClick={handleToggle}
|
|
34
|
+
style={{
|
|
35
|
+
width: "44px",
|
|
36
|
+
height: "44px",
|
|
37
|
+
aspectRatio: "1/1",
|
|
38
|
+
display: "flex",
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
justifyContent: "center",
|
|
41
|
+
cursor: "pointer",
|
|
42
|
+
borderRadius: "50%",
|
|
43
|
+
background: isDarkMode ? "rgba(25, 144, 196, 0.30)" : "rgba(227, 6, 110, 0.30)",
|
|
44
|
+
border: isDarkMode ? "1px solid #30B4ED" : "1px solid rgba(227, 6, 110, 1)",
|
|
45
|
+
position: "relative",
|
|
46
|
+
}}
|
|
34
47
|
>
|
|
35
|
-
<SunIcon
|
|
36
|
-
|
|
48
|
+
<SunIcon
|
|
49
|
+
className="swap-on h-5 w-5"
|
|
50
|
+
style={{
|
|
51
|
+
color: isDarkMode ? "#30B4ED" : "rgba(227, 6, 110, 1)",
|
|
52
|
+
position: "absolute",
|
|
53
|
+
top: "50%",
|
|
54
|
+
left: "50%",
|
|
55
|
+
transform: "translate(-50%, -50%)",
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
58
|
+
<MoonIcon
|
|
59
|
+
className="swap-off h-5 w-5"
|
|
60
|
+
style={{
|
|
61
|
+
color: "#30B4ED",
|
|
62
|
+
position: "absolute",
|
|
63
|
+
top: "50%",
|
|
64
|
+
left: "50%",
|
|
65
|
+
transform: "translate(-50%, -50%)",
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
37
68
|
</label>
|
|
38
69
|
}
|
|
39
70
|
</div>
|