From c8b49d350b4a3d57d11400d5c0a80c4191fdf59e Mon Sep 17 00:00:00 2001 From: stefanbitcr Date: Thu, 10 Jul 2025 21:51:26 +0200 Subject: [PATCH 1/7] Display version --- src/generated/client/sdk.gen.ts | 18 +++++++- src/generated/client/types.gen.ts | 20 +++++++++ src/pages/home/HomePage.tsx | 68 ++++++++++++++++++++++++++++++- 3 files changed, 103 insertions(+), 3 deletions(-) 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..675f54a 100644 --- a/src/pages/home/HomePage.tsx +++ b/src/pages/home/HomePage.tsx @@ -1,6 +1,6 @@ import { PageTitle } from "@/components/PageTitle" import { Skeleton } from "@/components/ui/skeleton" -import { identityDetail } from "@/generated/client/sdk.gen" +import { identityDetail, mintInfo } from "@/generated/client/sdk.gen" import { useSuspenseQuery } from "@tanstack/react-query" import { Suspense } from "react" @@ -23,6 +23,16 @@ function PageBody() { gcTime: Infinity, }) + const { data: mintData } = useSuspenseQuery({ + queryKey: ["mint-info"], + queryFn: async () => { + const response = await mintInfo() + return response.data ?? null + }, + staleTime: Infinity, + gcTime: Infinity, + }) + if (!data) { return (
@@ -33,8 +43,62 @@ function PageBody() { return (
+ {mintData && ( +
+

Mint Information

+
+ {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, index) => ( + + {contact} + + ))} +
+
+ )} +
+
+ )} +
-

Information

+

Identity

Name From 9bfaf845dff90ab1759df11f1eeb98f00b53cffa Mon Sep 17 00:00:00 2001 From: stefanbitcr Date: Fri, 11 Jul 2025 08:19:13 +0200 Subject: [PATCH 2/7] Use contact as key --- src/pages/home/HomePage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/HomePage.tsx b/src/pages/home/HomePage.tsx index 675f54a..ee026e7 100644 --- a/src/pages/home/HomePage.tsx +++ b/src/pages/home/HomePage.tsx @@ -85,8 +85,8 @@ function PageBody() {
Contact
- {mintData.contact.map((contact, index) => ( - + {mintData.contact.map((contact) => ( + {contact} ))} From 89489d045a031862bbdc86f90331bfb1a80c108b Mon Sep 17 00:00:00 2001 From: stefanbitcr Date: Fri, 11 Jul 2025 08:22:55 +0200 Subject: [PATCH 3/7] Display description new line breaks --- src/pages/home/HomePage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/HomePage.tsx b/src/pages/home/HomePage.tsx index ee026e7..70ce012 100644 --- a/src/pages/home/HomePage.tsx +++ b/src/pages/home/HomePage.tsx @@ -70,7 +70,7 @@ function PageBody() { Long Description - {mintData.description_long} + {mintData.description_long}
)} {mintData.pubkey && ( From 5a813843ec7e063b99317575d26d5099ff58657b Mon Sep 17 00:00:00 2001 From: stefanbitcr Date: Fri, 11 Jul 2025 08:34:58 +0200 Subject: [PATCH 4/7] Rearrange home layout --- src/pages/home/HomePage.tsx | 224 ++++++++++++++++++------------------ 1 file changed, 115 insertions(+), 109 deletions(-) diff --git a/src/pages/home/HomePage.tsx b/src/pages/home/HomePage.tsx index 70ce012..bf52d49 100644 --- a/src/pages/home/HomePage.tsx +++ b/src/pages/home/HomePage.tsx @@ -13,7 +13,7 @@ function Loader() { } function PageBody() { - const { data } = useSuspenseQuery({ + const { data: identityData } = useSuspenseQuery({ queryKey: ["identity-detail"], queryFn: async () => { const response = await identityDetail() @@ -33,131 +33,137 @@ function PageBody() { gcTime: Infinity, }) - if (!data) { - return ( -
-
No identity found
-
- ) - } - return (
- {mintData && ( +
-

Mint Information

-
- {mintData.name && ( +

Identity

+ {identityData ? ( +
Name - {mintData.name} -
- )} - {mintData.version && ( -
- Version - {mintData.version} + {identityData.name}
- )} - {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} + {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} + +
- )} -
-
- )} -
-

Identity

-
-
- Name - {data.name} -
- {data.email && ( -
- Email - {data.email} -
- )} - {data.date_of_birth && ( -
- Date of Birth - {data.date_of_birth} + {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
+ )}
- )} +
) } From b9ac742102567460ce1326b479c28aa619382954 Mon Sep 17 00:00:00 2001 From: stefanbitcr Date: Fri, 11 Jul 2025 08:35:11 +0200 Subject: [PATCH 5/7] Add slight padding to heading --- src/components/Headings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { From 0a3304cc366ba0d1e0c576d96bbb4203224dbccb Mon Sep 17 00:00:00 2001 From: stefanbitcr Date: Fri, 11 Jul 2025 08:44:11 +0200 Subject: [PATCH 6/7] Improve error handling --- src/pages/home/HomePage.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pages/home/HomePage.tsx b/src/pages/home/HomePage.tsx index bf52d49..2a188d3 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, mintInfo } from "@/generated/client/sdk.gen" -import { useSuspenseQuery } from "@tanstack/react-query" +import { useSuspenseQuery, useQuery } from "@tanstack/react-query" import { Suspense } from "react" function Loader() { @@ -13,7 +13,7 @@ function Loader() { } function PageBody() { - const { data: identityData } = useSuspenseQuery({ + const { data: identityData } = useQuery({ queryKey: ["identity-detail"], queryFn: async () => { const response = await identityDetail() @@ -21,9 +21,10 @@ function PageBody() { }, staleTime: Infinity, gcTime: Infinity, + throwOnError: false, }) - const { data: mintData } = useSuspenseQuery({ + const { data: mintData } = useQuery({ queryKey: ["mint-info"], queryFn: async () => { const response = await mintInfo() @@ -31,6 +32,7 @@ function PageBody() { }, staleTime: Infinity, gcTime: Infinity, + throwOnError: false, }) return ( From fd31bc11f1fce3bdf38404322c5b466e384fa9c0 Mon Sep 17 00:00:00 2001 From: stefanbitcr Date: Fri, 11 Jul 2025 08:45:11 +0200 Subject: [PATCH 7/7] Remove useSuspenseQuery --- src/pages/home/HomePage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/HomePage.tsx b/src/pages/home/HomePage.tsx index 2a188d3..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, mintInfo } from "@/generated/client/sdk.gen" -import { useSuspenseQuery, useQuery } from "@tanstack/react-query" +import { useQuery } from "@tanstack/react-query" import { Suspense } from "react" function Loader() {