Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: added the padding on listing, sales, transfer table and update… #671

Merged
merged 3 commits into from
Jan 23, 2025
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
23 changes: 10 additions & 13 deletions client/hooks/useSRC20Form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { fetchBTCPriceInUSD } from "$lib/utils/balanceUtils.ts";
import { Config } from "$globals";
import { logger } from "$lib/utils/logger.ts";
import { debounce } from "$lib/utils/debounce.ts";
import { showNotification } from "$lib/utils/notificationUtils.ts";
interface PSBTFees {
estMinerFee: number;
totalDustValue: number;
Expand Down Expand Up @@ -503,10 +504,11 @@ export function useSRC20Form(
);

if (walletResult.signed) {
setSubmissionMessage({
message: "Transaction broadcasted successfully.",
txid: walletResult.txid,
});
showNotification(
"Transaction Successfully.",
walletResult.txid,
"success",
);
} else if (walletResult.cancelled) {
setSubmissionMessage({
message: "Transaction signing cancelled by user.",
Expand Down Expand Up @@ -599,15 +601,10 @@ export function useSRC20Form(
error: error instanceof Error ? error.message : String(error),
details: error,
});

if (error instanceof Error) {
const apiError = (error as any).response?.data?.error;
setApiError(
apiError || error.message || "An unexpected error occurred",
);
} else {
setApiError("An unexpected error occurred");
}
const apiError = (error as any).response?.data?.error;
setApiError(
apiError || error.message || "An unexpected error occurred",
);
} finally {
setIsSubmitting(false);
}
Expand Down
8 changes: 4 additions & 4 deletions components/shared/fee/FeeCalculatorBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ export function FeeCalculatorBase({

{/* Sats Per Byte */}
<p className={detailsText}>
<span className={detailsTitle}>SATS PER BYTE</span> {/* {fee} */}
<span className={detailsTitle}>SATS PER BYTE</span> {fee}
</p>

{/* Miner Fee */}
{feeDetails?.minerFee && (
{!!feeDetails?.minerFee && (
<p className={detailsText}>
<span className={detailsTitle}>MINER FEE</span> {coinType === "BTC"
? formatSatoshisToBTC(feeDetails.minerFee, {
Expand Down Expand Up @@ -263,7 +263,7 @@ export function FeeCalculatorBase({
)}

{/* Dust Value */}
{feeDetails?.dustValue && feeDetails.dustValue > 0 && (
{!!feeDetails?.dustValue && (
<p className={detailsText}>
<span className={detailsTitle}>DUST</span> {coinType === "BTC"
? formatSatoshisToBTC(feeDetails.dustValue, {
Expand All @@ -275,7 +275,7 @@ export function FeeCalculatorBase({
)}

{/* Total */}
{feeDetails?.totalValue && (
{!!feeDetails?.totalValue && (
<p className={detailsText}>
<span className={detailsTitle}>TOTAL</span> {coinType === "BTC"
? formatSatoshisToBTC(feeDetails.totalValue, {
Expand Down
1 change: 1 addition & 0 deletions components/stampDetails/StampListingsAll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export function StampListingsAll({ dispensers }: StampListingsAllProps) {
{header}
</th>
))}
<th class="min-w-3 min-[660px]:hidden block" />
</tr>
</thead>
)}
Expand Down
1 change: 1 addition & 0 deletions components/stampDetails/StampSales.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function StampSales({ dispenses }: StampSalesProps) {
{header}
</th>
))}
<th class="min-w-3 min-[660px]:hidden block" />
</tr>
</thead>
)}
Expand Down
1 change: 1 addition & 0 deletions components/stampDetails/StampTransfers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export function StampTransfers({ sends }: StampTransfersProps) {
{header}
</th>
))}
<th class="min-w-3 min-[660px]:hidden block" />
</tr>
</thead>
)}
Expand Down
1 change: 1 addition & 0 deletions components/tokenDetails/TokenMints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function TokenMints({ mints }: TokenMintsProps) {
{header}
</th>
))}
<th class="min-w-3 min-[660px]:hidden block" />
</tr>
</thead>
)}
Expand Down
1 change: 1 addition & 0 deletions components/tokenDetails/TokenTransfers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export function TokenTransfers({ sends }: TokenTransfersProps) {
{header}
</th>
))}
<th class="min-w-3 min-[660px]:hidden block" />
</tr>
</thead>
)}
Expand Down
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"redis": "https://deno.land/x/redis@v0.32.4/mod.ts",
"swiper/": "https://esm.sh/swiper@11.1.14/",
"swiper": "https://esm.sh/swiper@11.1.14",
"sweetalert2": "https://esm.sh/sweetalert2@11.15.10",
"tailwindcss": "npm:tailwindcss@3.4.1",
"tailwindcss/": "npm:tailwindcss@3.4.1/",
"tailwindcss/plugin": "npm:tailwindcss@3.4.1/plugin.js",
Expand Down
3 changes: 1 addition & 2 deletions islands/shared/Tables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function Table({
}: TableProps) {
const [selectedTab, setSelectedTab] = useState<string>(configs[0].id);
const [tabData, setTabData] = useState<TabData>({});
const [isLoading, setIsLoading] = useState(false);
const [isLoading, setIsLoading] = useState(true);
const [page, setPage] = useState(1);
const [hasMore, setHasMore] = useState(true);
const [totalCounts, setTotalCounts] = useState(initialCounts);
Expand All @@ -51,7 +51,6 @@ export default function Table({
tabId: string,
isTabChange = false,
) => {
if (isLoading) return;
if (!isTabChange && !hasMore) return;

setIsLoading(true);
Expand Down
3 changes: 2 additions & 1 deletion islands/stamping/src20/deploy/DeployContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ export function DeployContent(
});

setFileUploadError(
`File upload failed: ${errorMessage}. The deployment will continue without the background image.`,
// `File upload failed: ${errorMessage}. The deployment will continue without the background image.`,
`File upload failed: The deployment will continue without the background image.`,
);
}
};
Expand Down
3 changes: 3 additions & 0 deletions islands/stamping/stamp/OlgaContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ function extractErrorMessage(error: unknown): string {
path: "error.message",
value: err.response?.data?.error,
});
if (err.response?.data?.error?.includes("Insufficient funds")) {
return "Insufficient funds to cover outputs and fees";
}
return err.response?.data?.error;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/utils/apiResponseUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class ApiResponseUtil {

static internalError(
error: unknown,
message = "Internal server error",
message: string = "Internal server error",
options: ApiResponseOptions = {},
): Response {
console.error("Internal Error:", error);
Expand Down
18 changes: 18 additions & 0 deletions lib/utils/notificationUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Swal from "sweetalert2";

const ButtonClassNames =
"inline-flex items-center justify-center border-2 border-solid border-stamp-purple rounded-md text-sm mobileLg:text-base font-extrabold text-stamp-purple tracking-[0.05em] h-[42px] mobileLg:h-[48px] px-4 mobileLg:px-5 hover:border-stamp-purple-highlight hover:text-stamp-purple-highlight transition-colors";

export function showNotification(title: string, text: string, icon: string) {
Swal.fire({
title: title || "Notification",
text: text || "",
icon: icon || "info",
background:
"linear-gradient(to bottom right,#1f002e00,#14001f7f,#1f002e),#000",
confirmButtonText: "O K",
customClass: {
confirmButton: ButtonClassNames,
},
});
}
2 changes: 1 addition & 1 deletion routes/api/v2/src20/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const handler: Handlers<TX | TXError> = {
message: "Error processing request",
error: error instanceof Error ? error.message : String(error),
});
return ApiResponseUtil.internalError(error);
return ApiResponseUtil.internalError(error, error as string);
}
},
};
Loading
Loading