visual fix
This commit is contained in:
@@ -109,14 +109,20 @@
|
||||
<span id="volume-value">50%</span>
|
||||
</section>
|
||||
|
||||
<!-- Hidden Cast Overlay -->
|
||||
<div id="cast-overlay" class="overlay hidden">
|
||||
<div class="overlay-content">
|
||||
<h3>Connect to Device</h3>
|
||||
<ul id="device-list">
|
||||
<li>Searching...</li>
|
||||
<!-- Hidden Cast Overlay (Beautified) -->
|
||||
<div id="cast-overlay" class="overlay hidden" aria-hidden="true" data-tauri-drag-region>
|
||||
<div class="modal" role="dialog" aria-modal="true" aria-labelledby="deviceTitle">
|
||||
<h2 id="deviceTitle">Connect to Device</h2>
|
||||
|
||||
<ul id="device-list" class="device-list">
|
||||
<!-- Render device items here -->
|
||||
<li class="device">
|
||||
<div class="device-main">Scanning...</div>
|
||||
<div class="device-sub">Searching for speakers</div>
|
||||
</li>
|
||||
</ul>
|
||||
<button id="close-overlay">Cancel</button>
|
||||
|
||||
<button id="close-overlay" class="btn cancel" type="button">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
25
src/main.js
25
src/main.js
@@ -58,6 +58,11 @@ function setupEventListeners() {
|
||||
castBtn.addEventListener('click', openCastOverlay);
|
||||
closeOverlayBtn.addEventListener('click', closeCastOverlay);
|
||||
|
||||
// Close overlay on background click
|
||||
castOverlay.addEventListener('click', (e) => {
|
||||
if (e.target === castOverlay) closeCastOverlay();
|
||||
});
|
||||
|
||||
// Close button
|
||||
document.getElementById('close-btn').addEventListener('click', async () => {
|
||||
const appWindow = getCurrentWindow();
|
||||
@@ -213,37 +218,37 @@ function handleVolumeInput() {
|
||||
// Cast Logic
|
||||
async function openCastOverlay() {
|
||||
castOverlay.classList.remove('hidden');
|
||||
deviceListEl.innerHTML = '<li>Scanning...</li>';
|
||||
castOverlay.setAttribute('aria-hidden', 'false');
|
||||
deviceListEl.innerHTML = '<li class="device"><div class="device-main">Scanning...</div><div class="device-sub">Searching for speakers</div></li>';
|
||||
|
||||
try {
|
||||
const devices = await invoke('list_cast_devices');
|
||||
deviceListEl.innerHTML = '';
|
||||
|
||||
// Add "Stop Casting / Local" option
|
||||
// Add "This Computer" option
|
||||
const localLi = document.createElement('li');
|
||||
localLi.textContent = 'This Computer (Local Playback)';
|
||||
localLi.className = 'device' + (currentMode === 'local' ? ' selected' : '');
|
||||
localLi.innerHTML = '<div class="device-main">This Computer</div><div class="device-sub">Local Playback</div>';
|
||||
localLi.onclick = () => selectCastDevice(null);
|
||||
deviceListEl.appendChild(localLi);
|
||||
|
||||
if (devices.length === 0) {
|
||||
const li = document.createElement('li');
|
||||
li.textContent = 'No speakers found';
|
||||
deviceListEl.appendChild(li);
|
||||
} else {
|
||||
if (devices.length > 0) {
|
||||
devices.forEach(d => {
|
||||
const li = document.createElement('li');
|
||||
li.textContent = d;
|
||||
li.className = 'device' + (currentMode === 'cast' && currentCastDevice === d ? ' selected' : '');
|
||||
li.innerHTML = `<div class="device-main">${d}</div><div class="device-sub">Google Cast Speaker</div>`;
|
||||
li.onclick = () => selectCastDevice(d);
|
||||
deviceListEl.appendChild(li);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
deviceListEl.innerHTML = `<li>Error: ${e}</li>`;
|
||||
deviceListEl.innerHTML = `<li class="device"><div class="device-main">Error</div><div class="device-sub">${e}</div></li>`;
|
||||
}
|
||||
}
|
||||
|
||||
function closeCastOverlay() {
|
||||
castOverlay.classList.add('hidden');
|
||||
castOverlay.setAttribute('aria-hidden', 'true');
|
||||
}
|
||||
|
||||
async function selectCastDevice(deviceName) {
|
||||
|
||||
129
src/styles.css
129
src/styles.css
@@ -408,20 +408,16 @@ input[type=range]::-webkit-slider-thumb {
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
/* Cast Overlay */
|
||||
/* Cast Overlay (Beautified as per layout2_plan.md) */
|
||||
.overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0,0,0,0.6);
|
||||
backdrop-filter: blur(10px);
|
||||
z-index: 10;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(20, 10, 35, 0.45);
|
||||
backdrop-filter: blur(14px);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: var(--card-radius);
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.3s;
|
||||
@@ -432,48 +428,99 @@ input[type=range]::-webkit-slider-thumb {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.overlay-content {
|
||||
background: #2a2a2a;
|
||||
padding: 24px;
|
||||
border-radius: 16px;
|
||||
width: 80%;
|
||||
max-height: 70%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
|
||||
/* Modal */
|
||||
.modal {
|
||||
width: min(420px, calc(100vw - 48px));
|
||||
padding: 22px;
|
||||
border-radius: 22px;
|
||||
background: rgba(30, 30, 40, 0.82);
|
||||
border: 1px solid rgba(255,255,255,0.12);
|
||||
box-shadow: 0 30px 80px rgba(0,0,0,0.6);
|
||||
color: #fff;
|
||||
animation: pop 0.22s ease;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
@keyframes pop {
|
||||
from { transform: scale(0.94); opacity: 0; }
|
||||
to { transform: scale(1); opacity: 1; }
|
||||
}
|
||||
|
||||
.modal h2 {
|
||||
margin: 0 0 14px;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
/* Device list */
|
||||
.device-list {
|
||||
list-style: none;
|
||||
padding: 10px 5px;
|
||||
margin: 0 0 18px;
|
||||
max-height: 360px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
/* Device row */
|
||||
.device {
|
||||
padding: 12px 14px;
|
||||
border-radius: 14px;
|
||||
margin-bottom: 8px;
|
||||
cursor: pointer;
|
||||
background: rgba(255,255,255,0.05);
|
||||
transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.device:hover {
|
||||
background: rgba(255,255,255,0.10);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.device .device-main {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.overlay-content h3 {
|
||||
margin-top: 0;
|
||||
font-size: 1.1rem;
|
||||
text-align: center;
|
||||
.device .device-sub {
|
||||
margin-top: 3px;
|
||||
font-size: 12px;
|
||||
opacity: 0.7;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
#device-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 16px 0;
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
/* Selected device */
|
||||
.device.selected {
|
||||
background: linear-gradient(135deg, #c77dff, #8b5cf6);
|
||||
box-shadow: 0 0 18px rgba(199,125,255,0.65);
|
||||
color: #111;
|
||||
}
|
||||
|
||||
#device-list li {
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.1);
|
||||
cursor: pointer;
|
||||
.device.selected .device-main,
|
||||
.device.selected .device-sub {
|
||||
color: #111;
|
||||
}
|
||||
|
||||
#device-list li:hover {
|
||||
background: rgba(255,255,255,0.1);
|
||||
.device.selected .device-sub {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
#close-overlay {
|
||||
background: var(--danger);
|
||||
/* Cancel button */
|
||||
.btn.cancel {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border-radius: 999px;
|
||||
border: none;
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
color: white;
|
||||
background: #d16b7d;
|
||||
color: #fff;
|
||||
font-size: 15px;
|
||||
cursor: pointer;
|
||||
transition: transform 0.15s ease, background 0.2s;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.btn.cancel:hover {
|
||||
transform: scale(1.02);
|
||||
background: #e17c8d;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user