Skip to content

Commit 41c29f3

Browse files
committed
merge main
2 parents dc21aaa + fd23bc5 commit 41c29f3

File tree

6 files changed

+32
-8
lines changed

6 files changed

+32
-8
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"typedoc": "^0.26.7",
6868
"viem": "2.23.12",
6969
"vite-plugin-dts": "^4.2.1",
70-
"wagmi": "^2.14.1",
70+
"wagmi": "^2.14.6",
7171
"zustand": "^5.0.0-rc.2"
7272
},
7373
"devDependencies": {

src/components/dapp/TransactionButton.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export type TransactionButtonProps = ButtonProps & {
1919
onExecute?: (hash: string) => void;
2020
onSuccess?: (hash: string) => void;
2121
onError?: (hash: string) => void;
22+
onClick?: () => void;
2223
};
2324

2425
export default function TransactionButton({
@@ -27,6 +28,7 @@ export default function TransactionButton({
2728
children,
2829
onExecute,
2930
onSuccess,
31+
onClick,
3032
enableSponsorCheckbox,
3133
iconProps,
3234
onError,
@@ -44,6 +46,7 @@ export default function TransactionButton({
4446
const execute = useCallback(async () => {
4547
if (!tx || !user || !client) return;
4648

49+
onClick?.();
4750
const notification = new Notifier({
4851
title: name,
4952
subtitle: "Sign transaction in your wallet",
@@ -137,7 +140,7 @@ export default function TransactionButton({
137140
loading: false,
138141
});
139142
}
140-
}, [tx, client, user, sendTransaction, onExecute, onSuccess, onError, name]);
143+
}, [tx, client, user, sendTransaction, onExecute, onSuccess, onError, name, onClick]);
141144

142145
//TODO: remove hardcoded chainId check in favor of more integrated and generic implem
143146
if (enableSponsorCheckbox && chainId === 324)

src/components/extenders/Dropdown.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export type DropdownProps = Component<
1313
state?: GetSet<boolean>;
1414
content?: ReactNode;
1515
onHover?: boolean;
16+
onOpen?: () => void;
1617
children?: ReactNode;
1718
},
1819
HTMLButtonElement
@@ -23,6 +24,7 @@ export default function Dropdown({
2324
state,
2425
padding,
2526
content,
27+
onOpen,
2628
children,
2729
className,
2830
onHover = false,
@@ -72,7 +74,12 @@ export default function Dropdown({
7274

7375
return (
7476
<EventBlocker>
75-
<Popover.Root open={!state ? internalState : state?.[0]} onOpenChange={!state ? setInternalState : state?.[1]}>
77+
<Popover.Root
78+
open={!state ? internalState : state?.[0]}
79+
onOpenChange={o => {
80+
onOpen?.();
81+
return !state ? setInternalState(o) : state?.[1]?.(o);
82+
}}>
7683
<Popover.Trigger
7784
className={className}
7885
onClick={toggle}

src/components/extenders/Select.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export type SelectProps<Value> = Component<{
138138
displayOptions?: { [key: string | number | symbol]: ReactNode };
139139
searchOptions?: { [key: string | number | symbol]: ReactNode };
140140
indexOptions?: { [key: string | number | symbol]: number };
141+
onOpen?: () => void;
141142
error?: ReactNode;
142143
}> &
143144
RadixSelect.SelectProps;
@@ -162,6 +163,7 @@ export default function Select<
162163
loading,
163164
allOption,
164165
placeholder,
166+
onOpen,
165167
className,
166168
defaultValue,
167169
error,
@@ -260,7 +262,7 @@ export default function Select<
260262
setValue={value => {
261263
setSearch(value);
262264
}}
263-
>
265+
setOpen={o => o && onOpen?.()}>
264266
<Ariakit.SelectProvider
265267
setValue={v => setValue(v as Value)}
266268
value={value as string}

src/components/primitives/Button.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export type ButtonProps = Component<
4545
external?: boolean;
4646
className?: string;
4747
type?: "button" | "submit" | "reset";
48+
onLink?: () => void;
4849
bold?: boolean;
4950
disabled?: boolean;
5051
},
@@ -59,6 +60,7 @@ export default function Button({
5960
theme,
6061
className,
6162
bold,
63+
onLink,
6264
children,
6365
external,
6466
disabled,
@@ -76,7 +78,10 @@ export default function Button({
7678
rel="noopener noreferrer"
7779
aria-disabled={disabled}
7880
tabIndex={disabled ? -1 : undefined}
79-
onClick={() => window.open(to, "_blank", "noopener noreferrer")}
81+
onClick={() => {
82+
onLink?.();
83+
return window.open(to, "_blank", "noopener noreferrer");
84+
}}
8085
className={mergeClass(styleProps, styleBold, className, disabled && "disabled")}>
8186
{children}
8287
</a>
@@ -88,6 +93,9 @@ export default function Button({
8893
<Link
8994
prefetch="intent"
9095
to={to}
96+
onClick={() => {
97+
onLink?.();
98+
}}
9199
aria-disabled={disabled}
92100
tabIndex={disabled ? -1 : undefined}
93101
className={mergeClass(styleProps, styleBold, className, disabled && "disabled")}

src/components/primitives/Tooltip.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { useState, useEffect } from "react";
21
import * as RadixTooltip from "@radix-ui/react-tooltip";
2+
import { useEffect, useState } from "react";
33
import { useTheme } from "../../context/Theme.context";
44
import type { Component } from "../../utils/types";
55
import Text from "../primitives/Text";
@@ -9,9 +9,10 @@ export type TooltipProps = Component<{
99
helper: string | React.ReactNode;
1010
icon?: boolean;
1111
className?: string;
12+
onOpen?: () => void;
1213
}>;
1314

14-
export default function Tooltip({ helper, children, icon = true, className }: TooltipProps) {
15+
export default function Tooltip({ helper, onOpen, children, icon = true, className }: TooltipProps) {
1516
const { vars } = useTheme();
1617
const [open, setOpen] = useState(false);
1718
const [isTouchDevice, setIsTouchDevice] = useState(false);
@@ -25,7 +26,10 @@ export default function Tooltip({ helper, children, icon = true, className }: To
2526
<RadixTooltip.Provider delayDuration={0}>
2627
<RadixTooltip.Root
2728
open={isTouchDevice ? open : undefined}
28-
onOpenChange={isTouchDevice ? setOpen : undefined}
29+
onOpenChange={isOpen => {
30+
if (isTouchDevice) setOpen(isOpen);
31+
if (isOpen) onOpen?.();
32+
}}
2933
delayDuration={0}>
3034
<RadixTooltip.Trigger asChild>
3135
{/* biome-ignore lint/a11y/useKeyWithClickEvents: <explanation> */}

0 commit comments

Comments
 (0)