Improve mobile ui
This commit is contained in:
parent
34ddd1d507
commit
b43fa5aa82
10 changed files with 136 additions and 36 deletions
|
|
@ -689,9 +689,22 @@ async function switchRoomContent(title, content, showRoomBar, icon = "", skipMob
|
|||
{
|
||||
roomContentMain.style.transform = "scale(0.85)";
|
||||
roomContentMain.style.opacity = "0";
|
||||
await delay(200);
|
||||
let backBtnHtml = `<button class="mobile-nav-btn" onclick="mobileNavBack()"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg></button>`;
|
||||
let detailsBtnHtml = showRoomBar ? `<button class="mobile-nav-btn right" onclick="mobileNavDetails()"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></button>` : '';
|
||||
|
||||
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
||||
if (window.innerWidth <= 52 * rem && !skipMobileSlide) {
|
||||
if (title != "title.splash") //do not show splash on mobile
|
||||
{
|
||||
mainScreen.classList.remove('mobile-details');
|
||||
mainScreen.classList.add('mobile-content');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await delay(200);
|
||||
}
|
||||
|
||||
|
||||
let detailsBtnHtml = showRoomBar ? detailsBtn : '';
|
||||
|
||||
roomTopBar.innerHTML = `${backBtnHtml}${icon}<space></space><inherit>${processBlah(title)}</inherit><div class="flex-spacer"></div>${detailsBtnHtml}`;
|
||||
roomDetailsBar.style.display = showRoomBar ? "flex" : "none";
|
||||
|
|
@ -722,11 +735,7 @@ async function switchRoomContent(title, content, showRoomBar, icon = "", skipMob
|
|||
roomContentMain.style.transform = "";
|
||||
roomContentMain.style.opacity = "";
|
||||
|
||||
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
||||
if (window.innerWidth <= 52 * rem && !skipMobileSlide) {
|
||||
mainScreen.classList.remove('mobile-details');
|
||||
mainScreen.classList.add('mobile-content');
|
||||
}
|
||||
|
||||
}
|
||||
collapseDmsBtn.addEventListener("click", () => {
|
||||
collapseDmsBtn.classList.toggle("collapsed");
|
||||
|
|
@ -762,6 +771,15 @@ document.addEventListener("click", (e) => {
|
|||
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
|
||||
}
|
||||
}
|
||||
|
||||
if (mainScreen && mainScreen.classList.contains('mobile-details')) {
|
||||
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
||||
if (window.innerWidth <= 52 * rem) {
|
||||
if (!roomDetailsBar.contains(e.target) && !e.target.closest('.mobile-nav-btn.right')) {
|
||||
mobileNavBack();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue