Skip to content

Commit 82ab953

Browse files
authored
Update UI Dashboard 2 (#38)
* Display discounted amount * Add american english canceled page and offer expired * Display keyset id * Display keyset status * Set path for keyset lookup * Clean up comments * Add keyset info * Remove comments * Don't set keysetActive to true manually * Force refresh when activating a keyset * Use new enable endpoint * Show whether ebill is paid
1 parent d804fbd commit 82ab953

File tree

6 files changed

+182
-78
lines changed

6 files changed

+182
-78
lines changed

src/components/AppSidebar.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ const data = {
2929
title: "Offered",
3030
url: "/quotes/offered",
3131
},
32+
{
33+
title: "Offer Expired",
34+
url: "/quotes/offerexpired",
35+
},
3236
{
3337
title: "Accepted",
3438
url: "/quotes/accepted",
@@ -41,6 +45,10 @@ const data = {
4145
title: "Rejected",
4246
url: "/quotes/rejected",
4347
},
48+
{
49+
title: "Canceled",
50+
url: "/quotes/canceled",
51+
},
4452
],
4553
},
4654
],

src/generated/client/sdk.gen.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

33
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
4-
import type { ListQuotesData, ListQuotesResponse, ListPendingQuotesData, ListPendingQuotesResponse, AdminLookupQuoteData, AdminLookupQuoteResponse, AdminUpdateQuoteData, AdminUpdateQuoteResponse, ResolveOfferData, EnquireQuoteData, EnquireQuoteResponse, LookupQuoteData, LookupQuoteResponse, ActivateKeysetData, ActivateKeysetResponse, DebitData, CreditData, ECashBalance, OnChainBalanceData, OnChainData} from './types.gen';
4+
import type { ListQuotesData, ListQuotesResponse, ListPendingQuotesData, ListPendingQuotesResponse, AdminLookupQuoteData, AdminLookupQuoteResponse, AdminUpdateQuoteData, AdminUpdateQuoteResponse, ResolveOfferData, EnquireQuoteData, EnquireQuoteResponse, LookupQuoteData, LookupQuoteResponse, ActivateKeysetData, ActivateKeysetResponse, DebitData, CreditData, ECashBalance, OnChainBalanceData, OnChainData, KeysetInfoData, KeySetInfo} from './types.gen';
55
import { client as _heyApiClient } from './client.gen';
66

77
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
@@ -91,7 +91,7 @@ export const lookupQuote = <ThrowOnError extends boolean = false>(options: Optio
9191
*/
9292
export const activateKeyset = <ThrowOnError extends boolean = false>(options: Options<ActivateKeysetData, ThrowOnError>) => {
9393
return (options.client ?? _heyApiClient).post<ActivateKeysetResponse, unknown, ThrowOnError>({
94-
url: '/v1/admin/keys/activate',
94+
url: '/v1/admin/keys/enable',
9595
...options,
9696
headers: {
9797
'Content-Type': 'application/json',
@@ -125,3 +125,14 @@ export const onchainBalance = <ThrowOnError extends boolean = false>(options: Op
125125
...options
126126
});
127127
};
128+
129+
/**
130+
* --------------------------- KeySetInfo
131+
*/
132+
133+
export const keysetInfo = <ThrowOnError extends boolean = false>(options: Options<KeysetInfoData, ThrowOnError>) => {
134+
return (options.client ?? _heyApiClient).get<KeySetInfo, unknown, ThrowOnError>({
135+
url: '/v1/admin/keysets/{keyset_id}',
136+
...options
137+
});
138+
};

src/generated/client/types.gen.ts

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,22 +135,36 @@ export type InfoReply = {
135135
} | {
136136
bill: BillInfo;
137137
id: string;
138-
signatures: Array<BlindSignature>;
138+
status: 'Canceled';
139+
tstamp: string;
140+
} | {
141+
bill: BillInfo;
142+
id: string;
143+
keyset_id: string;
139144
status: 'Offered';
145+
discounted: number;
140146
ttl: string;
147+
} | {
148+
bill: BillInfo;
149+
id: string;
150+
status: 'OfferExpired';
151+
discounted: number;
152+
tstamp: string;
141153
} | {
142154
bill: BillInfo;
143155
id: string;
144156
status: 'Denied';
145157
} | {
146158
bill: BillInfo;
147159
id: string;
148-
signatures: Array<BlindSignature>;
160+
keyset_id: string;
161+
discounted: number;
149162
status: 'Accepted';
150163
} | {
151164
bill: BillInfo;
152165
id: string;
153166
status: 'Rejected';
167+
discounted: number;
154168
tstamp: string;
155169
};
156170

@@ -402,7 +416,7 @@ export type ActivateKeysetData = {
402416
body: ActivateKeysetRequest;
403417
path?: never;
404418
query?: never;
405-
url: '/v1/admin/keys/activate';
419+
url: '/v1/admin/keys/enable';
406420
};
407421

408422
export type ActivateKeysetErrors = {
@@ -455,10 +469,30 @@ export type OnChainBalanceData = {
455469
confirmed: number;
456470
};
457471

458-
459472
export type OnChainData = {
460473
body?: never;
461474
path?: never;
462475
query?: never;
463476
url: '/v1/admin/onchain/balance';
464477
};
478+
479+
/**
480+
* Keyset information
481+
*/
482+
483+
export type KeySetInfo = {
484+
id: string;
485+
unit: CurrencyUnit;
486+
active: boolean;
487+
input_fee_ppk: number;
488+
};
489+
490+
491+
export type KeysetInfoData = {
492+
body?: never;
493+
path: {
494+
keyset_id: string;
495+
};
496+
query?: never;
497+
url: '/v1/admin/keysets/{keyset_id}';
498+
};

src/main.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ const queryClient = new QueryClient()
2020

2121
const prepare = async () => {
2222
await initKeycloak()
23-
// if (meta.apiMocksEnabled) {
24-
// const { worker } = await import("./mocks/browser")
25-
// await worker.start()
26-
// }
2723
}
2824

2925
function App() {
@@ -39,10 +35,11 @@ function App() {
3935
<Route path="quotes" element={<StatusQuotePage />} />
4036
<Route path="quotes/pending" element={<StatusQuotePage status="Pending" />} />
4137
<Route path="quotes/accepted" element={<StatusQuotePage status="Accepted" />} />
38+
<Route path="quotes/canceled" element={<StatusQuotePage status="Canceled" />} />
4239
<Route path="quotes/offered" element={<StatusQuotePage status="Offered" />} />
40+
<Route path="quotes/offerexpired" element={<StatusQuotePage status="OfferExpired" />} />
4341
<Route path="quotes/denied" element={<StatusQuotePage status="Denied" />} />
4442
<Route path="quotes/rejected" element={<StatusQuotePage status="Rejected" />} />
45-
{/* <Route path="quotes/expired" element={<StatusQuotePage status="Rejected" />} /> */}
4643
<Route path="quotes/:id" element={<QuotePage />} />
4744
<Route path="settings" element={<SettingsPage />} />
4845
<Route path="info" element={<InfoPage />} />

0 commit comments

Comments
 (0)