diff --git a/src/header.pug b/src/header.pug index 2ad85fa15c6b659d27061b6d23d29692ccc65f7f..ef567557d4f758673a2db9985ca6ea714a790219 100644 --- a/src/header.pug +++ b/src/header.pug @@ -7,7 +7,7 @@ //- i#search-icon.icon-magnifier(aria-hidden='true') //- i#close-search-icon.icon-close(aria-hidden='true') -sib-notifications( +sib-notifications.notLoggedIn( nested-field="inbox" bind-user ) @@ -33,11 +33,11 @@ details#user-controls.notLoggedIn sib-link(next='admin') Admin button(role='log out' onclick="document.querySelector('sib-auth').logout();") Log out -button(role='log in' onclick="document.querySelector('sib-auth').login();") Login +button.loggedIn(role='log in' onclick="document.querySelector('sib-auth').login();") Login button.notLoggedIn.mobile-menu-icon.icon-menu#toggleMainMenu -sib-auth +sib-auth(style='display:none!important') sib-auth-provider( data-authority=`${authority}` data-id=`${authorityName || "authority"}` diff --git a/src/index.pug b/src/index.pug index 2df531e6859c184ecc7b1b0e94f9056964edaf62..0eae9a5e93483106994bd096006b7cddae356d07 100644 --- a/src/index.pug +++ b/src/index.pug @@ -13,7 +13,8 @@ html(lang="en") body header#header(role='banner') include header.pug - main + + main.notLoggedIn include menu-left.pug div#viewport @@ -42,4 +43,4 @@ html(lang="en") include page-events.pug #admin(hidden).with-sidebar - include page-admin.pug + include page-admin.pug \ No newline at end of file diff --git a/src/scripts/index.js b/src/scripts/index.js index ecbafe8f366ce520818445b1db150f2d2da88e2d..8a868838447ecad8248c129cc1581fc387495fa0 100644 --- a/src/scripts/index.js +++ b/src/scripts/index.js @@ -214,7 +214,7 @@ document.addEventListener("DOMContentLoaded", function(event) { .forEach(el => (el.style.visibility = "visible")); // Hide login button if already logged document - .querySelector('button[role="log in"]') + .querySelector('.loggedIn') .setAttribute("style", "display:none !important"); document.querySelectorAll('sib-display, sib-form').forEach(element => { // Set current user id on set-user-id of sib-display @@ -228,6 +228,8 @@ document.addEventListener("DOMContentLoaded", function(event) { "display:none !important" ); // Hide Join button } + } else { + document.querySelector('sib-auth').login(); } }) .catch(error => console.log(error)); diff --git a/src/styles/base/header.scss b/src/styles/base/header.scss index 850e1daa6ae8a6279697360f6f95b14b726e0534..b33026620533fe886380e48db3ea1e133a2a553d 100644 --- a/src/styles/base/header.scss +++ b/src/styles/base/header.scss @@ -56,10 +56,6 @@ } } - .notLoggedIn { - visibility: hidden; - } - sib-notifications { @include breakpoint(sm) { diff --git a/src/styles/base/main.scss b/src/styles/base/main.scss index 4aae4ef524a21ae5b44083bedbb36c1b55af3486..5de1804692916b0cad71802131379d4ab882ba68 100644 --- a/src/styles/base/main.scss +++ b/src/styles/base/main.scss @@ -35,6 +35,10 @@ $breakpoints: (phone: 480px, backface-visibility: hidden; /*will-change: overflow;*/ } + + .notLoggedIn { + visibility: hidden; + } } /* Add scrollbar to the left and right menu, and to the content */