feat: redesign sleep timer custom input as clickable row with inline edit
This commit is contained in:
1 parent
b4c12a2940
commit
e2c28926b2
3 files changed
+14
-6
No files matched your search
+4
-3
@@ -696,9 +696,10 @@
|
|||||||
<button onclick="absSleepIn(30)">30 Min</button>
|
<button onclick="absSleepIn(30)">30 Min</button>
|
||||||
<button onclick="absSleepIn(45)">45 Min</button>
|
<button onclick="absSleepIn(45)">45 Min</button>
|
||||||
<button onclick="absSleepIn(60)">60 Min</button>
|
<button onclick="absSleepIn(60)">60 Min</button>
|
||||||
<div class="abs-sleep-custom">
|
<div id="abs-sleep-custom-row" class="abs-sleep-custom-row" onclick="if(!this.classList.contains('active')){this.classList.add('active');var inp=document.getElementById('abs-sleep-custom-input');inp.value='';inp.focus();}">
|
||||||
<input id="abs-sleep-custom-input" type="number" min="1" max="999" placeholder="Min" onkeydown="if(event.key==='Enter'){const v=parseInt(this.value);if(v>0)absSleepIn(v);}">
|
<span class="abs-sleep-custom-label">Eigene Zeit…</span>
|
||||||
<button onclick="const v=parseInt(document.getElementById('abs-sleep-custom-input').value);if(v>0)absSleepIn(v);">OK</button>
|
<input id="abs-sleep-custom-input" type="number" min="1" max="999" placeholder="Min" onclick="event.stopPropagation()" onkeydown="if(event.key==='Enter'){var v=parseInt(this.value);if(v>0)absSleepIn(v);}">
|
||||||
|
<button onclick="event.stopPropagation();var v=parseInt(document.getElementById('abs-sleep-custom-input').value);if(v>0)absSleepIn(v);">OK</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -317,6 +317,7 @@ export function absSleepIn(minutes) {
|
|||||||
clearTimeout(_sleepTimer); clearInterval(_sleepTick);
|
clearTimeout(_sleepTimer); clearInterval(_sleepTick);
|
||||||
_sleepTimer = null; _sleepTick = null; _sleepEndTime = null;
|
_sleepTimer = null; _sleepTick = null; _sleepEndTime = null;
|
||||||
document.getElementById('abs-sleep-picker')?.classList.remove('open');
|
document.getElementById('abs-sleep-picker')?.classList.remove('open');
|
||||||
|
document.getElementById('abs-sleep-custom-row')?.classList.remove('active');
|
||||||
if (!minutes) { S.absPlayer.sleepRemaining = null; _renderSleepBtn(); return; }
|
if (!minutes) { S.absPlayer.sleepRemaining = null; _renderSleepBtn(); return; }
|
||||||
_sleepEndTime = Date.now() + minutes * 60_000;
|
_sleepEndTime = Date.now() + minutes * 60_000;
|
||||||
_updateSleepTick();
|
_updateSleepTick();
|
||||||
|
|||||||
+9
-3
@@ -937,9 +937,15 @@ nav{flex:1;overflow-y:auto;padding:4px 10px}
|
|||||||
.abs-picker button{display:block;width:100%;padding:9px 16px;background:none;border:none;color:var(--text);font-family:var(--font);font-size:13px;cursor:pointer;text-align:left;transition:background .15s;white-space:nowrap}
|
.abs-picker button{display:block;width:100%;padding:9px 16px;background:none;border:none;color:var(--text);font-family:var(--font);font-size:13px;cursor:pointer;text-align:left;transition:background .15s;white-space:nowrap}
|
||||||
.abs-picker button:hover{background:var(--surface2)}
|
.abs-picker button:hover{background:var(--surface2)}
|
||||||
.abs-picker button.active{color:var(--accent);font-weight:700}
|
.abs-picker button.active{color:var(--accent);font-weight:700}
|
||||||
.abs-sleep-custom{display:flex;align-items:center;gap:4px;padding:6px 8px;border-top:1px solid var(--border2)}
|
.abs-sleep-custom-row{display:flex;align-items:center;gap:6px;width:100%;padding:9px 16px;background:none;border:none;border-top:1px solid var(--border2);color:var(--text);font-family:var(--font);font-size:13px;cursor:pointer;text-align:left;box-sizing:border-box;transition:background .15s}
|
||||||
.abs-sleep-custom input{flex:1;min-width:0;padding:5px 8px;background:var(--surface2);border:1px solid var(--border2);border-radius:6px;color:var(--text);font-family:var(--font);font-size:13px;outline:none}
|
.abs-sleep-custom-row:hover{background:var(--surface2)}
|
||||||
.abs-sleep-custom button{padding:5px 10px;background:var(--accent);border:none;border-radius:6px;color:#fff;font-family:var(--font);font-size:13px;cursor:pointer;white-space:nowrap}
|
.abs-sleep-custom-row.active{background:var(--surface2);cursor:default;padding:8px 10px}
|
||||||
|
.abs-sleep-custom-label{flex:1;pointer-events:none}
|
||||||
|
.abs-sleep-custom-row.active .abs-sleep-custom-label{display:none}
|
||||||
|
.abs-sleep-custom-row input{display:none;flex:1;min-width:0;padding:5px 8px;background:var(--surface);border:1.5px solid var(--accent);border-radius:6px;color:var(--text);font-family:var(--font);font-size:13px;outline:none}
|
||||||
|
.abs-sleep-custom-row.active input{display:block}
|
||||||
|
.abs-sleep-custom-row button{display:none;padding:5px 12px;background:var(--accent);border:none;border-radius:6px;color:#fff;font-family:var(--font);font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap;flex-shrink:0}
|
||||||
|
.abs-sleep-custom-row.active button{display:block}
|
||||||
.abs-chapter-list{flex-shrink:0;overflow-y:auto;max-height:0;transition:max-height .3s ease;border-top:1px solid transparent}
|
.abs-chapter-list{flex-shrink:0;overflow-y:auto;max-height:0;transition:max-height .3s ease;border-top:1px solid transparent}
|
||||||
.abs-chapter-list.open{max-height:220px;border-color:var(--border)}
|
.abs-chapter-list.open{max-height:220px;border-color:var(--border)}
|
||||||
.abs-ch-item{display:flex;align-items:center;gap:10px;padding:8px 20px;cursor:pointer;transition:background .15s}
|
.abs-ch-item{display:flex;align-items:center;gap:10px;padding:8px 20px;cursor:pointer;transition:background .15s}
|
||||||
|
|||||||
Reference in new issue
Block a user