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

Feat/not showing transaction count on 0 #177

Merged
merged 2 commits into from
Aug 17, 2024
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
5 changes: 5 additions & 0 deletions .changeset/ninety-kings-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@skip-go/widget': patch
---

not showing 0 transaction remaining
20 changes: 11 additions & 9 deletions packages/widget/src/ui/PreviewRoute/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ export const PreviewRoute = ({
const getChain = (chainID: string) =>
chains?.find((chain) => chain.chainID === chainID);
const { makeWallets } = useMakeWallets();
const { onTransactionBroadcasted, onTransactionComplete, onTransactionFailed } =
useCallbackStore.getState();
const {
onTransactionBroadcasted,
onTransactionComplete,
onTransactionFailed,
} = useCallbackStore.getState();

const [isExpanded, setIsExpanded] = useState(() =>
route.chainIDs.length === 2 ? true : false
Expand Down Expand Up @@ -261,9 +264,8 @@ export const PreviewRoute = ({
throw new Error('User rejected request');
}
onTransactionFailed?.({
error: err instanceof Error
? `${err.name}: ${err.message}`
: String(err)
error:
err instanceof Error ? `${err.name}: ${err.message}` : String(err),
});
throw err;
}
Expand All @@ -278,9 +280,8 @@ export const PreviewRoute = ({
onError: (err: unknown) => {
console.error(err);
onTransactionFailed?.({
error: err instanceof Error
? `${err.name}: ${err.message}`
: String(err)
error:
err instanceof Error ? `${err.name}: ${err.message}` : String(err),
});
toast(
({ createdAt, id }) => (
Expand Down Expand Up @@ -577,7 +578,8 @@ export const PreviewRoute = ({
<div className="space-y-4">
{!submitMutation.isError && !submitMutation.isSuccess && (
<div className="flex w-full items-center justify-center space-x-2 text-sm font-medium">
{route.txsRequired > 1 ? (
{route.txsRequired > 1 &&
route.txsRequired - broadcastedTxs.length !== 0 ? (
<>
<div className="relative rounded-full bg-[#FF486E] p-[4px]">
<div className="absolute h-6 w-6 animate-ping rounded-full bg-[#FF486E]" />
Expand Down
Loading