Skip to content

Commit 0497242

Browse files
committed
Merge branch 'main' into feat/track-transactions
2 parents c4b23a7 + 1a45f21 commit 0497242

File tree

85 files changed

+1789
-1026
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1789
-1026
lines changed

apps/dashboard/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
"react-day-picker": "^8.10.1",
8686
"react-dom": "18.3.1",
8787
"react-dropzone": "^14.2.9",
88+
"react-error-boundary": "^4.1.2",
8889
"react-hook-form": "7.52.0",
8990
"react-intersection-observer": "^9.10.3",
9091
"react-markdown": "^9.0.1",
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { CopyTextButton } from "@/components/ui/CopyTextButton";
2+
import { ScrollShadow } from "@/components/ui/ScrollShadow/ScrollShadow";
3+
import { useMemo } from "react";
4+
5+
export function UnexpectedValueErrorMessage(props: {
6+
value: unknown;
7+
title: string;
8+
description: string;
9+
className?: string;
10+
}) {
11+
const stringifiedValue = useMemo(() => {
12+
try {
13+
return JSON.stringify(props.value, null, 2);
14+
} catch {
15+
return undefined;
16+
}
17+
}, [props.value]);
18+
19+
return (
20+
<div className={props.className}>
21+
<p className="text-base text-destructive-text"> {props.title} </p>
22+
<p className="text-foreground text-sm">{props.description}</p>
23+
{stringifiedValue && (
24+
<div className="mt-3">
25+
<p className="mb-0.5 text-muted-foreground text-sm">Value Received</p>
26+
<ScrollShadow className="rounded-lg bg-muted/50">
27+
<code className="block whitespace-pre p-4 font-mono text-xs">
28+
{stringifiedValue}
29+
</code>
30+
</ScrollShadow>
31+
32+
<CopyTextButton
33+
copyIconPosition="left"
34+
textToShow="Copy value"
35+
textToCopy={stringifiedValue}
36+
tooltip="Copy value"
37+
className="-translate-x-2 mt-1 text-muted-foreground"
38+
variant="ghost"
39+
/>
40+
</div>
41+
)}
42+
</div>
43+
);
44+
}

apps/dashboard/src/@/components/blocks/multi-select.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,18 @@ export const MultiSelect = forwardRef<HTMLButtonElement, MultiSelectProps>(
119119
if (filteredOptions.length >= itemsToShow) {
120120
break;
121121
}
122+
const option = options[i];
123+
if (!option) {
124+
continue;
125+
}
126+
122127
if (overrideSearchFn) {
123-
if (overrideSearchFn(options[i], searchValLowercase)) {
124-
filteredOptions.push(options[i]);
128+
if (overrideSearchFn(option, searchValLowercase)) {
129+
filteredOptions.push(option);
125130
}
126131
} else {
127-
if (options[i].label.toLowerCase().includes(searchValLowercase)) {
128-
filteredOptions.push(options[i]);
132+
if (option.label.toLowerCase().includes(searchValLowercase)) {
133+
filteredOptions.push(option);
129134
}
130135
}
131136
}

apps/dashboard/src/@/components/blocks/select-with-search.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,18 @@ export const SelectWithSearch = React.forwardRef<
6363
if (filteredOptions.length >= itemsToShow) {
6464
break;
6565
}
66+
const option = options[i];
67+
if (!option) {
68+
continue;
69+
}
6670

6771
if (overrideSearchFn) {
68-
if (overrideSearchFn(options[i], searchValLowercase)) {
69-
filteredOptions.push(options[i]);
72+
if (overrideSearchFn(option, searchValLowercase)) {
73+
filteredOptions.push(option);
7074
}
7175
} else {
72-
if (options[i].label.toLowerCase().includes(searchValLowercase)) {
73-
filteredOptions.push(options[i]);
76+
if (option.label.toLowerCase().includes(searchValLowercase)) {
77+
filteredOptions.push(option);
7478
}
7579
}
7680
}

apps/dashboard/src/@/components/ui/chart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const ChartTooltipContent = React.forwardRef<
143143
}
144144

145145
const [item] = payload;
146-
const key = `${labelKey || item.dataKey || item.name || "value"}`;
146+
const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
147147
const itemConfig = getPayloadConfigFromPayload(config, item, key);
148148
const value =
149149
!labelKey && typeof label === "string"

apps/dashboard/src/@/components/ui/image-upload.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ const ImageUpload = React.forwardRef<HTMLInputElement, ImageUploadProps>(
1616
const [activeFile, setActiveFile] = React.useState<File | null>(null);
1717
const onDrop = React.useCallback(
1818
(acceptedFiles: File[]) => {
19-
setActiveFile(acceptedFiles[0]);
19+
if (acceptedFiles[0]) {
20+
setActiveFile(acceptedFiles[0]);
21+
}
2022
onUpload?.(acceptedFiles);
2123
},
2224
[onUpload],

apps/dashboard/src/@/components/ui/input-otp.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ const InputOTPSlot = React.forwardRef<
3535
React.ComponentPropsWithoutRef<"div"> & { index: number }
3636
>(({ index, className, ...props }, ref) => {
3737
const inputOTPContext = React.useContext(OTPInputContext);
38-
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
38+
// biome-ignore lint/style/noNonNullAssertion: pure shadcn component - it works
39+
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index]!;
3940

4041
return (
4142
<div
@@ -62,7 +63,7 @@ const InputOTPSeparator = React.forwardRef<
6263
React.ElementRef<"div">,
6364
React.ComponentPropsWithoutRef<"div">
6465
>(({ ...props }, ref) => (
65-
// biome-ignore lint/a11y/useFocusableInteractive: <explanation>
66+
// biome-ignore lint/a11y/useFocusableInteractive: pure shadcn component - it works
6667
<div ref={ref} role="separator" {...props}>
6768
<Dot />
6869
</div>

apps/dashboard/src/@3rdweb-sdk/react/hooks/useActivity.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,12 @@ export function useActivity(contract: ThirdwebContract, autoUpdate?: boolean) {
4444
}
4545
const obj = eventsQuery.data.slice(0, 100).reduce(
4646
(acc, curr) => {
47-
if (acc[curr.transactionHash]) {
48-
acc[curr.transactionHash].events.push(curr);
49-
acc[curr.transactionHash].events.sort(
50-
(a, b) => b.logIndex - a.logIndex,
51-
);
52-
if (acc[curr.transactionHash].blockNumber > curr.blockNumber) {
53-
acc[curr.transactionHash].blockNumber = curr.blockNumber;
47+
const internalTx = acc[curr.transactionHash];
48+
if (internalTx) {
49+
internalTx.events.push(curr);
50+
internalTx.events.sort((a, b) => b.logIndex - a.logIndex);
51+
if (internalTx.blockNumber > curr.blockNumber) {
52+
internalTx.blockNumber = curr.blockNumber;
5453
}
5554
} else {
5655
acc[curr.transactionHash] = {

apps/dashboard/src/@3rdweb-sdk/react/hooks/useDashboardContractMetadata.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export async function fetchDashboardContractMetadata(
4848
if (compilerMetadata?.name.includes(":")) {
4949
const _name = compilerMetadata.name.split(":")[1];
5050
if (_name) {
51-
compilerMetadata.name = compilerMetadata.name.split(":")[1];
51+
compilerMetadata.name = _name;
5252
}
5353
}
5454

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/embed/embed-setup.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ function minimizeChain(
171171
return {
172172
name: chain.name,
173173
chain: chain.chain,
174-
rpc: [firstRpc],
174+
rpc: [firstRpc || ""],
175175
nativeCurrency: chain.nativeCurrency,
176176
shortName: chain.shortName,
177177
chainId: chain.chainId,
@@ -509,7 +509,7 @@ export const EmbedSetup: React.FC<EmbedSetupProps> = ({
509509
)}
510510
{colorOptions.map((color) => (
511511
<option key={color} value={color}>
512-
{color[0].toUpperCase() + color.substring(1)}
512+
{color[0]?.toUpperCase() + color.substring(1)}
513513
</option>
514514
))}
515515
</Select>
@@ -524,7 +524,7 @@ export const EmbedSetup: React.FC<EmbedSetupProps> = ({
524524
<Select {...register("secondaryColor")}>
525525
{colorOptions.map((color) => (
526526
<option key={color} value={color}>
527-
{color[0].toUpperCase() + color.substring(1)}
527+
{color[0]?.toUpperCase() + color.substring(1)}
528528
</option>
529529
))}
530530
</Select>

0 commit comments

Comments
 (0)