Skip to content

Commit 53dbfed

Browse files
committed
chore: notification on persistency
1 parent 1dd26b5 commit 53dbfed

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/features/storage/storageHooks.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { GatewayTransaction } from "@renproject/ren";
44
import { TransactionParams } from "@renproject/ren/build/module/params";
55
import { useCallback, useState } from "react";
66
import { useSelector } from "react-redux";
7+
import { useNotifications } from "../../providers/Notifications";
78
import { $network } from "../network/networkSlice";
89

910
const useLocalStorage = <T>(
@@ -118,6 +119,7 @@ export const useTxsStorage = () => {
118119
[findLocalTx]
119120
);
120121

122+
const { showNotification } = useNotifications();
121123
const persistLocalTx: LocalTxPersistor = useCallback(
122124
(web3Address, tx, done = false, meta) => {
123125
console.log("tx: persisting local tx", web3Address, tx, done);
@@ -131,7 +133,14 @@ export const useTxsStorage = () => {
131133
}
132134

133135
setLocalTxs((txs) => {
134-
const current = (txs[web3Address] || {})[tx.hash] || {};
136+
const empty = {};
137+
const current = (txs[web3Address] || {})[tx.hash] || empty;
138+
if (current !== empty) {
139+
showNotification(
140+
"Bookmark this page to ensure you don’t lose track of your transaction.",
141+
{ variant: "info" }
142+
);
143+
}
135144
// don't overwrite done transactions;
136145
if (current.done) {
137146
return txs;
@@ -152,7 +161,7 @@ export const useTxsStorage = () => {
152161
};
153162
});
154163
},
155-
[setLocalTxs]
164+
[setLocalTxs, showNotification]
156165
);
157166

158167
const removeLocalTx: LocalTxRemover = useCallback(

src/theme/colors.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const alertWarning = "#AD5700";
5454
export const alertWarningBackground = "#FBF3E9";
5555

5656
export const alertInfo = "#5027E2";
57-
export const alertInfoBackground = "#F7F3FF";
57+
export const alertInfoBackground = "#f7f3ff";
5858
export const alertError = "#D60000";
5959
export const alertErrorBackground = "#FBE8E8";
6060

0 commit comments

Comments
 (0)