Skip to content

Commit f0b354d

Browse files
updated remaining pages and fixed Package file
1 parent 7b5cf9b commit f0b354d

File tree

5 files changed

+38
-13
lines changed

5 files changed

+38
-13
lines changed

tabs/backend/data.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"rewardName": "Sats"
3-
}
2+
"rewardName": "coins"
3+
}

tabs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"react-router-dom": "^6.26.1",
2626
"react-scripts": "5.0.1",
2727
"react-toastify": "^11.0.5",
28-
"web-vitals": "^2.1.4"
28+
"web-vitals": "^2.1.4",
2929
"webrtc-adapter": "^9.0.1"
3030

3131
},

tabs/src/components/WalletAllowanceComponent.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import React, { useEffect, useState } from 'react';
1+
import React, { useEffect, useState, useContext } from 'react';
22
import './WalletAllowanceComponent.css'; // Assuming you'll use CSS for styling
33
import BatteryImageDisplay from './BatteryImageDisplay';
44
import ArrowClockwise from '../images/ArrowClockwise.svg';
55
import Calendar from '../images/Calendar.svg';
66
import { getAllowance, getUsers, getWalletTransactionsSince } from '../services/lnbitsServiceLocal';
77
import { useMsal } from '@azure/msal-react';
88
import WalletTransactionLog from './WalletTransactionLog';
9+
import { RewardNameContext } from './RewardNameContext';
910

1011
const adminKey = process.env.REACT_APP_LNBITS_ADMINKEY as string;
1112
let spentSats =0
@@ -58,7 +59,11 @@ const WalletAllowanceCard: React.FC<AllowanceCardProps> = () => {
5859

5960
fetchAmountReceived();
6061
}, [accounts]);
61-
62+
const rewardNameContext = useContext(RewardNameContext);
63+
if (!rewardNameContext) {
64+
return null; // or handle the case where the context is not available
65+
}
66+
const rewardsName = rewardNameContext.rewardName;
6267
return (
6368
<div className="wallet-container">
6469
<div className="wallet-header">
@@ -75,7 +80,7 @@ const WalletAllowanceCard: React.FC<AllowanceCardProps> = () => {
7580
<div className="amountDisplay">
7681
{balance?.toLocaleString() ?? '0'}
7782
</div>
78-
<div>Sats</div>
83+
<div>{rewardsName}</div>
7984
<div style={{ paddingLeft: '20px', display: 'none' }}>
8085
<button className="refreshImageIcon">
8186
<img
@@ -102,7 +107,7 @@ const WalletAllowanceCard: React.FC<AllowanceCardProps> = () => {
102107
<div className="remaining smallTextFont">Next allowance</div>
103108
<div className="remaining smallTextFont">
104109
{allowance ? allowance.amount.toLocaleString() : '0'}{' '}
105-
<span>Sats</span>
110+
<span>{rewardsName}</span>
106111
</div>
107112
<div className="remaining smallTextFont">
108113
<div>
@@ -131,10 +136,10 @@ const WalletAllowanceCard: React.FC<AllowanceCardProps> = () => {
131136
</div>
132137
<div className="col-md-3">
133138
<div className="spent smallTextFont">
134-
<b>{balance?.toLocaleString() ?? '0'}</b> Sats
139+
<b>{balance?.toLocaleString() ?? '0'}</b> {rewardsName}
135140
</div>
136141
<div className="spent smallTextFont">
137-
<b>{spentSats?.toLocaleString()}</b> Sats
142+
<b>{spentSats?.toLocaleString()}</b> {rewardsName}
138143
</div>
139144
</div>
140145
</div>

tabs/src/components/WalletInfoCard.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
import React, { useEffect, useState } from 'react';
1+
import React, { useEffect, useState, useContext } from 'react';
22
import './WalletInfoCard.css';
33
import ArrowClockwise from '../images/ArrowClockwise.svg';
44
import { getUsers } from '../services/lnbitsServiceLocal';
55
import { useMsal } from '@azure/msal-react';
66
import SendPayment from './SendPayment';
77
import ReceivePayment from './ReceivePayment';
8+
import { RewardNameContext } from './RewardNameContext';
89

910
const adminKey = process.env.REACT_APP_LNBITS_ADMINKEY as string;
1011

12+
1113
const WalletYourWalletInfoCard: React.FC = () => {
14+
1215
const [balance, setBalance] = useState<number>();
1316

1417
const [isReceivePopupOpen, setIsReceivePopupOpen] = useState(false);
@@ -34,6 +37,8 @@ const WalletYourWalletInfoCard: React.FC = () => {
3437
}
3538
};
3639

40+
41+
3742
useEffect(() => {
3843
fetchAmountReceived();
3944
});
@@ -53,6 +58,12 @@ const WalletYourWalletInfoCard: React.FC = () => {
5358
setIsSendPopupOpen(false);
5459
};
5560

61+
const rewardNameContext = useContext(RewardNameContext);
62+
if (!rewardNameContext) {
63+
return null; // or handle the case where the context is not available
64+
}
65+
const rewardsName = rewardNameContext.rewardName;
66+
5667
// Buttons should be disabled if balance is undefined (still loading)
5768
const isLoading = false; // balance === undefined;
5869

@@ -65,7 +76,7 @@ const WalletYourWalletInfoCard: React.FC = () => {
6576
{' '}
6677
<h1>{balance?.toLocaleString() ?? '0'}</h1>
6778
</div>
68-
<div className="item">Sats</div>
79+
<div className="item">{rewardsName}</div>
6980
<div
7081
className="col-md-1 item"
7182
style={{ paddingTop: '30px', paddingLeft: '10px' }}

tabs/src/components/WalletTransactionLog.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useState } from 'react';
1+
import React, { useEffect, useState, useContext } from 'react';
22
import styles from './WalletTransactionLog.module.css';
33
import {
44
getUsers,
@@ -8,6 +8,7 @@ import ArrowIncoming from '../images/ArrowIncoming.svg';
88
import ArrowOutgoing from '../images/ArrowOutcoming.svg';
99
import moment from 'moment';
1010
import { useMsal } from '@azure/msal-react';
11+
import { RewardNameContext } from './RewardNameContext';
1112

1213
interface WalletTransactionLogProps {
1314
activeTab?: string;
@@ -120,6 +121,12 @@ const WalletTransactionLog: React.FC<WalletTransactionLogProps> = ({
120121
getAllUsers();
121122
fetchTransactions();
122123
}, [activeTab, activeWallet]);
124+
125+
const rewardNameContext = useContext(RewardNameContext);
126+
if (!rewardNameContext) {
127+
return null; // or handle the case where the context is not available
128+
}
129+
const rewardsName = rewardNameContext.rewardName;
123130

124131
if (loading) {
125132
return <div>Loading...</div>;
@@ -137,6 +144,8 @@ const WalletTransactionLog: React.FC<WalletTransactionLogProps> = ({
137144
return <div>{error}</div>;
138145
}
139146

147+
148+
140149
return (
141150
<div className={styles.feedlist}>
142151
{transactions
@@ -218,7 +227,7 @@ const WalletTransactionLog: React.FC<WalletTransactionLogProps> = ({
218227
? transaction.amount / 1000
219228
: '+' + transaction.amount / 1000}
220229
</b>{' '}
221-
Sats{' '}
230+
{rewardsName}{' '}
222231
</div>
223232
<div
224233
style={{ display: 'none' }}

0 commit comments

Comments
 (0)