Skip to content

Commit

Permalink
Merge branch 'master' into feat/add-preimage
Browse files Browse the repository at this point in the history
  • Loading branch information
pavanjoshi914 authored Nov 21, 2023
2 parents 67634e1 + 4c5e739 commit edb0acd
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/app/components/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function Container({
<div
className={`container mx-auto px-4 pb-4 ${getMaxWidthClass(maxWidth)} ${
justifyBetween
? "h-full flex flex-col justify-between no-scrollbar"
? "min-h-full flex flex-col justify-between no-scrollbar"
: ""
}`}
>
Expand Down
12 changes: 9 additions & 3 deletions src/app/components/TransactionsTable/TransactionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ export default function TransactionModal({
content={getFormattedSats(transaction.totalFees)}
/>
)}
{transaction.title && (
<TransactionDetailRow
title={tCommon("description")}
content={transaction.title}
/>
)}
{transaction.publisherLink && transaction.title && (
<TransactionDetailRow
title={tCommon("website")}
Expand Down Expand Up @@ -172,13 +178,13 @@ export default function TransactionModal({
}

const Dt = ({ children }: { children: React.ReactNode }) => (
<dt className="basis-28 text-gray-400 dark:text-neutral-500 text-right">
<dt className="w-28 text-gray-400 dark:text-neutral-500 text-right">
{children}
</dt>
);

const Dd = ({ children }: { children: React.ReactNode }) => (
<dd className="flex-1 text-gray-800 dark:text-neutral-200 break-all whitespace-pre-wrap">
<dd className="text-gray-800 dark:text-neutral-200 break-words whitespace-pre-wrap overflow-hidden">
{children}
</dd>
);
Expand All @@ -190,7 +196,7 @@ const TransactionDetailRow = ({
title: React.ReactNode | string;
content: React.ReactNode | string;
}) => (
<div className="flex p-1 text-sm leading-5 space-x-3">
<div className="grid grid-cols-[auto,1fr] p-1 text-sm leading-5 space-x-3">
<Dt>{title}</Dt>
<Dd>{content}</Dd>
</div>
Expand Down
71 changes: 37 additions & 34 deletions src/app/screens/LNURLPay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -329,31 +329,37 @@ function LNURLPay() {
}

return (
<Container justifyBetween maxWidth="sm">
<div>
<ResultCard
isSuccess
message={tCommon("success_message", {
amount: getFormattedSats(valueSat),
fiatAmount: showFiat ? ` (${fiatValue})` : ``,
destination: navState.origin?.name || getRecipient(),
})}
/>
{isMessage && (
<dl className="shadow bg-white dark:bg-surface-02dp mt-4 pt-4 px-4 rounded-lg mb-6 overflow-hidden">
{descriptionList.map(([dt, dd]) => (
<>
<Dt>{dt}</Dt>
<Dd>{dd}</Dd>
</>
))}
</dl>
)}
</div>
<div className="mb-4">
<Button onClick={close} label={tCommon("actions.close")} fullWidth />
</div>
</Container>
<div className="grow">
<Container justifyBetween maxWidth="sm">
<div>
<ResultCard
isSuccess
message={tCommon("success_message", {
amount: getFormattedSats(valueSat),
fiatAmount: showFiat ? ` (${fiatValue})` : ``,
destination: navState.origin?.name || getRecipient(),
})}
/>
{isMessage && (
<dl className="shadow bg-white dark:bg-surface-02dp mt-4 pt-4 px-4 rounded-lg mb-6 overflow-hidden">
{descriptionList.map(([dt, dd]) => (
<>
<Dt>{dt}</Dt>
<Dd>{dd}</Dd>
</>
))}
</dl>
)}
</div>
<div>
<Button
onClick={close}
label={tCommon("actions.close")}
fullWidth
/>
</div>
</Container>
</div>
);
}

Expand Down Expand Up @@ -412,12 +418,9 @@ function LNURLPay() {
description={getRecipient()}
image={navState.origin?.icon || getImage()}
/>
<form onSubmit={handleSubmit} className="h-full">
<fieldset
disabled={loadingConfirm}
className="h-full flex flex-col justify-between"
>
<div>
<form onSubmit={handleSubmit} className="grow flex">
<div className="grow flex flex-col justify-between">
<fieldset disabled={loadingConfirm}>
<dl className="mt-4 overflow-hidden">
<>
{formattedMetadata(details.metadata).map(
Expand Down Expand Up @@ -480,7 +483,7 @@ function LNURLPay() {
)}

{(showNameField() || showEmailField()) && (
<div className="flex justify-center mt-4">
<div className="flex justify-center mt-4 caret-transparent">
<Hyperlink onClick={toggleShowMoreFields}>
{tCommon("actions.more")}{" "}
{showMoreFields ? (
Expand Down Expand Up @@ -522,7 +525,7 @@ function LNURLPay() {
)}
</div>
)}
</div>
</fieldset>
<div className="mt-2 dark:border-white/10">
<ConfirmOrCancel
isFocused={false}
Expand All @@ -534,7 +537,7 @@ function LNURLPay() {
onCancel={reject}
/>
</div>
</fieldset>
</div>
</form>
</Container>
</div>
Expand Down
14 changes: 13 additions & 1 deletion src/extension/background-script/connectors/alby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default class Alby implements Connector {
private config: Config;
private _client: Client | undefined;
private _authUser: auth.OAuth2User | undefined;
private _cache = new Map<string, object>();

constructor(account: Account, config: Config) {
this.account = account;
Expand Down Expand Up @@ -117,16 +118,27 @@ export default class Alby implements Connector {
async getInfo(): Promise<
GetInfoResponse<WebLNNode & GetAccountInformationResponse>
> {
const cacheKey = "getInfo";
const cacheValue = this._cache.get(cacheKey) as GetInfoResponse<
WebLNNode & GetAccountInformationResponse
>;
if (cacheValue) {
return cacheValue;
}

try {
const info = await this._request((client) =>
client.accountInformation({})
);
return {
const returnValue = {
data: {
...info,
alias: "🐝 getalby.com",
},
};
this._cache.set(cacheKey, returnValue);

return returnValue;
} catch (error) {
console.error(error);
throw error;
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"48": "assets/icons/alby_icon_yellow_48x48.png",
"128": "assets/icons/alby_icon_yellow_128x128.png"
},
"description": "Your Bitcoin Lightning wallet and companion for accessing Bitcoin and Nostr apps, payments across the globe and passwordless logins.",
"description": "Your Bitcoin Lightning wallet and companion for accessing Bitcoin and Nostr apps, digital payments and passwordless logins.",
"homepage_url": "https://getAlby.com/",
"permissions": [
"nativeMessaging",
Expand Down

0 comments on commit edb0acd

Please sign in to comment.