Skip to content

Commit

Permalink
Merge pull request #423 from cardano-foundation/chore/improve-logging
Browse files Browse the repository at this point in the history
chore(cip-1694-ui)
  • Loading branch information
vetalcore authored Oct 6, 2023
2 parents 8957e23 + 5fc634d commit 8a9fb97
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion ui/cip-1694/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ REACT_APP_TARGET_NETWORK=PREPROD

REACT_APP_EVENT_ID=CIP-1694_Pre_Ratification_4619

REACT_APP_SUPPORTED_WALLETS=flint,eternl,nami,typhoncip30,yoroi,nufi,gerowallet,lace
REACT_APP_SUPPORTED_WALLETS=flint,eternl,nami,typhoncip30,yoroi,nufi,gerowallet,lace,begin,cardwallet
5 changes: 4 additions & 1 deletion ui/cip-1694/src/common/utils/voteUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ export const getSignedMessagePromise = (signMessage: ReturnType<typeof useCardan
signMessage(
message,
(signature, key) => resolve({ coseSignature: signature, cosePublicKey: key || '' }),
(error: Error) => reject(error)
(error: Error) => {
console.log(error);
return reject(error);
}
);
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type ConnectWalletModalProps = {
title: string;
description: string;
onConnectWallet: () => void;
onConnectWalletError: () => void;
onConnectWalletError: (walletName: string, error: Error) => void;
onCloseFn: () => void;
};

Expand Down
3 changes: 2 additions & 1 deletion ui/cip-1694/src/components/common/Content/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export const Content = () => {
debouncedToast(<Toast message="Wallet Connected!" />);
}, [dispatch, debouncedToast]);

const onConnectWalletError = useCallback(() => {
const onConnectWalletError = useCallback((walletName: string, error: Error) => {
console.log(walletName, error);
toast(
<Toast
error
Expand Down
20 changes: 4 additions & 16 deletions ui/cip-1694/src/pages/Vote/Vote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,10 @@ export const VotePage = () => {
useEffect(() => {
const session = getUserInSession();

if (
tip?.absoluteSlot &&
stakeAddress &&
event?.notStarted === false &&
((session && tokenIsExpired(session.expiresAt)) || !session)
) {
if (stakeAddress && event?.notStarted === false && ((session && tokenIsExpired(session.expiresAt)) || !session)) {
setIsConfirmWithWalletSignatureModalVisible(true);
}
}, [event?.notStarted, tip?.absoluteSlot, stakeAddress]);
}, [event?.notStarted, stakeAddress]);

const items: OptionItem<ProposalPresentation['name']>[] = event?.categories
?.find(({ id }) => id === activeCategoryId)
Expand Down Expand Up @@ -200,17 +195,10 @@ export const VotePage = () => {

useEffect(() => {
const session = getUserInSession();
if (
isConnected &&
tip?.absoluteSlot &&
stakeAddress &&
session &&
!tokenIsExpired(session.expiresAt) &&
activeCategoryId
) {
if (isConnected && stakeAddress && session && !tokenIsExpired(session.expiresAt) && activeCategoryId) {
fetchReceipt({});
}
}, [fetchReceipt, isConnected, stakeAddress, tip?.absoluteSlot, activeCategoryId]);
}, [fetchReceipt, isConnected, stakeAddress, activeCategoryId]);

const openReceiptDrawer = async () => {
setIsReceiptDrawerInitializing(true);
Expand Down

0 comments on commit 8a9fb97

Please sign in to comment.