Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Headings.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PropsWithChildren } from "react"

export function H2({ children }: PropsWithChildren<unknown>) {
return <h2 className="scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl">{children}</h2>
return <h2 className="scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl mb-6 pt-4">{children}</h2>

Check warning on line 4 in src/components/Headings.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/Headings.tsx#L4

Added line #L4 was not covered by tests
}

export function H3({ children }: PropsWithChildren<unknown>) {
Expand Down
18 changes: 17 additions & 1 deletion src/generated/client/sdk.gen.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -183,3 +183,19 @@
}
});
};


/**
* --------------------------- MintInfo
*/

export const mintInfo = <ThrowOnError extends boolean = false>(options?: Options<MintInfoData, ThrowOnError>) => {
return (_heyApiClient).get<MintInfo, unknown, ThrowOnError>({
url: '/v1/admin/info',
...options,
headers: {
'Content-Type': 'application/json',
...options?.headers
}
});
};

Check warning on line 201 in src/generated/client/sdk.gen.ts

View check run for this annotation

Codecov / codecov/patch

src/generated/client/sdk.gen.ts#L192-L201

Added lines #L192 - L201 were not covered by tests
20 changes: 20 additions & 0 deletions src/generated/client/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> | null,
}

export type MintInfoData = {
body?: never;
path?: never;
query?: never;
url: '/v1/admin/info'
};
200 changes: 136 additions & 64 deletions src/pages/home/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -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"

Check warning on line 4 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L3-L4

Added lines #L3 - L4 were not covered by tests
import { Suspense } from "react"

function Loader() {
Expand All @@ -13,87 +13,159 @@
}

function PageBody() {
const { data } = useSuspenseQuery({
const { data: identityData } = useQuery({

Check warning on line 16 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L16

Added line #L16 was not covered by tests
queryKey: ["identity-detail"],
queryFn: async () => {
const response = await identityDetail()
return response.data ?? null
},
staleTime: Infinity,
gcTime: Infinity,
throwOnError: false,

Check warning on line 24 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L24

Added line #L24 was not covered by tests
})

if (!data) {
return (
<div className="bg-card text-card-foreground rounded-lg border p-6">
<div className="text-center text-muted-foreground">No identity found</div>
</div>
)
}
const { data: mintData } = useQuery({
queryKey: ["mint-info"],
queryFn: async () => {
const response = await mintInfo()
return response.data ?? null
},
staleTime: Infinity,
gcTime: Infinity,
throwOnError: false,
})

Check warning on line 36 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L27-L36

Added lines #L27 - L36 were not covered by tests

return (
<div className="flex flex-col gap-4">
<div className="bg-card text-card-foreground rounded-lg border p-6">
<h3 className="text-lg font-semibold mb-4">Information</h3>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Name</span>
<span className="font-semibold text-base">{data.name}</span>
</div>
{data.email && (
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Email</span>
<span className="font-mono text-sm text-muted-foreground">{data.email}</span>
</div>
)}
{data.date_of_birth && (
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Date of Birth</span>
<span className="text-sm">{data.date_of_birth}</span>
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
<div className="bg-card text-card-foreground rounded-lg border p-6">
<h3 className="text-lg font-semibold mb-4">Identity</h3>
{identityData ? (
<div className="flex flex-col gap-4">
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Name</span>
<span className="font-semibold text-base">{identityData.name}</span>
</div>
{identityData.email && (
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Email</span>
<span className="font-mono text-sm text-muted-foreground">{identityData.email}</span>
</div>

Check warning on line 53 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L40-L53

Added lines #L40 - L53 were not covered by tests
)}
{identityData.date_of_birth && (
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">

Check warning on line 57 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L55-L57

Added lines #L55 - L57 were not covered by tests
Date of Birth
</span>
<span className="text-sm">{identityData.date_of_birth}</span>
</div>

Check warning on line 61 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L59-L61

Added lines #L59 - L61 were not covered by tests
)}

<div className="border-t pt-4 mt-4">
<h4 className="text-md font-semibold mb-4">Keys</h4>
<div className="flex flex-col gap-4">
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Node ID</span>
<span className="font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground">
{identityData.node_id}
</span>
</div>
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">

Check warning on line 74 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L64-L74

Added lines #L64 - L74 were not covered by tests
Bitcoin Public Key
</span>
<span className="font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground">
{identityData.bitcoin_public_key}
</span>
</div>
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">

Check warning on line 82 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L76-L82

Added lines #L76 - L82 were not covered by tests
Nostr Public Key
</span>
<span className="font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground">
{identityData.npub}
</span>
</div>
</div>
</div>

Check warning on line 90 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L84-L90

Added lines #L84 - L90 were not covered by tests

{identityData.postal_address && (
<div className="border-t pt-4 mt-4">
<h4 className="text-md font-semibold mb-4">Address</h4>
<div className="flex flex-col gap-1">
<div className="text-sm leading-relaxed">
<div className="font-medium">{identityData.postal_address.address}</div>
<div className="text-muted-foreground">
{identityData.postal_address.city}
{identityData.postal_address.zip && `, ${identityData.postal_address.zip}`}
</div>
<div className="text-muted-foreground">{identityData.postal_address.country}</div>
</div>
</div>
</div>

Check warning on line 105 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L92-L105

Added lines #L92 - L105 were not covered by tests
)}
</div>
) : (
<div className="text-center text-muted-foreground">No identity found</div>

Check warning on line 109 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L109

Added line #L109 was not covered by tests
)}
</div>
</div>

<div className="bg-card text-card-foreground rounded-lg border p-6">
<h3 className="text-lg font-semibold mb-4">Keys</h3>
<div className="flex flex-col gap-4">
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Node ID</span>
<span className="font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground">
{data.node_id}
</span>
</div>
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">
Bitcoin Public Key
</span>
<span className="font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground">
{data.bitcoin_public_key}
</span>
</div>
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Nostr Public Key</span>
<span className="font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground">{data.npub}</span>
</div>
</div>
</div>

{data.postal_address && (
<div className="bg-card text-card-foreground rounded-lg border p-6">
<h3 className="text-lg font-semibold mb-4">Address</h3>
<div className="flex flex-col gap-1">
<div className="text-sm leading-relaxed">
<div className="font-medium">{data.postal_address.address}</div>
<div className="text-muted-foreground">
{data.postal_address.city}
{data.postal_address.zip && `, ${data.postal_address.zip}`}
</div>
<div className="text-muted-foreground">{data.postal_address.country}</div>
<h3 className="text-lg font-semibold mb-4">Mint Information</h3>
{mintData ? (
<div className="flex flex-col gap-4">
{mintData.name && (
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Name</span>
<span className="font-semibold text-base">{mintData.name}</span>
</div>

Check warning on line 121 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L114-L121

Added lines #L114 - L121 were not covered by tests
)}
{mintData.version && (
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Version</span>
<span className="text-sm">{mintData.version}</span>
</div>

Check warning on line 127 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L123-L127

Added lines #L123 - L127 were not covered by tests
)}
{mintData.description && (
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Description</span>
<span className="text-sm">{mintData.description}</span>
</div>

Check warning on line 133 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L129-L133

Added lines #L129 - L133 were not covered by tests
)}
{mintData.description_long && (
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">

Check warning on line 137 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L135-L137

Added lines #L135 - L137 were not covered by tests
Long Description
</span>
<span className="text-sm whitespace-pre-line">{mintData.description_long}</span>
</div>

Check warning on line 141 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L139-L141

Added lines #L139 - L141 were not covered by tests
)}
{mintData.pubkey && (
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Public Key</span>
<span className="font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground">
{mintData.pubkey}
</span>
</div>

Check warning on line 149 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L143-L149

Added lines #L143 - L149 were not covered by tests
)}
{mintData.contact && mintData.contact.length > 0 && (
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Contact</span>
<div className="flex flex-wrap gap-2">
{mintData.contact.map((contact) => (
<span key={contact} className="text-sm bg-muted px-2 py-1 rounded">
{contact}
</span>
))}
</div>
</div>

Check warning on line 161 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L151-L161

Added lines #L151 - L161 were not covered by tests
)}
</div>
</div>
) : (
<div className="text-center text-muted-foreground">No mint information available</div>

Check warning on line 165 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L165

Added line #L165 was not covered by tests
)}
</div>
)}
</div>

Check warning on line 168 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L168

Added line #L168 was not covered by tests
</div>
)
}
Expand Down
Loading