Skip to content

Commit

Permalink
quick fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
diyahir committed Mar 10, 2024
1 parent 5f98fac commit 6d6061f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
36 changes: 19 additions & 17 deletions packages/nextjs/components/HistoryTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ export const HistoryTable = () => {
toastSuccess(message);
};

// function getTooltipText(transaction: HistoricalTransaction) {
// switch (transaction.status) {
// case "pending":
// return "Waiting for the transaction to be included in a block";
// case "completed":
// return "Expand for more details";
// case "failed":
// return `Transaction failed: Redeemable at ${new Date(transaction.hashLockTimestamp * 1000).toLocaleString()}`;
// case "refunded":
// return "Transaction refunded";
// default:
// return "";
// }
// }
function getTooltipText(transaction: HistoricalTransaction) {
switch (transaction.status) {
case "pending":
return "Waiting for the transaction to be included in a block";
case "completed":
return "Expand for more details";
case "failed":
return `Transaction failed: Redeemable at ${new Date(transaction.hashLockTimestamp * 1000).toLocaleString()}`;
case "refunded":
return "Transaction refunded";
default:
return "";
}
}

function refund(transaction: HistoricalTransaction) {
if (transaction.contractId === "") return;
Expand Down Expand Up @@ -71,7 +71,7 @@ export const HistoryTable = () => {
return (
<div className="card bg-brand-bg text-white">
<div className="card-body p-4">
<h2 className="text-center font-mono text-md ">History</h2>
<h2 className="text-center font-mono text-md">History</h2>
<table className="table table-auto w-full text-sm">
{transactions.length > 0 && (
<>
Expand All @@ -87,12 +87,14 @@ export const HistoryTable = () => {
<React.Fragment key={index}>
<tr
onClick={() => toggleRow(index)}
className={`cursor-pointer ${
className={`cursor-pointer ${
transaction.status === "failed" ? "bg-red-400" : ""
} hover:bg-white hover:bg-opacity-10`}
>
<td>{transaction.status}</td>
<td>{transaction.date}</td>
<td className="tooltip" data-tip={getTooltipText(transaction)}>
{transaction.date}
</td>
<td className="text-right">{transaction.amount} sats</td>
</tr>
{expandedRow === index && (
Expand Down
10 changes: 7 additions & 3 deletions packages/nextjs/components/PaymentInvoice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const PaymentInvoice = ({ invoice, submitPayment, cancelPayment, step }:
<div className="flex flex-col">
{stepInfo.title}
&nbsp;
{step === index && <span className="loading loading-spinner"></span>}
{step === index && <span className="loading loading-dots"></span>}
</div>
</li>
))}
Expand All @@ -75,14 +75,18 @@ export const PaymentInvoice = ({ invoice, submitPayment, cancelPayment, step }:
{step < 2 ? (
<div className="w-full flex justify-between">
<button
className={`btn btn-error w-2/5 text-white ${step !== 1 ? "opacity-50 cursor-not-allowed" : ""}`}
className={`btn btn-outline btn-error w-2/5 text-white ${
step !== 1 ? "opacity-50 cursor-not-allowed" : ""
}`}
onClick={() => cancelPayment()}
disabled={step == 2 || step == 3}
>
Cancel
</button>
<button
className={`btn btn-success w-2/5 text-white ${step !== 1 ? "opacity-50 cursor-not-allowed" : ""}`}
className={`btn btn-success bg-emerald-700 w-2/5 text-white ${
step !== 1 ? "opacity-50 cursor-not-allowed" : ""
}`}
onClick={() => submitPayment()}
disabled={step == 2 || step == 3}
>
Expand Down
2 changes: 0 additions & 2 deletions packages/nextjs/hooks/LightningProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export const LightningProvider = ({ children }: { children: React.ReactNode }) =
toast.success(message, {
position: "top-center",
autoClose: 5000,
theme: "colored",
toastId: Date.now().toString(),
});
};
Expand All @@ -60,7 +59,6 @@ export const LightningProvider = ({ children }: { children: React.ReactNode }) =
toast.error(message, {
position: "top-center",
autoClose: 5000,
theme: "colored",
toastId: Date.now().toString(),
});
};
Expand Down

0 comments on commit 6d6061f

Please sign in to comment.