1
1
import { PageTitle } from "@/components/PageTitle"
2
2
import { Skeleton } from "@/components/ui/skeleton"
3
- // import { fetchInfo } from "@/lib/api "
4
- // import { useSuspenseQuery } from "@tanstack/react-query"
3
+ import { identityDetail } from "@/generated/client/sdk.gen "
4
+ import { useSuspenseQuery } from "@tanstack/react-query"
5
5
import { Suspense } from "react"
6
6
7
7
function Loader ( ) {
@@ -13,25 +13,88 @@ function Loader() {
13
13
}
14
14
15
15
function PageBody ( ) {
16
- // const { data } = []; useSuspenseQuery({
17
- // queryKey: ["info"],
18
- // queryFn: fetchInfo,
19
- // })
16
+ const { data } = useSuspenseQuery ( {
17
+ queryKey : [ "identity-detail" ] ,
18
+ queryFn : async ( ) => {
19
+ const response = await identityDetail ( )
20
+ return response . data ?? null
21
+ } ,
22
+ staleTime : Infinity ,
23
+ gcTime : Infinity ,
24
+ } )
20
25
21
- const data = {
22
- name : "bcr-wdc-quote-service" ,
23
- version : "0.1.0" ,
24
- pubkey : "0283bf290884eed3a7ca2663fc0260de2e2064d6b355ea13f98dec004b7a7ead99" ,
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
+ )
25
32
}
26
33
27
34
return (
28
- < >
29
- < div className = "flex flex-col gap-0.5 bg-accent text-accent-foreground rounded-lg p-2 my-2" >
30
- < span className = "font-bold" > { data . name } </ span >
31
- < span className = "text-sm font-mono text-accent-foreground/50" > { data . version } </ span >
32
- < span className = "text-sm font-mono" > { data . pubkey } </ span >
35
+ < 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 >
53
+ </ div >
54
+ ) }
55
+ </ div >
33
56
</ div >
34
- </ >
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
+
82
+ { data . postal_address && (
83
+ < 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 >
93
+ </ div >
94
+ </ div >
95
+ </ div >
96
+ ) }
97
+ </ div >
35
98
)
36
99
}
37
100
0 commit comments