ui(ucp): en-tête compact mobile et dégradé latéral onglets (v2.5.6)
This commit is contained in:
1 parent
d8ec7e4508
commit
26cac163d6
3 files changed
+62
-9
No files matched your search
@@ -145,7 +145,11 @@ function switchUcpTab(tabName) {
|
||||
btn.className = isMe
|
||||
? 'ucp-tab-btn px-3.5 py-2 rounded-xl text-xs font-semibold transition flex items-center gap-2 bg-indigo-50 text-indigo-700'
|
||||
: 'ucp-tab-btn px-3.5 py-2 rounded-xl text-xs font-semibold transition flex items-center gap-2 text-slate-600 hover:bg-slate-100';
|
||||
if (isMe && typeof btn.scrollIntoView === 'function') {
|
||||
btn.scrollIntoView({ behavior: 'smooth', inline: 'nearest', block: 'nearest' });
|
||||
}
|
||||
});
|
||||
setTimeout(updateUcpNavScrollHints, 120);
|
||||
|
||||
if (tabName === 'voicemail') {
|
||||
loadVoicemailsForSelected();
|
||||
@@ -989,6 +993,7 @@ if (passwordForm) {
|
||||
|
||||
if (window.UCP_IS_AUTH) {
|
||||
refreshUcpState(false);
|
||||
initUcpNavScrollHints();
|
||||
pollTimer = setInterval(() => {
|
||||
if (!document.hidden) {
|
||||
refreshUcpState(false);
|
||||
@@ -996,3 +1001,33 @@ if (window.UCP_IS_AUTH) {
|
||||
}, 15000);
|
||||
}
|
||||
|
||||
function updateUcpNavScrollHints() {
|
||||
const scroller = document.getElementById('ucp-nav-scroller');
|
||||
const leftHint = document.getElementById('ucp-nav-hint-left');
|
||||
const rightHint = document.getElementById('ucp-nav-hint-right');
|
||||
if (!scroller || !leftHint || !rightHint) return;
|
||||
|
||||
const hasLeft = scroller.scrollLeft > 4;
|
||||
const hasRight = scroller.scrollLeft + scroller.clientWidth < scroller.scrollWidth - 4;
|
||||
|
||||
leftHint.classList.toggle('hidden', !hasLeft);
|
||||
leftHint.classList.toggle('flex', hasLeft);
|
||||
rightHint.classList.toggle('hidden', !hasRight);
|
||||
rightHint.classList.toggle('flex', hasRight);
|
||||
}
|
||||
|
||||
function scrollUcpNav(direction) {
|
||||
const scroller = document.getElementById('ucp-nav-scroller');
|
||||
if (!scroller) return;
|
||||
scroller.scrollBy({ left: direction * 170, behavior: 'smooth' });
|
||||
}
|
||||
|
||||
function initUcpNavScrollHints() {
|
||||
const scroller = document.getElementById('ucp-nav-scroller');
|
||||
if (!scroller) return;
|
||||
scroller.addEventListener('scroll', updateUcpNavScrollHints, { passive: true });
|
||||
window.addEventListener('resize', updateUcpNavScrollHints);
|
||||
requestAnimationFrame(updateUcpNavScrollHints);
|
||||
setTimeout(updateUcpNavScrollHints, 250);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user