1
1
import { PageTitle } from "@/components/PageTitle"
2
2
import { Skeleton } from "@/components/ui/skeleton"
3
- import { identityDetail } from "@/generated/client/sdk.gen"
4
- import { useSuspenseQuery } from "@tanstack/react-query"
3
+ import { identityDetail , mintInfo } from "@/generated/client/sdk.gen"
4
+ import { useQuery } from "@tanstack/react-query"
5
5
import { Suspense } from "react"
6
6
7
7
function Loader ( ) {
@@ -13,87 +13,159 @@ function Loader() {
13
13
}
14
14
15
15
function PageBody ( ) {
16
- const { data } = useSuspenseQuery ( {
16
+ const { data : identityData } = useQuery ( {
17
17
queryKey : [ "identity-detail" ] ,
18
18
queryFn : async ( ) => {
19
19
const response = await identityDetail ( )
20
20
return response . data ?? null
21
21
} ,
22
22
staleTime : Infinity ,
23
23
gcTime : Infinity ,
24
+ throwOnError : false ,
24
25
} )
25
26
26
- if ( ! data ) {
27
- return (
28
- < div className = "bg-card text-card-foreground rounded-lg border p-6" >
29
- < div className = "text-center text-muted-foreground" > No identity found</ div >
30
- </ div >
31
- )
32
- }
27
+ const { data : mintData } = useQuery ( {
28
+ queryKey : [ "mint-info" ] ,
29
+ queryFn : async ( ) => {
30
+ const response = await mintInfo ( )
31
+ return response . data ?? null
32
+ } ,
33
+ staleTime : Infinity ,
34
+ gcTime : Infinity ,
35
+ throwOnError : false ,
36
+ } )
33
37
34
38
return (
35
39
< div className = "flex flex-col gap-4" >
36
- < div className = "bg-card text-card-foreground rounded-lg border p-6" >
37
- < h3 className = "text-lg font-semibold mb-4" > Information</ h3 >
38
- < div className = "grid grid-cols-1 md:grid-cols-2 gap-4" >
39
- < div className = "flex flex-col gap-1" >
40
- < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" > Name</ span >
41
- < span className = "font-semibold text-base" > { data . name } </ span >
42
- </ div >
43
- { data . email && (
44
- < div className = "flex flex-col gap-1" >
45
- < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" > Email</ span >
46
- < span className = "font-mono text-sm text-muted-foreground" > { data . email } </ span >
47
- </ div >
48
- ) }
49
- { data . date_of_birth && (
50
- < div className = "flex flex-col gap-1" >
51
- < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" > Date of Birth</ span >
52
- < span className = "text-sm" > { data . date_of_birth } </ span >
40
+ < div className = "grid grid-cols-1 lg:grid-cols-2 gap-4" >
41
+ < div className = "bg-card text-card-foreground rounded-lg border p-6" >
42
+ < h3 className = "text-lg font-semibold mb-4" > Identity</ h3 >
43
+ { identityData ? (
44
+ < div className = "flex flex-col gap-4" >
45
+ < div className = "flex flex-col gap-1" >
46
+ < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" > Name</ span >
47
+ < span className = "font-semibold text-base" > { identityData . name } </ span >
48
+ </ div >
49
+ { identityData . email && (
50
+ < div className = "flex flex-col gap-1" >
51
+ < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" > Email</ span >
52
+ < span className = "font-mono text-sm text-muted-foreground" > { identityData . email } </ span >
53
+ </ div >
54
+ ) }
55
+ { identityData . date_of_birth && (
56
+ < div className = "flex flex-col gap-1" >
57
+ < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" >
58
+ Date of Birth
59
+ </ span >
60
+ < span className = "text-sm" > { identityData . date_of_birth } </ span >
61
+ </ div >
62
+ ) }
63
+
64
+ < div className = "border-t pt-4 mt-4" >
65
+ < h4 className = "text-md font-semibold mb-4" > Keys</ h4 >
66
+ < div className = "flex flex-col gap-4" >
67
+ < div className = "flex flex-col gap-1" >
68
+ < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" > Node ID</ span >
69
+ < span className = "font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground" >
70
+ { identityData . node_id }
71
+ </ span >
72
+ </ div >
73
+ < div className = "flex flex-col gap-1" >
74
+ < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" >
75
+ Bitcoin Public Key
76
+ </ span >
77
+ < span className = "font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground" >
78
+ { identityData . bitcoin_public_key }
79
+ </ span >
80
+ </ div >
81
+ < div className = "flex flex-col gap-1" >
82
+ < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" >
83
+ Nostr Public Key
84
+ </ span >
85
+ < span className = "font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground" >
86
+ { identityData . npub }
87
+ </ span >
88
+ </ div >
89
+ </ div >
90
+ </ div >
91
+
92
+ { identityData . postal_address && (
93
+ < div className = "border-t pt-4 mt-4" >
94
+ < h4 className = "text-md font-semibold mb-4" > Address</ h4 >
95
+ < div className = "flex flex-col gap-1" >
96
+ < div className = "text-sm leading-relaxed" >
97
+ < div className = "font-medium" > { identityData . postal_address . address } </ div >
98
+ < div className = "text-muted-foreground" >
99
+ { identityData . postal_address . city }
100
+ { identityData . postal_address . zip && `, ${ identityData . postal_address . zip } ` }
101
+ </ div >
102
+ < div className = "text-muted-foreground" > { identityData . postal_address . country } </ div >
103
+ </ div >
104
+ </ div >
105
+ </ div >
106
+ ) }
53
107
</ div >
108
+ ) : (
109
+ < div className = "text-center text-muted-foreground" > No identity found</ div >
54
110
) }
55
111
</ div >
56
- </ div >
57
-
58
- < div className = "bg-card text-card-foreground rounded-lg border p-6" >
59
- < h3 className = "text-lg font-semibold mb-4" > Keys</ h3 >
60
- < div className = "flex flex-col gap-4" >
61
- < div className = "flex flex-col gap-1" >
62
- < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" > Node ID</ span >
63
- < span className = "font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground" >
64
- { data . node_id }
65
- </ span >
66
- </ div >
67
- < div className = "flex flex-col gap-1" >
68
- < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" >
69
- Bitcoin Public Key
70
- </ span >
71
- < span className = "font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground" >
72
- { data . bitcoin_public_key }
73
- </ span >
74
- </ div >
75
- < div className = "flex flex-col gap-1" >
76
- < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" > Nostr Public Key</ span >
77
- < span className = "font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground" > { data . npub } </ span >
78
- </ div >
79
- </ div >
80
- </ div >
81
112
82
- { data . postal_address && (
83
113
< div className = "bg-card text-card-foreground rounded-lg border p-6" >
84
- < h3 className = "text-lg font-semibold mb-4" > Address</ h3 >
85
- < div className = "flex flex-col gap-1" >
86
- < div className = "text-sm leading-relaxed" >
87
- < div className = "font-medium" > { data . postal_address . address } </ div >
88
- < div className = "text-muted-foreground" >
89
- { data . postal_address . city }
90
- { data . postal_address . zip && `, ${ data . postal_address . zip } ` }
91
- </ div >
92
- < div className = "text-muted-foreground" > { data . postal_address . country } </ div >
114
+ < h3 className = "text-lg font-semibold mb-4" > Mint Information</ h3 >
115
+ { mintData ? (
116
+ < div className = "flex flex-col gap-4" >
117
+ { mintData . name && (
118
+ < div className = "flex flex-col gap-1" >
119
+ < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" > Name</ span >
120
+ < span className = "font-semibold text-base" > { mintData . name } </ span >
121
+ </ div >
122
+ ) }
123
+ { mintData . version && (
124
+ < div className = "flex flex-col gap-1" >
125
+ < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" > Version</ span >
126
+ < span className = "text-sm" > { mintData . version } </ span >
127
+ </ div >
128
+ ) }
129
+ { mintData . description && (
130
+ < div className = "flex flex-col gap-1" >
131
+ < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" > Description</ span >
132
+ < span className = "text-sm" > { mintData . description } </ span >
133
+ </ div >
134
+ ) }
135
+ { mintData . description_long && (
136
+ < div className = "flex flex-col gap-1" >
137
+ < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" >
138
+ Long Description
139
+ </ span >
140
+ < span className = "text-sm whitespace-pre-line" > { mintData . description_long } </ span >
141
+ </ div >
142
+ ) }
143
+ { mintData . pubkey && (
144
+ < div className = "flex flex-col gap-1" >
145
+ < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" > Public Key</ span >
146
+ < span className = "font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground" >
147
+ { mintData . pubkey }
148
+ </ span >
149
+ </ div >
150
+ ) }
151
+ { mintData . contact && mintData . contact . length > 0 && (
152
+ < div className = "flex flex-col gap-1" >
153
+ < span className = "text-xs text-muted-foreground uppercase tracking-wide font-medium" > Contact</ span >
154
+ < div className = "flex flex-wrap gap-2" >
155
+ { mintData . contact . map ( ( contact ) => (
156
+ < span key = { contact } className = "text-sm bg-muted px-2 py-1 rounded" >
157
+ { contact }
158
+ </ span >
159
+ ) ) }
160
+ </ div >
161
+ </ div >
162
+ ) }
93
163
</ div >
94
- </ div >
164
+ ) : (
165
+ < div className = "text-center text-muted-foreground" > No mint information available</ div >
166
+ ) }
95
167
</ div >
96
- ) }
168
+ </ div >
97
169
</ div >
98
170
)
99
171
}
0 commit comments