Skip to content

Commit c019656

Browse files
committed
Replace custom Select component with native select in webhook filter UI
1 parent deeca88 commit c019656

File tree

1 file changed

+25
-83
lines changed
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components

1 file changed

+25
-83
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/FilterDetailsStep.tsx

Lines changed: 25 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ import {
1111
FormMessage,
1212
} from "@/components/ui/form";
1313
import { Input } from "@/components/ui/input";
14-
import {
15-
Select,
16-
SelectContent,
17-
SelectItem,
18-
SelectTrigger,
19-
SelectValue,
20-
} from "@/components/ui/select";
2114
import { Textarea } from "@/components/ui/textarea";
2215
import { useThirdwebClient } from "@/constants/thirdweb.client";
2316
import { useQueryClient } from "@tanstack/react-query";
@@ -305,97 +298,46 @@ export function FilterDetailsStep({
305298
{watchFilterType === "event" &&
306299
Object.keys(fetchedAbis).length > 0 &&
307300
eventSignatures.length > 0 ? (
308-
<Select
301+
<select
302+
className="h-10 w-full rounded-md border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50"
309303
value={field.value}
310-
onValueChange={(value) => {
311-
field.onChange(value);
312-
// Find the selected event
304+
onChange={(e) => {
305+
field.onChange(e.target.value);
313306
const selectedEvent = eventSignatures.find(
314-
(sig) => sig.signature === value,
307+
(sig) => sig.signature === e.target.value,
315308
);
316-
// Set the ABI for the event
317309
form.setValue("sigHashAbi", selectedEvent?.abi || "");
318310
}}
319311
>
320-
<SelectTrigger>
321-
<SelectValue placeholder="Select an event signature">
322-
{field.value
323-
? eventSignatures.find(
324-
(sig) => sig.signature === field.value,
325-
)?.name || ""
326-
: null}
327-
</SelectValue>
328-
</SelectTrigger>
329-
<SelectContent className="max-h-60 overflow-y-auto">
330-
{eventSignatures.map((event) => {
331-
// Truncate the hash for display purposes
332-
const truncatedHash = truncateMiddle(
333-
event.signature,
334-
6,
335-
4,
336-
);
337-
338-
return (
339-
<SelectItem
340-
key={event.signature}
341-
value={event.signature}
342-
title={event.name}
343-
>
344-
<div className="flex flex-col">
345-
<span className="font-medium">{event.name}</span>
346-
<span className="text-muted-foreground text-xs">
347-
Signature: {truncatedHash}
348-
</span>
349-
</div>
350-
</SelectItem>
351-
);
352-
})}
353-
</SelectContent>
354-
</Select>
312+
<option value="">Select an event signature</option>
313+
{eventSignatures.map((event) => (
314+
<option key={event.signature} value={event.signature}>
315+
{event.name} (Signature:{" "}
316+
{truncateMiddle(event.signature, 6, 4)})
317+
</option>
318+
))}
319+
</select>
355320
) : watchFilterType === "transaction" &&
356321
Object.keys(fetchedTxAbis).length > 0 &&
357322
functionSignatures.length > 0 ? (
358-
<Select
323+
<select
324+
className="h-10 w-full rounded-md border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50"
359325
value={field.value}
360-
onValueChange={(value) => {
361-
field.onChange(value);
362-
// Find the selected function
326+
onChange={(e) => {
327+
field.onChange(e.target.value);
363328
const selectedFunction = functionSignatures.find(
364-
(sig) => sig.signature === value,
329+
(sig) => sig.signature === e.target.value,
365330
);
366-
// Set the ABI for the function
367331
form.setValue("sigHashAbi", selectedFunction?.abi || "");
368332
}}
369333
>
370-
<SelectTrigger className="max-w-full">
371-
<SelectValue placeholder="Select a function signature">
372-
{field.value
373-
? functionSignatures.find(
374-
(sig) => sig.signature === field.value,
375-
)?.name || ""
376-
: null}
377-
</SelectValue>
378-
</SelectTrigger>
379-
<SelectContent className="max-h-60 max-w-[600px] overflow-y-auto">
380-
{functionSignatures.map((func) => (
381-
<SelectItem
382-
key={func.signature}
383-
value={func.signature}
384-
title={func.signature}
385-
className="w-full overflow-x-auto"
386-
>
387-
<div className="flex w-full flex-col">
388-
<span className="overflow-x-auto whitespace-nowrap pb-1 font-medium">
389-
{func.name}
390-
</span>
391-
<span className="overflow-x-auto text-muted-foreground text-xs">
392-
Selector: {func.signature}
393-
</span>
394-
</div>
395-
</SelectItem>
396-
))}
397-
</SelectContent>
398-
</Select>
334+
<option value="">Select a function signature</option>
335+
{functionSignatures.map((func) => (
336+
<option key={func.signature} value={func.signature}>
337+
{func.name} (Selector: {func.signature})
338+
</option>
339+
))}
340+
</select>
399341
) : (
400342
<Input
401343
placeholder={

0 commit comments

Comments
 (0)