Fix indicators again
All checks were successful
Android Build / publish (push) Successful in 28s
Linux Build / publish (push) Successful in 52s

This commit is contained in:
olcxja 2026-05-18 09:12:48 +02:00
commit c943dee794
4 changed files with 60 additions and 46 deletions

View file

@ -39,6 +39,7 @@ try {
var sidebarAdd = document.getElementById("sidebar-add"); var sidebarAdd = document.getElementById("sidebar-add");
var sidebarAddButton = sidebarAdd.children.item(1); var sidebarAddButton = sidebarAdd.children.item(1);
var sidebarAddIndicator = sidebarAdd.children.item(0); var sidebarAddIndicator = sidebarAdd.children.item(0);
var roomsBarContainer = document.getElementById("roomsbar");
var roomDetailsBar = document.getElementById("roomdetailsbar"); var roomDetailsBar = document.getElementById("roomdetailsbar");
var roomContent = document.getElementsByTagName("roomcontent")[0]; var roomContent = document.getElementsByTagName("roomcontent")[0];
@ -861,14 +862,15 @@ function clickAddDm()
} }
var indicatorBeforeFixedMenu; var currentMainIndicator = null;
sidebarAddButton.addEventListener("click", (e) => { sidebarAddButton.addEventListener("click", (e) => {
e.stopPropagation(); e.stopPropagation();
history.pushState({trap: true}, "", location.href); history.pushState({trap: true}, "", location.href);
if (fixedContextMenu.classList.contains("show")) { if (fixedContextMenu.classList.contains("show")) {
fixedContextMenu.classList.remove("show"); fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
setActiveSidebarIndicator(currentMainIndicator);
} else { } else {
setActiveSidebarIndicator(sidebarAddIndicator, true); setActiveSidebarIndicator(sidebarAddIndicator, true);
const rect = sidebarAddButton.getBoundingClientRect(); const rect = sidebarAddButton.getBoundingClientRect();
@ -883,7 +885,7 @@ document.addEventListener("click", (e) => {
if (!fixedContextMenu.contains(e.target)) { if (!fixedContextMenu.contains(e.target)) {
fixedContextMenu.classList.remove("show"); fixedContextMenu.classList.remove("show");
if (!e.target.closest('sidebarelement')) { if (!e.target.closest('sidebarelement')) {
setActiveSidebarIndicator(indicatorBeforeFixedMenu); setActiveSidebarIndicator(currentMainIndicator);
} }
} }
} }
@ -924,52 +926,57 @@ function gotoSideProfilePopup() {
} }
function gotoInbox() { function gotoInbox() {
if (roomsBarContainer) roomsBarContainer.style.display = ""; //show roombar
setActiveSidebarIndicator(sidebarInboxIndicator); setActiveSidebarIndicator(sidebarInboxIndicator);
switchRoomsBar("title.inbox", inboxRoomBar); switchRoomsBar("title.inbox", inboxRoomBar);
gotoInvites(); gotoInvites();
} }
function gotoCreateSpace() { function gotoCreateSpace() {
fixedContextMenu.classList.remove("show"); fixedContextMenu.classList.remove("show");
if (roomsBarContainer) roomsBarContainer.style.display = "none"; //hide roombar
switchRoomContent("title.create.space", createSpaceScreen, false); switchRoomContent("title.create.space", createSpaceScreen, false);
} }
function gotoJoinSpace() { function gotoJoinSpace() {
fixedContextMenu.classList.remove("show"); fixedContextMenu.classList.remove("show");
if (roomsBarContainer) roomsBarContainer.style.display = "none"; //hide roombar
switchRoomContent("title.join.space", joinSpaceScreen, false); switchRoomContent("title.join.space", joinSpaceScreen, false);
} }
function gotoHome() { function gotoHome() {
if (roomsBarContainer) roomsBarContainer.style.display = ""; //show roombar
setActiveSidebarIndicator(sidebarHomeIndicator); setActiveSidebarIndicator(sidebarHomeIndicator);
switchRoomContent("title.splash", splashScreen, false); switchRoomContent("title.splash", splashScreen, false);
switchRoomsBar("title.home", homeRoomBar); switchRoomsBar("title.home", homeRoomBar);
} }
function setActiveSidebarIndicator(element, skipDisabling = false) function setActiveSidebarIndicator(element, isTemporary = false) {
{
let indicators = document.getElementsByTagName("indicator"); let indicators = document.getElementsByTagName("indicator");
for (let i = 0; i < indicators.length; i++) { for (let i = 0; i < indicators.length; i++) {
if (indicators[i].classList.contains("active"))
{
if (!skipDisabling) //DOKONCZ JEBANY INDICATOR UZYJE DO TEGO indicatorBeforeFixedMenu ZE ON MA BYC AKTYWNY PO MOBILE COFCE
{
indicatorBeforeFixedMenu = indicators[i];
indicators[i].classList.remove("active"); indicators[i].classList.remove("active");
} }
}
}
if (element) {
element.classList.add("active"); element.classList.add("active");
} }
if (!isTemporary && element) {
currentMainIndicator = element;
}
}
function mobileNavBack() { function mobileNavBack() {
if(mainScreen.classList.contains('mobile-details')) { if(mainScreen.classList.contains('mobile-details')) {
mainScreen.classList.remove('mobile-details'); mainScreen.classList.remove('mobile-details');
mainScreen.classList.add('mobile-content'); mainScreen.classList.add('mobile-content');
setActiveSidebarIndicator(indicatorBeforeFixedMenu); setActiveSidebarIndicator(currentMainIndicator);
} else { } else {
mainScreen.classList.remove('mobile-content'); mainScreen.classList.remove('mobile-content');
setActiveSidebarIndicator(sidebarHomeIndicator); setActiveSidebarIndicator(currentMainIndicator);
if (roomsBarContainer) roomsBarContainer.style.display = ""; //restore roombar on mobile
} }
} }
function mobileNavDetails() { function mobileNavDetails() {

View file

@ -152,7 +152,7 @@ roomcontent {
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
width: calc(100vw - (var(--icon-button-height) + (var(--button-margin) * 2) + var(--border-width)) - 17rem); flex-grow: 1;
border-right: var(--border-width) solid var(--light-border-color); border-right: var(--border-width) solid var(--light-border-color);
} }
roomcontent2 { roomcontent2 {

View file

@ -39,6 +39,7 @@ try {
var sidebarAdd = document.getElementById("sidebar-add"); var sidebarAdd = document.getElementById("sidebar-add");
var sidebarAddButton = sidebarAdd.children.item(1); var sidebarAddButton = sidebarAdd.children.item(1);
var sidebarAddIndicator = sidebarAdd.children.item(0); var sidebarAddIndicator = sidebarAdd.children.item(0);
var roomsBarContainer = document.getElementById("roomsbar");
var roomDetailsBar = document.getElementById("roomdetailsbar"); var roomDetailsBar = document.getElementById("roomdetailsbar");
var roomContent = document.getElementsByTagName("roomcontent")[0]; var roomContent = document.getElementsByTagName("roomcontent")[0];
@ -861,14 +862,15 @@ function clickAddDm()
} }
var indicatorBeforeFixedMenu; var currentMainIndicator = null;
sidebarAddButton.addEventListener("click", (e) => { sidebarAddButton.addEventListener("click", (e) => {
e.stopPropagation(); e.stopPropagation();
history.pushState({trap: true}, "", location.href); history.pushState({trap: true}, "", location.href);
if (fixedContextMenu.classList.contains("show")) { if (fixedContextMenu.classList.contains("show")) {
fixedContextMenu.classList.remove("show"); fixedContextMenu.classList.remove("show");
setActiveSidebarIndicator(indicatorBeforeFixedMenu);
setActiveSidebarIndicator(currentMainIndicator);
} else { } else {
setActiveSidebarIndicator(sidebarAddIndicator, true); setActiveSidebarIndicator(sidebarAddIndicator, true);
const rect = sidebarAddButton.getBoundingClientRect(); const rect = sidebarAddButton.getBoundingClientRect();
@ -883,7 +885,7 @@ document.addEventListener("click", (e) => {
if (!fixedContextMenu.contains(e.target)) { if (!fixedContextMenu.contains(e.target)) {
fixedContextMenu.classList.remove("show"); fixedContextMenu.classList.remove("show");
if (!e.target.closest('sidebarelement')) { if (!e.target.closest('sidebarelement')) {
setActiveSidebarIndicator(indicatorBeforeFixedMenu); setActiveSidebarIndicator(currentMainIndicator);
} }
} }
} }
@ -924,52 +926,57 @@ function gotoSideProfilePopup() {
} }
function gotoInbox() { function gotoInbox() {
if (roomsBarContainer) roomsBarContainer.style.display = ""; //show roombar
setActiveSidebarIndicator(sidebarInboxIndicator); setActiveSidebarIndicator(sidebarInboxIndicator);
switchRoomsBar("title.inbox", inboxRoomBar); switchRoomsBar("title.inbox", inboxRoomBar);
gotoInvites(); gotoInvites();
} }
function gotoCreateSpace() { function gotoCreateSpace() {
fixedContextMenu.classList.remove("show"); fixedContextMenu.classList.remove("show");
if (roomsBarContainer) roomsBarContainer.style.display = "none"; //hide roombar
switchRoomContent("title.create.space", createSpaceScreen, false); switchRoomContent("title.create.space", createSpaceScreen, false);
} }
function gotoJoinSpace() { function gotoJoinSpace() {
fixedContextMenu.classList.remove("show"); fixedContextMenu.classList.remove("show");
if (roomsBarContainer) roomsBarContainer.style.display = "none"; //hide roombar
switchRoomContent("title.join.space", joinSpaceScreen, false); switchRoomContent("title.join.space", joinSpaceScreen, false);
} }
function gotoHome() { function gotoHome() {
if (roomsBarContainer) roomsBarContainer.style.display = ""; //show roombar
setActiveSidebarIndicator(sidebarHomeIndicator); setActiveSidebarIndicator(sidebarHomeIndicator);
switchRoomContent("title.splash", splashScreen, false); switchRoomContent("title.splash", splashScreen, false);
switchRoomsBar("title.home", homeRoomBar); switchRoomsBar("title.home", homeRoomBar);
} }
function setActiveSidebarIndicator(element, skipDisabling = false) function setActiveSidebarIndicator(element, isTemporary = false) {
{
let indicators = document.getElementsByTagName("indicator"); let indicators = document.getElementsByTagName("indicator");
for (let i = 0; i < indicators.length; i++) { for (let i = 0; i < indicators.length; i++) {
if (indicators[i].classList.contains("active"))
{
if (!skipDisabling) //DOKONCZ JEBANY INDICATOR UZYJE DO TEGO indicatorBeforeFixedMenu ZE ON MA BYC AKTYWNY PO MOBILE COFCE
{
indicatorBeforeFixedMenu = indicators[i];
indicators[i].classList.remove("active"); indicators[i].classList.remove("active");
} }
}
}
if (element) {
element.classList.add("active"); element.classList.add("active");
} }
if (!isTemporary && element) {
currentMainIndicator = element;
}
}
function mobileNavBack() { function mobileNavBack() {
if(mainScreen.classList.contains('mobile-details')) { if(mainScreen.classList.contains('mobile-details')) {
mainScreen.classList.remove('mobile-details'); mainScreen.classList.remove('mobile-details');
mainScreen.classList.add('mobile-content'); mainScreen.classList.add('mobile-content');
setActiveSidebarIndicator(indicatorBeforeFixedMenu); setActiveSidebarIndicator(currentMainIndicator);
} else { } else {
mainScreen.classList.remove('mobile-content'); mainScreen.classList.remove('mobile-content');
setActiveSidebarIndicator(sidebarHomeIndicator); setActiveSidebarIndicator(currentMainIndicator);
if (roomsBarContainer) roomsBarContainer.style.display = ""; //restore roombar on mobile
} }
} }
function mobileNavDetails() { function mobileNavDetails() {

View file

@ -152,7 +152,7 @@ roomcontent {
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
width: calc(100vw - (var(--icon-button-height) + (var(--button-margin) * 2) + var(--border-width)) - 17rem); flex-grow: 1;
border-right: var(--border-width) solid var(--light-border-color); border-right: var(--border-width) solid var(--light-border-color);
} }
roomcontent2 { roomcontent2 {