Skip to content

Commit 303012a

Browse files
Copilot0xrinegade
andcommitted
Fix critical bugs: wallet truncation, filtering logic, price sync, and styling consistency
Co-authored-by: 0xrinegade <[email protected]>
1 parent 550d723 commit 303012a

File tree

4 files changed

+31
-11
lines changed

4 files changed

+31
-11
lines changed

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const SVM_NETWORKS = {
3131
'solana': {
3232
name: 'Solana',
3333
endpoint: clusterApiUrl('devnet'),
34-
programId: 'YOUR_SOLANA_PROGRAM_ID',
34+
programId: 'FKkTQLgBE9vDZqgXKWrXZfAv5HgCQdsjDZDzPfJosPt9',
3535
icon: '/images/solana-logo.svg',
3636
color: '#9945FF',
3737
explorerUrl: 'https://explorer.solana.com',

src/components/OfferCreation.js

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,19 @@ const OfferCreation = ({ onStartGuidedWorkflow }) => {
203203
}
204204
};
205205

206+
// Calculate SOL amount based on fiat amount using real prices
207+
const handleFiatAmountChange = (e) => {
208+
const fiat = e.target.value;
209+
setFiatAmount(fiat);
210+
211+
if (fiat && !isNaN(fiat) && prices && prices[fiatCurrency] && prices[fiatCurrency] > 0) {
212+
const calculatedSol = (parseFloat(fiat) / prices[fiatCurrency]).toFixed(6);
213+
setSolAmount(calculatedSol);
214+
} else if (!fiat) {
215+
setSolAmount('');
216+
}
217+
};
218+
206219
// Update fiat amount when currency changes using real prices
207220
const handleCurrencyChange = (e) => {
208221
setFiatCurrency(e.target.value);
@@ -327,7 +340,7 @@ const OfferCreation = ({ onStartGuidedWorkflow }) => {
327340
id="fiatAmount"
328341
type="number"
329342
value={fiatAmount}
330-
onChange={(e) => setFiatAmount(e.target.value)}
343+
onChange={handleFiatAmountChange}
331344
placeholder="0.00"
332345
min={VALIDATION_CONSTRAINTS.FIAT_AMOUNT.min}
333346
max={VALIDATION_CONSTRAINTS.FIAT_AMOUNT.max}
@@ -441,16 +454,20 @@ const OfferCreation = ({ onStartGuidedWorkflow }) => {
441454
}
442455
443456
.guided-workflow-button {
444-
background-color: var(--color-primary);
445-
color: white;
446-
border: none;
457+
background-color: var(--ascii-neutral-700);
458+
color: var(--ascii-white);
459+
border: 1px solid var(--ascii-neutral-800);
447460
padding: 8px 16px;
448461
border-radius: 0;
449462
cursor: pointer;
450463
font-size: 0.9rem;
451464
display: flex;
452465
align-items: center;
453466
gap: 8px;
467+
font-family: 'Courier New', Courier, monospace;
468+
text-transform: uppercase;
469+
transition: all var(--transition-normal);
470+
box-shadow: var(--shadow-sm);
454471
}
455472
456473
.guided-workflow-button::before {
@@ -460,14 +477,17 @@ const OfferCreation = ({ onStartGuidedWorkflow }) => {
460477
justify-content: center;
461478
width: 18px;
462479
height: 18px;
463-
background-color: rgba(255, 255, 255, 0.3);
480+
background-color: var(--ascii-neutral-500);
481+
border: 1px solid var(--ascii-neutral-600);
464482
border-radius: 0;
465483
font-size: 0.8rem;
466484
font-weight: bold;
467485
}
468486
469487
.guided-workflow-button:hover {
470-
background-color: var(--color-primary-dark);
488+
background-color: var(--ascii-neutral-600);
489+
transform: translateY(-1px);
490+
box-shadow: var(--shadow-md);
471491
}
472492
473493
.input-error {

src/components/OfferList.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ const OfferRow = React.memo(({ offer, type, processingAction, handleOfferAction,
149149
<div className="offer-card-header">
150150
<div className="seller-info">
151151
<span className="seller-name">
152-
{offer.seller.substring(0, 8)}...{offer.seller.substring(offer.seller.length - 4)}
152+
{offer.seller.substring(0, 8)}...{offer.seller.slice(-4)}
153153
</span>
154154
</div>
155155
<div className="time-info">
@@ -344,11 +344,11 @@ const OfferList = ({ type = 'buy', onStartGuidedWorkflow}) => {
344344

345345
// Calculate rate for each offer for sorting purposes
346346
const offersWithRate = useMemo(() => {
347-
return filteredOffers.map(offer => ({
347+
return offers.map(offer => ({
348348
...offer,
349349
rate: offer.fiatAmount / offer.solAmount
350350
}));
351-
}, [filteredOffers]);
351+
}, [offers]);
352352

353353
// Sort the filtered offers
354354
const sortedOffers = useMemo(() => {

src/components/UserStatistics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const UserStatistics = () => {
117117
<h2>Your Trading Statistics</h2>
118118
<div className="user-wallet-info">
119119
<span className="wallet-address">
120-
{wallet.publicKey?.toString().substring(0, 8)}...{wallet.publicKey?.toString().substring(-4)}
120+
{wallet.publicKey?.toString().substring(0, 8)}...{wallet.publicKey?.toString().slice(-4)}
121121
</span>
122122
{renderReputationBadge()}
123123
</div>

0 commit comments

Comments
 (0)