1
1
import { useParams } from "@tanstack/react-router" ;
2
2
import { useState , type FC } from "react" ;
3
3
import { KeyValueDisplay } from "~/components/info-display/key-value-display" ;
4
- import { Button } from "~/components/ui" ;
4
+ import {
5
+ Button ,
6
+ Select ,
7
+ SelectContent ,
8
+ SelectItem ,
9
+ SelectTrigger ,
10
+ SelectValue ,
11
+ } from "~/components/ui" ;
5
12
import { useGetTxEffectByHash } from "~/hooks/" ;
6
13
import { API_URL , aztecExplorer } from "~/service/constants" ;
7
14
import { txEffectTabs , type TabId } from "./constants" ;
8
15
import { getTxEffectData } from "./utils" ;
16
+ import { truncateHashString } from "~/lib/create-hash-string" ;
9
17
10
18
const API_ENDPOINT_URL = `${ API_URL } /${ aztecExplorer . getL2TxEffectByHash } ` ;
11
19
@@ -16,6 +24,9 @@ export const TxEffectDetails: FC = () => {
16
24
} ) ;
17
25
const { data : txEffects , isLoading, error } = useGetTxEffectByHash ( hash ) ;
18
26
27
+ const getSelectedItem = ( value : string ) => {
28
+ setSelectedTab ( value as TabId ) ;
29
+ } ;
19
30
if ( ! hash ) < div > No txEffect hash</ div > ;
20
31
if ( isLoading ) return < div > Loading...</ div > ;
21
32
if ( error ) return < div > Error</ div > ;
@@ -24,11 +35,11 @@ export const TxEffectDetails: FC = () => {
24
35
const apiEndpointUrl = `${ API_ENDPOINT_URL } ${ hash } ` ;
25
36
26
37
return (
27
- < div className = "mx-auto px-[70px] max-w-[1440px]" >
38
+ < div className = "mx-auto px-7 max-w-[1440px] md:px-[70px ]" >
28
39
< div >
29
40
< div >
30
41
< h2 > TxEffect details</ h2 >
31
- < p > { txEffects . hash } </ p >
42
+ < p > { truncateHashString ( txEffects . hash ) } </ p >
32
43
< a href = { apiEndpointUrl } target = "_blank" rel = "noreferrer" >
33
44
(API Endpoint)
34
45
</ a >
@@ -37,7 +48,7 @@ export const TxEffectDetails: FC = () => {
37
48
< div className = "bg-white rounded-lg shadow-md p-4" >
38
49
< KeyValueDisplay data = { getTxEffectData ( txEffects ) } />
39
50
</ div >
40
- < div className = "flex flex-row gap-4 w-10 mb-4" >
51
+ < div className = "hidden lg: flex flex-row gap-4 w-10 mb-4" >
41
52
{ txEffectTabs . map ( ( tab ) => (
42
53
< Button
43
54
key = { tab . id }
@@ -49,6 +60,20 @@ export const TxEffectDetails: FC = () => {
49
60
</ Button >
50
61
) ) }
51
62
</ div >
63
+ < div className = "mb-1 mt-4 lg:hidden" >
64
+ < Select onValueChange = { getSelectedItem } >
65
+ < SelectTrigger className = "h-8 w-3/5 bg-primary text-white" >
66
+ < SelectValue placeholder = "encryptedLogs" />
67
+ </ SelectTrigger >
68
+ < SelectContent >
69
+ { txEffectTabs . map ( ( tab ) => (
70
+ < SelectItem key = { tab . id } value = { tab . id } >
71
+ { tab . label }
72
+ </ SelectItem >
73
+ ) ) }
74
+ </ SelectContent >
75
+ </ Select >
76
+ </ div >
52
77
< div className = "bg-white rounded-lg shadow-md p-4" >
53
78
{ selectedTab === "ecryptedLogs" && (
54
79
< div className = "" >
0 commit comments