diff --git a/src/index.html b/src/index.html
index c5224da..f4741d1 100644
--- a/src/index.html
+++ b/src/index.html
@@ -109,14 +109,20 @@
50%
-
-
-
-
Connect to Device
-
- - Searching...
+
+
+
+
Connect to Device
+
+
+
+ -
+
Scanning...
+ Searching for speakers
+
-
+
+
diff --git a/src/main.js b/src/main.js
index 9bb31d6..aacc707 100644
--- a/src/main.js
+++ b/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 = '- Scanning...
';
+ castOverlay.setAttribute('aria-hidden', 'false');
+ deviceListEl.innerHTML = 'Scanning...
Searching for speakers
';
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 = 'This Computer
Local Playback
';
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 = `${d}
Google Cast Speaker
`;
li.onclick = () => selectCastDevice(d);
deviceListEl.appendChild(li);
});
}
} catch (e) {
- deviceListEl.innerHTML = `- Error: ${e}
`;
+ deviceListEl.innerHTML = `Error
${e}
`;
}
}
function closeCastOverlay() {
castOverlay.classList.add('hidden');
+ castOverlay.setAttribute('aria-hidden', 'true');
}
async function selectCastDevice(deviceName) {
diff --git a/src/styles.css b/src/styles.css
index 24fe013..ef8bde6 100644
--- a/src/styles.css
+++ b/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;
+}