Please wait while we the fetch payment details.
} {paymentStatus === PaymentStatus.NOT_PAID &&You did not confirm the payment. Please try again.
} + {paymentStatus === PaymentStatus.NETWORK_ERROR &&A network error happened while fetching data.
} {paymentStatus === PaymentStatus.PAID &&The invoice was paid! Please wait while we confirm it.
} {paymentStatus === PaymentStatus.AWAITING_PAYMENT &&Waiting for your payment...
} {paymentStatus === PaymentStatus.PAYMENT_CONFIRMED &&Thanks for your vote
} - {paymentStatus === PaymentStatus.PAYMENT_CONFIRMED &&
Help fund BOLT🔩FUN, as well as other Makers working on lightning apps through tournaments and prize pools
diff --git a/src/features/Donations/pages/DonatePage/Header/styles.module.scss b/src/features/Donations/pages/DonatePage/Header/styles.module.scss
index dad6686..41b3dcd 100644
--- a/src/features/Donations/pages/DonatePage/Header/styles.module.scss
+++ b/src/features/Donations/pages/DonatePage/Header/styles.module.scss
@@ -2,6 +2,7 @@
.header {
padding: 56px 0;
+ min-height: calc(min(1080px, 90vh));
background: #ffecf9;
background: linear-gradient(40deg, white -5%, #ffb7d963 74%, #e3faff61 100%);
@@ -12,8 +13,4 @@
& > div {
grid-area: content;
}
-
- @include gt-md {
- padding: 156px 0;
- }
}
diff --git a/src/utils/hooks/index.ts b/src/utils/hooks/index.ts
index e58a234..9b81126 100644
--- a/src/utils/hooks/index.ts
+++ b/src/utils/hooks/index.ts
@@ -6,3 +6,4 @@ export * from "./useReachedBottom";
export * from "./useAutoResizableTextArea";
export * from "./useCopyToClipboard";
export * from "./useVote";
+export * from './useWindowSize'
diff --git a/src/utils/hooks/useVote/useVote.tsx b/src/utils/hooks/useVote/useVote.tsx
index f5808bf..e5f62b4 100644
--- a/src/utils/hooks/useVote/useVote.tsx
+++ b/src/utils/hooks/useVote/useVote.tsx
@@ -11,10 +11,13 @@ export enum PaymentStatus {
AWAITING_PAYMENT,
PAYMENT_CONFIRMED,
NOT_PAID,
- CANCELED
+ CANCELED,
+ NETWORK_ERROR
}
+
+
export const useVote = ({ itemId, itemType }: {
itemType: Vote_Item_Type,
itemId: number
@@ -81,8 +84,10 @@ export const useVote = ({ itemId, itemType }: {
},
onError: (error) => {
+ setPaymentStatus(PaymentStatus.NETWORK_ERROR);
config?.onError?.(error);
config?.onSetteled?.();
+ alert("A network error happened while confirming the payment...")
}
})
} catch (error) {
@@ -96,18 +101,20 @@ export const useVote = ({ itemId, itemType }: {
},
onError: (error) => {
console.log(error);
- alert("Something wrong happened...")
- setPaymentStatus(PaymentStatus.NOT_PAID);
+ setPaymentStatus(PaymentStatus.NETWORK_ERROR);
config?.onError?.(error);
config?.onSetteled?.();
+ alert("A network error happened...")
}
})
}, [confirmVote, itemId, itemType, voteMutaion]);
+ const isLoading = paymentStatus !== PaymentStatus.DEFAULT && paymentStatus !== PaymentStatus.PAYMENT_CONFIRMED && paymentStatus !== PaymentStatus.NOT_PAID && paymentStatus !== PaymentStatus.NETWORK_ERROR
return {
paymentStatus,
- vote
+ vote,
+ isLoading,
}
}
\ No newline at end of file
diff --git a/src/utils/hooks/useWindowSize.ts b/src/utils/hooks/useWindowSize.ts
new file mode 100644
index 0000000..59df959
--- /dev/null
+++ b/src/utils/hooks/useWindowSize.ts
@@ -0,0 +1,33 @@
+import { useState, useEffect } from "react";
+
+// Define general type for useWindowSize hook, which includes width and height
+interface Size {
+ width: number | undefined;
+ height: number | undefined;
+}
+// Hook
+export function useWindowSize(): Size {
+ // Initialize state with undefined width/height so server and client renders match
+ // Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/
+ const [windowSize, setWindowSize] = useState