diff --git a/src/components/Headings.tsx b/src/components/Headings.tsx index 21cb32b..aaf76cd 100644 --- a/src/components/Headings.tsx +++ b/src/components/Headings.tsx @@ -1,7 +1,7 @@ import { PropsWithChildren } from "react" export function H2({ children }: PropsWithChildren) { - return

{children}

+ return

{children}

} export function H3({ children }: PropsWithChildren) { diff --git a/src/generated/client/sdk.gen.ts b/src/generated/client/sdk.gen.ts index 1e3cff0..56d88a7 100644 --- a/src/generated/client/sdk.gen.ts +++ b/src/generated/client/sdk.gen.ts @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch'; -import type { ListQuotesData, ListQuotesResponse, ListPendingQuotesData, ListPendingQuotesResponse, AdminLookupQuoteData, AdminLookupQuoteResponse, AdminUpdateQuoteData, AdminUpdateQuoteResponse, ResolveOfferData, EnquireQuoteData, EnquireQuoteResponse, LookupQuoteData, LookupQuoteResponse, ActivateKeysetData, ActivateKeysetResponse, DebitData, CreditData, ECashBalance, OnChainBalanceData, OnChainData, KeysetInfoData, KeySetInfo, RequestToMintData, RequestToMintResponseInfo, IdentityDetailData, IdentityDetailInfo, BillPaymentData, BillPaymentState} from './types.gen'; +import type { ListQuotesData, ListQuotesResponse, ListPendingQuotesData, ListPendingQuotesResponse, AdminLookupQuoteData, AdminLookupQuoteResponse, AdminUpdateQuoteData, AdminUpdateQuoteResponse, ResolveOfferData, EnquireQuoteData, EnquireQuoteResponse, LookupQuoteData, LookupQuoteResponse, ActivateKeysetData, ActivateKeysetResponse, DebitData, CreditData, ECashBalance, OnChainBalanceData, OnChainData, KeysetInfoData, KeySetInfo, RequestToMintData, RequestToMintResponseInfo, IdentityDetailData, IdentityDetailInfo, BillPaymentData, BillPaymentState, MintInfo, MintInfoData} from './types.gen'; import { client as _heyApiClient } from './client.gen'; @@ -183,3 +183,19 @@ export const paymentStatus = (options?: Op } }); }; + + +/** + * --------------------------- MintInfo +*/ + +export const mintInfo = (options?: Options) => { + return (_heyApiClient).get({ + url: '/v1/admin/info', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } + }); +}; diff --git a/src/generated/client/types.gen.ts b/src/generated/client/types.gen.ts index 0b898d6..df83ccc 100644 --- a/src/generated/client/types.gen.ts +++ b/src/generated/client/types.gen.ts @@ -597,3 +597,23 @@ export type BillPaymentData = { query?: never; url: '/v1/admin/bill/payment_status/{bill_id}'; }; + +/** +* Mint Info +*/ + +export type MintInfo = { + name: string, + pubkey: string | null, + version: string | null, + description: string | null, + description_long: string | null, + contact: Array | null, +} + +export type MintInfoData = { + body?: never; + path?: never; + query?: never; + url: '/v1/admin/info' +}; diff --git a/src/pages/home/HomePage.tsx b/src/pages/home/HomePage.tsx index 14f1cca..ae7f9ee 100644 --- a/src/pages/home/HomePage.tsx +++ b/src/pages/home/HomePage.tsx @@ -1,7 +1,7 @@ import { PageTitle } from "@/components/PageTitle" import { Skeleton } from "@/components/ui/skeleton" -import { identityDetail } from "@/generated/client/sdk.gen" -import { useSuspenseQuery } from "@tanstack/react-query" +import { identityDetail, mintInfo } from "@/generated/client/sdk.gen" +import { useQuery } from "@tanstack/react-query" import { Suspense } from "react" function Loader() { @@ -13,7 +13,7 @@ function Loader() { } function PageBody() { - const { data } = useSuspenseQuery({ + const { data: identityData } = useQuery({ queryKey: ["identity-detail"], queryFn: async () => { const response = await identityDetail() @@ -21,79 +21,151 @@ function PageBody() { }, staleTime: Infinity, gcTime: Infinity, + throwOnError: false, }) - if (!data) { - return ( -
-
No identity found
-
- ) - } + const { data: mintData } = useQuery({ + queryKey: ["mint-info"], + queryFn: async () => { + const response = await mintInfo() + return response.data ?? null + }, + staleTime: Infinity, + gcTime: Infinity, + throwOnError: false, + }) return (
-
-

Information

-
-
- Name - {data.name} -
- {data.email && ( -
- Email - {data.email} -
- )} - {data.date_of_birth && ( -
- Date of Birth - {data.date_of_birth} +
+
+

Identity

+ {identityData ? ( +
+
+ Name + {identityData.name} +
+ {identityData.email && ( +
+ Email + {identityData.email} +
+ )} + {identityData.date_of_birth && ( +
+ + Date of Birth + + {identityData.date_of_birth} +
+ )} + +
+

Keys

+
+
+ Node ID + + {identityData.node_id} + +
+
+ + Bitcoin Public Key + + + {identityData.bitcoin_public_key} + +
+
+ + Nostr Public Key + + + {identityData.npub} + +
+
+
+ + {identityData.postal_address && ( +
+

Address

+
+
+
{identityData.postal_address.address}
+
+ {identityData.postal_address.city} + {identityData.postal_address.zip && `, ${identityData.postal_address.zip}`} +
+
{identityData.postal_address.country}
+
+
+
+ )}
+ ) : ( +
No identity found
)}
-
- -
-

Keys

-
-
- Node ID - - {data.node_id} - -
-
- - Bitcoin Public Key - - - {data.bitcoin_public_key} - -
-
- Nostr Public Key - {data.npub} -
-
-
- {data.postal_address && (
-

Address

-
-
-
{data.postal_address.address}
-
- {data.postal_address.city} - {data.postal_address.zip && `, ${data.postal_address.zip}`} -
-
{data.postal_address.country}
+

Mint Information

+ {mintData ? ( +
+ {mintData.name && ( +
+ Name + {mintData.name} +
+ )} + {mintData.version && ( +
+ Version + {mintData.version} +
+ )} + {mintData.description && ( +
+ Description + {mintData.description} +
+ )} + {mintData.description_long && ( +
+ + Long Description + + {mintData.description_long} +
+ )} + {mintData.pubkey && ( +
+ Public Key + + {mintData.pubkey} + +
+ )} + {mintData.contact && mintData.contact.length > 0 && ( +
+ Contact +
+ {mintData.contact.map((contact) => ( + + {contact} + + ))} +
+
+ )}
-
+ ) : ( +
No mint information available
+ )}
- )} +
) }