fix: wrap SOL price + wallet in shared flex group to eliminate space-between gap
This commit is contained in:
parent
090481cde0
commit
56e01f3f52
2 changed files with 44 additions and 27 deletions
|
|
@ -329,6 +329,13 @@ a:hover { color: #fff; text-shadow: none; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* === NAV SOL + WALLET GROUP === */
|
||||||
|
.nav-sol-wallet-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
/* === NAV SOL PRICE TICKER === */
|
/* === NAV SOL PRICE TICKER === */
|
||||||
.nav-sol-price {
|
.nav-sol-price {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -343,7 +350,7 @@ a:hover { color: #fff; text-shadow: none; }
|
||||||
background: rgba(153, 69, 255, 0.08);
|
background: rgba(153, 69, 255, 0.08);
|
||||||
border: 1px solid rgba(153, 69, 255, 0.25);
|
border: 1px solid rgba(153, 69, 255, 0.25);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
margin-right: 2px;
|
margin-right: 0;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
|
|
@ -390,7 +397,7 @@ a:hover { color: #fff; text-shadow: none; }
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-wallet-btn {
|
.nav-wallet-btn {
|
||||||
|
|
|
||||||
60
js/nav.js
60
js/nav.js
|
|
@ -86,9 +86,8 @@
|
||||||
// Bind mobile dropdown toggles after rendering
|
// Bind mobile dropdown toggles after rendering
|
||||||
initMobileDropdowns();
|
initMobileDropdowns();
|
||||||
|
|
||||||
// Inject SOL price ticker and wallet button after nav loads
|
// Inject shared wrapper for SOL price + wallet, then inject both
|
||||||
injectSolPrice();
|
injectSolWalletGroup();
|
||||||
injectWalletButton();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn('Nav load failed, keeping existing:', err);
|
console.warn('Nav load failed, keeping existing:', err);
|
||||||
}
|
}
|
||||||
|
|
@ -151,10 +150,35 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── SOL Price Ticker ──────────────────────────────────────
|
// ─── SOL + Wallet Group Wrapper ────────────────────────────
|
||||||
function injectSolPrice() {
|
function injectSolWalletGroup() {
|
||||||
const navContainer = document.querySelector('.nav-container');
|
const navContainer = document.querySelector('.nav-container');
|
||||||
if (!navContainer || document.getElementById('navSolPrice')) return;
|
const navStatus = document.querySelector('.nav-status');
|
||||||
|
if (!navContainer) return;
|
||||||
|
|
||||||
|
// Don't inject twice
|
||||||
|
if (document.getElementById('navSolWalletGroup')) return;
|
||||||
|
|
||||||
|
// Create shared wrapper
|
||||||
|
const group = document.createElement('div');
|
||||||
|
group.id = 'navSolWalletGroup';
|
||||||
|
group.className = 'nav-sol-wallet-group';
|
||||||
|
|
||||||
|
// Insert before nav-status
|
||||||
|
if (navStatus) {
|
||||||
|
navContainer.insertBefore(group, navStatus);
|
||||||
|
} else {
|
||||||
|
navContainer.appendChild(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now inject SOL price and wallet into the group
|
||||||
|
injectSolPrice(group);
|
||||||
|
injectWalletButton(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── SOL Price Ticker ──────────────────────────────────────
|
||||||
|
function injectSolPrice(parent) {
|
||||||
|
if (!parent || document.getElementById('navSolPrice')) return;
|
||||||
|
|
||||||
const wrap = document.createElement('div');
|
const wrap = document.createElement('div');
|
||||||
wrap.id = 'navSolPrice';
|
wrap.id = 'navSolPrice';
|
||||||
|
|
@ -166,15 +190,7 @@
|
||||||
<span class="sol-price-change" id="solPriceChange"></span>
|
<span class="sol-price-change" id="solPriceChange"></span>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// Insert before wallet wrap or nav-status
|
parent.appendChild(wrap);
|
||||||
const walletWrap = document.getElementById('navWalletWrap');
|
|
||||||
const navStatus = document.querySelector('.nav-status');
|
|
||||||
const insertBefore = walletWrap || navStatus;
|
|
||||||
if (insertBefore) {
|
|
||||||
navContainer.insertBefore(wrap, insertBefore);
|
|
||||||
} else {
|
|
||||||
navContainer.appendChild(wrap);
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchSolPrice();
|
fetchSolPrice();
|
||||||
setInterval(fetchSolPrice, 30000);
|
setInterval(fetchSolPrice, 30000);
|
||||||
|
|
@ -222,10 +238,8 @@
|
||||||
|
|
||||||
|
|
||||||
// ─── Wallet Button Injection ────────────────────────────────
|
// ─── Wallet Button Injection ────────────────────────────────
|
||||||
function injectWalletButton() {
|
function injectWalletButton(parent) {
|
||||||
const navContainer = document.querySelector('.nav-container');
|
if (!parent) return;
|
||||||
const navStatus = document.querySelector('.nav-status');
|
|
||||||
if (!navContainer) return;
|
|
||||||
|
|
||||||
// Don't inject twice
|
// Don't inject twice
|
||||||
if (document.getElementById('navWalletWrap')) return;
|
if (document.getElementById('navWalletWrap')) return;
|
||||||
|
|
@ -242,12 +256,8 @@
|
||||||
<div class="nav-wallet-dropdown hidden" id="navWalletDropdown"></div>
|
<div class="nav-wallet-dropdown hidden" id="navWalletDropdown"></div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// Insert before nav-status (or append to container)
|
parent.appendChild(wrap);
|
||||||
if (navStatus) {
|
|
||||||
navContainer.insertBefore(wrap, navStatus);
|
|
||||||
} else {
|
|
||||||
navContainer.appendChild(wrap);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bind click
|
// Bind click
|
||||||
const btn = document.getElementById('navWalletBtn');
|
const btn = document.getElementById('navWalletBtn');
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue