Merge branch 'master' into dpo/some-css-fixes

This commit is contained in:
Benoit Alessandroni
2020-11-26 17:14:14 +01:00
35 changed files with 8988 additions and 209 deletions

View File

@ -1,6 +1,4 @@
import { store } from 'https://unpkg.com/@startinblox/core@0.12';
import { Sib } from "https://unpkg.com/@startinblox/core@0.12/dist/libs/Sib.js";
import { StoreMixin } from "https://unpkg.com/@startinblox/core@0.12/dist/mixins/storeMixin.js";
import { store, Sib, StoreMixin } from 'https://cdn.skypack.dev/@startinblox/core@0.13';
export const HublReactivity = {
name: 'hubl-reactivity',

View File

@ -1,4 +1,4 @@
import { widgetFactory } from 'https://unpkg.com/@startinblox/core@0.12/dist/widgets/widget-factory.js';
import { widgetFactory } from 'https://cdn.skypack.dev/@startinblox/core@0.13';
const HublSearchUsers = widgetFactory(
'hubl-search-users',

View File

@ -1,6 +1,5 @@
import { widgetFactory } from 'https://unpkg.com/@startinblox/core@0.12/dist/widgets/widget-factory.js';
import { importCSS } from 'https://unpkg.com/@startinblox/core@0.12/dist/libs/helpers.js';
import SlimSelect from 'https://dev.jspm.io/slim-select@1.23';
import { widgetFactory, Helpers } from 'https://cdn.skypack.dev/@startinblox/core@0.13';
import SlimSelect from 'https://cdn.skypack.dev/slim-select@1.23';
const HublStatus = widgetFactory(
'hubl-status',
@ -22,7 +21,7 @@ const HublStatus = widgetFactory(
let select = formWidget.querySelector('select');
if (!select) return;
const slimSelect = new SlimSelect({select: select});
importCSS('https://dev.jspm.io/slim-select/dist/slimselect.min.css');
Helpers.importCSS('https://dev.jspm.io/slim-select/dist/slimselect.min.css');
select.addEventListener('change', () => slimSelect.render());
},
);

View File

@ -1,49 +1,54 @@
script(src="https://browser.sentry-cdn.com/5.25.0/bundle.tracing.min.js" defer)
script(type="module" src="/components/sentry.js" defer)
script(type="module" src="/components/hubl-search-users.js" defer)
script(type="module" src="/components/hubl-status.js" defer)
script(type="module" src="/components/hubl-reactivity.js" defer)
script(type="module" src="https://unpkg.com/@startinblox/core@0.12" defer)
script(type="module" src="https://cdn.skypack.dev/@startinblox/core@0.13" defer)
//- script(type="module" src="/lib/sib-core/dist/index.js" defer)
script(type="module" src="https://unpkg.com/@startinblox/oidc@0.10" defer)
script(type="module" src="https://cdn.skypack.dev/@startinblox/oidc@0.11" defer)
//- script(type="module" src="/lib/sib-auth/index.js" defer)
script(type="module" src="https://unpkg.com/@startinblox/router@0.10" defer)
script(type="module" src="https://cdn.skypack.dev/@startinblox/router@0.11" defer)
//- script(type="module" src="/lib/sib-router/src/index.js" defer)
script(type="module" src="https://unpkg.com/@startinblox/component-notifications@0.7" defer)
script(type="module" src="https://cdn.skypack.dev/@startinblox/component-notifications@0.8" defer)
//- script(type="module" src="/lib/sib-notifications/index.js" defer)
if (endpoints.events || (endpoints.get && endpoints.get.events)) && (endpoints.typeevents || (endpoints.get && endpoints.get.typeevents))
script(type="module" src="https://unpkg.com/@startinblox/component-event@1.2" defer)
//- DISABLED - please migrate to dev.skypack.dev + upgrade to core@0.13
//- if (endpoints.events || (endpoints.get && endpoints.get.events)) && (endpoints.typeevents || (endpoints.get && endpoints.get.typeevents))
//- script(type="module" src="https://cdn.skypack.dev/@startinblox/component-event@1.2" defer)
//- script(type="module" src="/lib/sib-event-component/sib-event.js" defer)
if (endpoints.resources || (endpoints.get && endpoints.get.resources)) && (endpoints.resourceskeywords || (endpoints.get && endpoints.get.resourceskeywords)) && (endpoints.resourcestypes || (endpoints.get && endpoints.get.resourcestypes))
script(type="module" src="https://unpkg.com/@startinblox/component-resource@1.0" defer)
//- DISABLED - please migrate to dev.skypack.dev + upgrade to core@0.13
//- if (endpoints.resources || (endpoints.get && endpoints.get.resources)) && (endpoints.resourceskeywords || (endpoints.get && endpoints.get.resourceskeywords)) && (endpoints.resourcestypes || (endpoints.get && endpoints.get.resourcestypes))
//- script(type="module" src="https://cdn.skypack.dev/@startinblox/component-resource@1.0" defer)
//- script(type="module" src="/lib/sib-resource/sib-resource.js" defer)
if endpoints.joboffers || (endpoints.get && endpoints.get.joboffers)
script(type="module" src="https://unpkg.com/@startinblox/component-job-board@1.1" defer)
script(type="module" src="https://cdn.skypack.dev/@startinblox/component-job-board@1.2" defer)
//- script(type="module" src="/lib/solid-job-board/dist/index.js" defer)
if (endpoints.uploads || (endpoints.get && endpoints.get.uploads)) && (endpoints.skills || (endpoints.get && endpoints.get.skills)) && (endpoints.users || (endpoints.get && endpoints.get.users))
script(type="module" src="https://unpkg.com/@startinblox/component-directory@1.1" defer)
script(type="module" src="https://cdn.skypack.dev/@startinblox/component-directory@1.2" defer)
//- script(type="module" src="/lib/solid-directory/dist/index.js" defer)
if endpoints.dashboards || (endpoints.get && endpoints.get.dashboards)
script(type="module" src="https://unpkg.com/@startinblox/component-dashboard@0.5" defer)
script(type="module" src="https://cdn.skypack.dev/@startinblox/component-dashboard@0.6" defer)
//- script(type="module" src="/lib/solid-dashboard/dist/index.js" defer)
if endpoints.users || (endpoints.get && endpoints.get.users)
script(type="module" src="https://unpkg.com/@startinblox/component-chat@1.2" defer)
script(type="module" src="https://cdn.skypack.dev/@startinblox/component-chat@1.4" defer)
//- script(type="module" src="/lib/solid-xmpp-chat/dist/index.js" defer)
if endpoints.polls || (endpoints.get && endpoints.get.polls)
script(type="module" src="https://unpkg.com/@startinblox/component-poll@1.0" defer)
//- DISABLED - please migrate to dev.skypack.dev + upgrade to core@0.13
//- if endpoints.polls || (endpoints.get && endpoints.get.polls)
//- script(type="module" src="https://cdn.skypack.dev/@startinblox/component-poll@1.0" defer)
//- script(type="module" src="/lib/sib-polls-component/index.js" defer)
//- swal2 does not work with skypack
script(src="https://cdn.jsdelivr.net/npm/sweetalert2@10")
script(src="/scripts/index.js" defer)

View File

@ -1,7 +1,7 @@
.header-left
.logo
solid-link(next='dashboard')
img(src=`${clientLogo || '/images/logo.png'}` style=`max-height:${clientLogoHeight || '32px'}`)
img(src=`${clientLogo || '/images/logo.webp'}` style=`max-height:${clientLogoHeight || '74px'}`)
span.beta-tag(data-trans='header.beta')

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

BIN
src/images/favicon.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

BIN
src/images/logo.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -9,11 +9,11 @@ html(lang="en")
if clientFavicon
link(rel="icon" type="image/png" href=`${clientFavicon}`)
else
link(rel="icon" type="image/png" href="/images/favicon.png")
link(rel="icon" type="image/webp" href="/images/favicon.webp")
include dependencies.pug
if clientCSS
link(rel='stylesheet', href=`${clientCSS}`)
link(rel="manifest" href="/manifest.webmanifest")
body
.wrapper

View File

@ -3,14 +3,16 @@
div.content-box__header
solid-display(
bind-resources
fields='name, parenthesis, username, endParenthesis'
value-parenthesis=" ("
value-endParenthesis=")"
fields='avatar-container(account.picture), text(name, hyphen, at, username)'
value-hyphen=" - "
value-at="@"
class-parenthesis='h1-like'
class-endParenthesis='h1-like'
widget-account.picture='hubl-user-avatar'
class-text="avatar-text"
class-avatar-container="avatar-container"
class-account.picture='avatar'
class-name='h1-like'
class-username='h1-like'
class-hypen='h1-like'
)
.chat-view

View File

@ -1,4 +1,4 @@
document.addEventListener("DOMContentLoaded", function (event) {
document.addEventListener("DOMContentLoaded", function () {
document
.querySelector("sib-auth")
.getUser()

View File

@ -27,10 +27,10 @@ function closeUserControls() {
);
}
document.addEventListener("DOMContentLoaded", function(event) {
document.addEventListener("DOMContentLoaded", function() {
//- View change event
window.addEventListener("navigate", event => {
window.addEventListener("navigate", () => {
closeLeftMenu();
closeUserControls();
});
@ -63,7 +63,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
}
};
document.querySelector("#toggleMainMenu").addEventListener("click", event => {
document.querySelector("#toggleMainMenu").addEventListener("click", () => {
let leftMenu = document.querySelector("#main__menu");
if (leftMenu.hasAttribute("open")) {
closeLeftMenu();
@ -75,7 +75,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
const rightMenus = Array.from(document.querySelectorAll("nav.jsRightMenu"));
rightMenus.forEach(rightMenu => {
const btnRightMenu = rightMenu.querySelector("li.jsOffsiteToggle");
btnRightMenu.addEventListener("click", e => {
btnRightMenu.addEventListener("click", () => {
if (rightMenu.hasAttribute("open")) {
closeRightMenu();
} else {
@ -86,7 +86,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
Array.from(document.querySelectorAll(".jsMobileSidebarOpenButton")).forEach(
el => {
el.addEventListener("click", event => {
el.addEventListener("click", () => {
openRightMenu();
});
}

View File

@ -0,0 +1,11 @@
// if('serviceWorker' in navigator) {
// var refreshing;
// navigator.serviceWorker.addEventListener('controllerchange', () => {
// if (refreshing) {
// return;
// }
// refreshing = true;
// window.location.reload();
// });
// navigator.serviceWorker.register('/sw.js');
// }

View File

@ -1,4 +1,4 @@
document.addEventListener("DOMContentLoaded", function (event) {
document.addEventListener("DOMContentLoaded", function () {
window.addEventListener('newMessage', event => {
let jid = event.detail.jid;
Array.from(document.querySelectorAll('[data-jabberID="' + jid + '"]')).forEach(el => {

View File

@ -44,7 +44,7 @@ function recursiveAdaptWidgets(prefix, element, user) {
});
}
document.addEventListener("DOMContentLoaded", function (event) {
document.addEventListener("DOMContentLoaded", function () {
document
.querySelector("sib-auth")
.getUser()

View File

@ -47,8 +47,8 @@
border-radius: 3px;
background: var(--color-primary);
color: var(--color-white);
position: absolute;
top: -9px;
position: fixed;
top: 12px;
left: 267px;
}
}

View File

@ -406,7 +406,7 @@ h5 {
margin: 0 1.6rem;
@include breakpoint(lg) {
padding: 3rem;
padding: 2rem;
margin: 0;
}

View File

@ -1 +1 @@
@import 'user-profile';
@import 'messages';

View File

@ -0,0 +1,13 @@
.avatar-container {
display: inline-block;
margin-right: 10px;
.avatar {
height: 40px;
width: 40px;
}
}
.avatar-text {
position: absolute;
top: 2.8rem;
}

View File

@ -1,76 +0,0 @@
/*.user-profile__container {
.user-bio {
display: grid;
grid-gap: 1rem;
grid-template-areas: "avatar name"
"avatar information";
grid-template-columns: minmax(300px, 400px) 2fr;
.avatar-display {
grid-area: avatar;
overflow: hidden;
position: relative;
img {
border-radius: 50%;
height: 300px;
object-fit: cover;
overflow: hidden;
object-position: center;
width: 300px;
}
}
.name-diplay {
grid-area: name;
[name='user-name-groups'] {
align-items: baseline;
align-self: end;
display: flex;
solid-multiple {
display: flex;
padding-left: 1.4rem;
hubl-groups-name {
@extend %tag-role;
}
}
}
}
.info-form {
grid-area: information; */
/* ces styles disparaitront lorsque l'on aura la fonctionnalité pour uploader une photo */
/*[name="account.picture"] {
margin-bottom: 1rem;
}
hubl-instruction {
margin-left: 1rem;
span {
color: $color-233-18-29;
font-weight: bold;
}
p {
margin-left: 1rem;
}
}*/
/* Fin commentaire sur upload photos */
/*}
[name^="inline-"] {
display: flex;
justify-content: flex-start;
>*:not(:last-child) {
margin-right: 3rem;
}
}
}
}*/

113
src/sw.js Normal file
View File

@ -0,0 +1,113 @@
const CACHE_NAME = 'hubl-store';
self.addEventListener('install', function (e) {
self.skipWaiting();
e.waitUntil(
caches.open(CACHE_NAME).then(function (cache) {
return cache.addAll([
'/locales/es.json',
'/locales/fr.json',
'/scripts/index.js',
'/syles/index.css',
'/index.html',
'/'
]);
})
);
});
self.addEventListener('activate', function (e) {
// invalidate older versions
e.waitUntil(
caches.keys()
.then(function (keyList) {
return Promise.all(keyList.map(function (key) {
if (key !== CACHE_NAME && key !== (CACHE_NAME + "-cdn") && key !== (CACHE_NAME + "-api")) {
return caches.delete(key);
}
}));
}));
self.clients.claim();
});
self.addEventListener('fetch', function (event) {
let requestURL = new URL(event.request.url);
if (requestURL.origin == location.origin) {
// Static asset, cache then network
event.respondWith(
caches.open(CACHE_NAME).then(function (cache) {
return cache.match(event.request).then(function (response) {
var fetchPromise = fetch(event.request).then(function (networkResponse) {
cache.put(event.request, networkResponse.clone());
return networkResponse;
});
return response || fetchPromise;
});
}),
);
} else {
if (
event.request.method == 'POST' ||
event.request.method == 'PUT'
) {
// disabled: lead to cors errors
// // POST/PUT to api, rewrite the cache
// event.respondWith(
// caches.open(CACHE_NAME + '-api').then(function (cache) {
// return fetch(event.request).then(function (response) {
// cache.put(event.request, response.clone());
// return response;
// })
// }));
// api: no cache
event.respondWith(fetch(event.request));
} else if (
/matomo/.test(requestURL.origin) ||
/sentry/.test(requestURL.origin) ||
/jabber/.test(requestURL.origin) ||
/xmpp/.test(requestURL.origin)
) {
// analytics, always distant
event.respondWith(fetch(event.request));
} else {
if (
/unpkg/.test(requestURL.origin) ||
/skypack/.test(request.origin) ||
/jspm/.test(requestURL.origin) ||
/jsdeliver/.test(requestURL.origin) ||
/cdn/.test(requestURL.origin) ||
/googleapis/.test(requestURL.origin)
) {
// cdn: cache then network
event.respondWith(
caches.open(CACHE_NAME + '-cdn').then(function (cache) {
return cache.match(event.request).then(function (response) {
var fetchPromise = fetch(event.request).then(function (networkResponse) {
cache.put(event.request, networkResponse.clone());
return networkResponse;
});
return response || fetchPromise;
});
}),
);
} else {
// disabled: lead to cors errors
// // api: distant then cache
// event.respondWith(
// fetch(event.request)
// .then((response) => {
// caches.open(CACHE_NAME + '-api').then(function (cache) {
// cache.put(event.request, response.clone());
// return response;
// });
// })
// .catch(() => {
// return caches.match(event.request);
// })
// );
// api: no cache
event.respondWith(fetch(event.request));
}
}
}
});