Skip to content

Commit e998a06

Browse files
authored
fix: use correct store value for limit alert (tari-project#101)
Description --- - accidentally left in the old store values for the limit error in tari-project#100 - used the correct one from `useBridgeStore` - removed the old items from account store Motivation and Context --- - daily limit warning wasn't coming up in TU 😬 How Has This Been Tested? --- - locally (built and moved over to binaries' location to test in TU) https://github.com/user-attachments/assets/80293015-29e7-4c99-8b09-08bc9d38441e
1 parent 0486c35 commit e998a06

4 files changed

Lines changed: 9 additions & 12 deletions

File tree

components/main/main.component.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ import { HomeText } from './home-text'
1010
import { useTariAccountStore } from '@/store/account'
1111

1212
import { useBridgeStatus } from '@/hooks/use-bridge-status'
13+
import { useBridgeStore } from '@/store/bridge'
1314

1415
// TODO - add translation keys
1516

1617
export const MainComponent = ({ remainingDailyLimit }: MainComponentProps) => {
1718
const { t } = useTranslation('main', { useSuspense: false })
1819
const [showHistory, setShowHistory] = useState(false)
19-
const exceededDailyLimit = useTariAccountStore((s) => s.exceededDailyLimit)
20+
const exceededDailyLimit = useBridgeStore((s) => s.exceededDailyLimit)
2021
const bridgeTxs = useTariAccountStore((s) => s.combinedBridgeTxs)
2122

2223
const { isOffline } = useBridgeStatus()
@@ -39,9 +40,9 @@ export const MainComponent = ({ remainingDailyLimit }: MainComponentProps) => {
3940
const mainMarkup = !isOffline ? (
4041
<div className="mt-6">
4142
{exceededDailyLimit && (
42-
<div className="flex items-center justify-center w-[clamp(450px,45vw,60%)]">
43-
<div className="py-4 px-2 rounded-2xl bg-white/25 backdrop-blur-sm shadow-lg">
44-
<div className="font-normal leading-none text-lg text-center text-balance ">
43+
<div className="flex items-center justify-center w-[clamp(480px,50vw,800px)]">
44+
<div className="p-4 rounded-2xl bg-white/25 backdrop-blur-sm shadow-lg">
45+
<div className="font-light leading-none text-[16px] text-center text-pretty text-balance">
4546
We cannot process your transaction because{' '}
4647
<span className="font-medium">the transaction limit has been reached for the day.</span> Please try again
4748
tomorrow.

components/modals/main-modal/main-modal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ export const MainModal = ({
5858
setExceededDailyLimit(false)
5959
})
6060
.catch((e) => {
61-
console.error('[ TAPPLET-BRIDGE ] Bridge operation failed:', e)
6261
const error = e as Error
6362
const isLimitError =
64-
error?.message?.includes(DAILY_LIMIT_ERROR_TYPE) || error?.message?.includes(DAILY_LIMIT_ERROR)
65-
setExceededDailyLimit(isLimitError)
63+
error?.message?.includes(DAILY_LIMIT_ERROR) || error?.message?.includes(DAILY_LIMIT_ERROR_TYPE)
6664
if (isLimitError) {
65+
console.warn('[ TAPPLET-BRIDGE ] Bridge operation failed:', e)
66+
setExceededDailyLimit(true)
6767
setIsModalOpen(false)
6868
}
6969
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wxtm-bridge-frontend",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"private": true,
55
"type": "module",
66
"scripts": {

store/account.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ interface TariL1WalletStoreState {
1212
backendUnwrapTxs: BackendUnwrapTransaction[]
1313
combinedBridgeTxs: CombinedBridgeTransaction[]
1414
detailedTx?: CombinedBridgeTransaction | null
15-
exceededDailyLimit: boolean
1615
}
1716

1817
const initialState: TariL1WalletStoreState = {
@@ -26,7 +25,6 @@ const initialState: TariL1WalletStoreState = {
2625
backendBridgeTxs: [],
2726
backendUnwrapTxs: [],
2827
combinedBridgeTxs: [],
29-
exceededDailyLimit: false,
3028
}
3129

3230
export const useTariAccountStore = create<TariL1WalletStoreState>()(() => ({
@@ -115,5 +113,3 @@ export const setDetailedTx = (detailedTx: CombinedBridgeTransaction | null) =>
115113
useTariAccountStore.setState({
116114
detailedTx: detailedTx,
117115
})
118-
export const setExceededDailyLimit = (exceededDailyLimit: boolean) =>
119-
useTariAccountStore.setState({ exceededDailyLimit })

0 commit comments

Comments
 (0)