Improve mobile ui
This commit is contained in:
parent
34ddd1d507
commit
b43fa5aa82
10 changed files with 136 additions and 36 deletions
|
|
@ -99,6 +99,10 @@
|
|||
</roomcontent2>
|
||||
</roomcontent>
|
||||
<sidebar class="second" id="roomdetailsbar" style="display: none;">
|
||||
<roomtopbar>
|
||||
</roomtopbar>
|
||||
<roomcontent2>
|
||||
</roomcontent2>
|
||||
</sidebar>
|
||||
</main>
|
||||
<div id="fixed-context-menu" class="context-menu">
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -84,4 +84,9 @@ var addSpaceMenu = `
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="1.4rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M80-120v-720h400v160h400v320h-80v-240H480v80h80v80h-80v80h80v80h-80v80h160v80H80Zm80-80h80v-80h-80v80Zm0-160h80v-80h-80v80Zm0-160h80v-80h-80v80Zm0-160h80v-80h-80v80Zm160 480h80v-80h-80v80Zm0-160h80v-80h-80v80Zm0-160h80v-80h-80v80Zm0-160h80v-80h-80v80ZM800-40v-80h-80v-80h80v-80h80v80h80v80h-80v80h-80ZM640-440v-80h80v80h-80Zm0 160v-80h80v80h-80Z"/></svg>
|
||||
<span class="blah">title.create.space</span>
|
||||
</button>
|
||||
`;
|
||||
`;
|
||||
|
||||
|
||||
//elements
|
||||
var detailsBtn = `<button class="mobile-nav-btn right" onclick="mobileNavDetails()"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M120-240v-80h720v80H120Zm0-200v-80h720v80H120Zm0-200v-80h720v80H120Z"/></svg></button>`;
|
||||
var backBtnHtml = `<button class="mobile-nav-btn" onclick="mobileNavBack()"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="m313-440 224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"/></svg></button>`;
|
||||
|
|
@ -272,6 +272,8 @@ roomtopbar {
|
|||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
align-items: center;
|
||||
|
||||
width: 100%;
|
||||
border-bottom: var(--border-width) solid var(--light-border-color);
|
||||
|
||||
|
|
@ -282,11 +284,10 @@ roomtopbar {
|
|||
font-size: 1.5rem;
|
||||
}
|
||||
sidebar.second#roomdetailsbar {
|
||||
height: calc(var(--button-height) * 1.5);
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
border-bottom: var(--border-width) solid var(--light-border-color);
|
||||
flex-direction: column;
|
||||
border-left: var(--border-width) solid var(--light-border-color);
|
||||
}
|
||||
fullcontainer {
|
||||
width: 100%;
|
||||
|
|
@ -456,7 +457,7 @@ space{
|
|||
sidebar, sidebar.second, roomcontent {
|
||||
position: absolute !important;
|
||||
height: 100%;
|
||||
transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
}
|
||||
|
||||
sidebar {
|
||||
|
|
@ -482,12 +483,13 @@ space{
|
|||
}
|
||||
|
||||
#roomdetailsbar {
|
||||
left: 0;
|
||||
width: 100vw !important;
|
||||
left: auto !important;
|
||||
right: 0;
|
||||
width: 90vw !important;
|
||||
min-width: unset !important;
|
||||
max-width: none !important;
|
||||
transform: translateX(100vw);
|
||||
z-index: 3;
|
||||
transform: translateX(100vw);
|
||||
z-index: 10;
|
||||
background-color: var(--main-bg-color);
|
||||
}
|
||||
|
||||
|
|
@ -512,4 +514,25 @@ space{
|
|||
main.mobile-details #roomdetailsbar {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
roomcontent::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 10;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
|
||||
transition: opacity 0.3s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
}
|
||||
|
||||
main.mobile-details roomcontent::after {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue