Skip to content

Commit

Permalink
modified: index.html
Browse files Browse the repository at this point in the history
	modified:   main.js
  • Loading branch information
fractal-solutions committed Nov 19, 2024
1 parent b9df7fc commit 7af9227
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 40 deletions.
31 changes: 1 addition & 30 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,8 @@
position: relative;
margin-top: 5px;
margin-bottom: 15px;
cursor: pointer;
padding-top: 15px;
cursor: pointer;
user-select: none;
}

Expand All @@ -513,35 +513,6 @@
background: var(--accent-purple);
}

.portfolio {
padding-bottom: env(safe-area-inset-bottom, 20px);
}

.stock-container {
padding: 15px;
}

.stock-header {
flex-direction: column;
gap: 10px;
}

.stock-info {
flex-wrap: wrap;
justify-content: space-between;
}

.trade-buttons {
width: 100%;
justify-content: space-between;
}

.btn {
flex: 1;
margin: 0 5px;
}

/* Optional: Add overlay when panel is expanded */
.overlay {
display: none;
position: fixed;
Expand Down
14 changes: 4 additions & 10 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,39 +456,33 @@ initializeThemeSelector();

function initializeMobileAccountPanel() {
const accountPanel = document.getElementById('account-panel');
const header = accountPanel.querySelector('h3');

function handlePanelClick(e) {
// Only toggle if clicking the header area or drag handle
const header = accountPanel.querySelector('h3');
if (e.target === header || e.target.closest('h3')) {
accountPanel.classList.toggle('collapsed');
e.stopPropagation(); // Prevent body click handler from firing
e.stopPropagation();
}
}

function handleOutsideClick(e) {
// If panel is expanded and click is outside panel
if (!accountPanel.classList.contains('collapsed') &&
!accountPanel.contains(e.target)) {
accountPanel.classList.add('collapsed');
}
}

if (window.innerWidth <= 768) {
// Remove previous listeners if any
accountPanel.removeEventListener('touchstart', handlePanelClick);
document.body.removeEventListener('click', handleOutsideClick);

// Add click handlers
accountPanel.querySelector('h3').addEventListener('click', handlePanelClick);
header.addEventListener('click', handlePanelClick);
document.body.addEventListener('click', handleOutsideClick);

// Initialize in expanded state
accountPanel.classList.remove('collapsed');
} else {
// Remove mobile-specific classes and listeners for desktop
accountPanel.classList.remove('collapsed');
accountPanel.querySelector('h3').removeEventListener('click', handlePanelClick);
header.removeEventListener('click', handlePanelClick);
document.body.removeEventListener('click', handleOutsideClick);
}
}
Expand Down

0 comments on commit 7af9227

Please sign in to comment.