diff --git a/.gitlab/issue_templates/bug.md b/.gitlab/issue_templates/bug.md index e796cd36a9b03b2bbcb7a41cf9a12335027d687a..89008f532e18cba070c755c8cd95128557320f33 100644 --- a/.gitlab/issue_templates/bug.md +++ b/.gitlab/issue_templates/bug.md @@ -1,28 +1,24 @@ -/label ~BUG - -### What's happening? +# What's happening? -*Describe in a few words what's happening* +Describe in a few words what's happening -### Steps to reproduce +## Steps to reproduce -*How one can reproduce the issue - this is very important* +How one can reproduce the issue - this is very important 1. Step 1 2. Step 2 3. Step 3 -### Relevant logs and/or screenshots +## Relevant logs and/or screenshots -*If possible, please add a screenshot.* +If possible, please add a screenshot. -### Your Environment +## Your Environment (Include relevant details about the environment you experienced the bug in) * Browser name and version: * Operating System and version (desktop or mobile): - - - +/label ~BUG diff --git a/.gitlab/issue_templates/feature.md b/.gitlab/issue_templates/feature.md index 3f8fa19d755b9a1380d14608abfd1346f74d3d16..f9544309777a4890439d337796109c8b8823aea5 100644 --- a/.gitlab/issue_templates/feature.md +++ b/.gitlab/issue_templates/feature.md @@ -1,16 +1,12 @@ -## What needs to be done? - -/label ~Feature request - +# What needs to be done ## Technical details -*Are there any technical details worth mentioning?* - +Are there any technical details worth mentioning? ## Test cases -*Describe here the tests needed in order to validate this feature* +Describe here the tests needed in order to validate this feature 1. Step 1 2. Step 2 @@ -20,3 +16,5 @@ 1. Link to user story in wiki 2. other related Gitlab issues + +/label ~Feature request diff --git a/.gitlab/issue_templates/new_instance.md b/.gitlab/issue_templates/new_instance.md index a93fe19d536d740ba99da01eb33da9cc63a28a7e..2cf64a0227b7d7858ffbf1cb82b050eea4522451 100644 --- a/.gitlab/issue_templates/new_instance.md +++ b/.gitlab/issue_templates/new_instance.md @@ -1,40 +1,16 @@ -/label ~"New Instance" - -# Please fill all these info: +# Please fill all these info ## General info -- Name of the instance: -- Domain: - -## Settings: - -- Does the instance allow people to sign up? **Yes / No** -- Does the instance want new people to get a welcome email? **Yes / No** - -## Federation: +- Name of the instance: +- Domain: .hubl.world -- Which current instance should see this new instance data? **Please provide the info module by module and include the instance itself.** -- Do those current instances agree to share their public data with this new instance? **Yes / No** - -Example: +## Cosmetics -- *Instance G is the new kid in town* -- *Instance G wants to only see their dashboard, but want to access the circles of A, B, C, D, E & F.* -- *Instance G wants to be able to chat with users from A, B, C, D, E & F.* -- *Instance G wants to be able to see A and B job offers* +- Logo: -Let's say every instances agree to this scenario, the issue should describe the following: +- Favicon: -- Dashboard: G -- Circles: A, B, C, D, E, F & G -- Job offers: A, B, F, G -- Users: A, B, C, D, E, F & G -- Profile directory: A, B, C, D, E, F & G -- G agrees that any new instance can see their public data. +- 4 Colors: -## Cosmetics - -- Logo: -- Favicon: -- 4 Colors: \ No newline at end of file +/label ~"New Instance" diff --git a/.gitlab/merge_request_templates/checklist_before_merging.md b/.gitlab/merge_request_templates/checklist_before_merging.md index edd506b07458afbc3d567f8be5b4bcc173cd0ca2..c92dfae887c454093e537b72f1d3f6e1218090ac 100644 --- a/.gitlab/merge_request_templates/checklist_before_merging.md +++ b/.gitlab/merge_request_templates/checklist_before_merging.md @@ -1,4 +1,4 @@ -## Checklist +# Checklist <!--- Please, make sure you have changed the topic and also @@ -12,8 +12,6 @@ I have done ... - [ ] Tests for the changes have been added - [ ] Docs have been added or updated - [ ] I have assigned my architect to review this merge request -- [ ] I have checked how to create a [merge request]() - ## Issues @@ -25,7 +23,6 @@ Format is: Closes #X or Refs #Y Docs: https://docs.gitlab.com/ee/user/project/issues/closing_issues.html#via-merge-request --> - ## Time spent <!--- @@ -38,7 +35,6 @@ Docs: https://docs.gitlab.com/ee/workflow/time_tracking.html /spend Xh - ## Assignee <!--- @@ -49,7 +45,6 @@ Docs: https://docs.gitlab.com/ee/user/project/quick_actions.html /assign - ## Feedback <!--- @@ -57,5 +52,4 @@ Did you encounter any other problems you want to share with us? Optional. Feel free to remove this section if you don't have any feedback. --> - <!--- Thank you for you contribution! --> diff --git a/README.md b/README.md index 1f78d8dc9876a189fad5322bf88a500331b13cac..d673fd9d33d9a1214e2466d9efe567bafc52ef0e 100644 --- a/README.md +++ b/README.md @@ -108,8 +108,8 @@ On `config.json`: ```json "clientName": "Hubl", - "clientFavicon": "/images/favicon.png", - "clientLogo": "/images/logo.png", + "clientFavicon": "/images/favicon.webp", + "clientLogo": "/images/logo.webp", "clientLogoHeight": "32px", "clientCSS": "/path/to/custom.css", "authorityName": "djangoldp-server-name" diff --git a/config.sample.federated.json b/config.sample.federated.json index 0fa0a632f3cc32f1accaa14f78715e1b644998bc..7eb80092fa70c89bd6a8add41979c57297d8b12e 100644 --- a/config.sample.federated.json +++ b/config.sample.federated.json @@ -1,6 +1,8 @@ { "xmpp": "https://jabber.happy-dev.fr/http-bind/", "authority": "http://localhost:8000/", + "clientName": "Hubl", + "clientLogo": "https://cdn.startinblox.com/logos/hubl-logo.png", "endpoints": { "get": { "skills": "http://localhost:8000/skills/", diff --git a/config.sample.json b/config.sample.json index 47b7bf133239ed57ba5eca2bdb9d01d1caf20922..0df2760821d7063fb857d2ae7e1651902f092af4 100644 --- a/config.sample.json +++ b/config.sample.json @@ -2,6 +2,8 @@ "xmpp": "https://jabber.happy-dev.fr/http-bind/", "authority": "http://localhost:8000/", "authorityName": "djangoldp-server-name", + "clientName": "Hubl", + "clientLogo": "https://cdn.startinblox.com/logos/hubl-logo.png", "endpoints": { "groups": "http://localhost:8000/groups/", "skills": "http://localhost:8000/skills/", diff --git a/make-webmanifest.mjs b/make-webmanifest.mjs new file mode 100644 index 0000000000000000000000000000000000000000..097076b6575f5a5147bf46f9aa2434072f8bb633 --- /dev/null +++ b/make-webmanifest.mjs @@ -0,0 +1,39 @@ +'use strict'; +import fs from 'fs'; + +if(!fs.existsSync("config.json")) throw "[Error] (Mandatory) Missing config.json file"; + +let config = JSON.parse(fs.readFileSync('config.json')); + +if(!config.clientName) throw "[Error] (Mandatory) Missing clientName on config.json"; +if(!config.clientLogo) throw "[Error] (Mandatory) Missing clientLogo on config.json"; + +let manifest = { + "lang": "fr", + "dir": "ltr", + "name": config.clientName, + "description": `Hubl of ${config.clientName}`, + "short_name": config.clientName, + "icons": [{ + "src": config.clientLogo, + "purpose": "any" + }, { + "src": "/images/hubl-icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, { + "src": "/images/hubl-icon-512.png", + "sizes": "512x512", + "type": "image/png" + }], + "start_url": ".", + "display": "standalone", + "orientation": "portrait", + "background_color": "#fff", + 'theme_color': "white" +} + +fs.existsSync("dist") || fs.mkdirSync("dist"); +fs.writeFileSync('dist/manifest.webmanifest', JSON.stringify(manifest, null, 2)); + +console.log(`Created manifest for ${config.clientName}`); \ No newline at end of file diff --git a/package.json b/package.json index bfa87c509aab5c49526f732cb84467349921e828..7048568f2aaa364960c1e58ddb56d815e2f1634c 100644 --- a/package.json +++ b/package.json @@ -11,29 +11,35 @@ "build:css": "node-sass src/styles/index.scss -o dist/styles/", "build:js": "babel \"src/scripts/*.js\" -o dist/scripts/index.js", "build:jscomponents": "babel \"src/components/*.js\" --out-dir dist/components/", - "build:html": "pug src/index.pug -o dist/ --obj config.json", + "build:pug": "pug src/index.pug -o dist/ --obj config.json", + "build:manifest": "node --experimental-modules make-webmanifest.mjs", "build:i18n": "copyfiles -u 2 src/locales/*.json dist/locales", "copy:font": "copyfiles -f src/fonts/* dist/fonts", "copy:image": "copyfiles -f src/images/* dist/images", + "copy:sw": "copyfiles -f src/sw.js dist", "serve": "pushstate-server -d ./dist -p 3000", "watch": "run-p build watch:* serve", "watch:css": "npm-watch build:css", "watch:js": "npm-watch build:js", "watch:jscomponents": "npm-watch build:jscomponents", + "watch:manifest": "npm-watch build:manifest", "watch:pug": "pug --watch src/index.pug -o dist/ --obj config.json", "watch:i18n": "npm-watch build:i18n", "watch:font": "npm-watch copy:font", "watch:image": "npm-watch copy:image", + "watch:sw": "npm-watch copy:sw", "cypress:open": "cypress open", "cypress:verify": "cypress verify", "cypress:info": "cypress info", "test": "cypress run" }, "watch": { - "build:css": "src/styles/*", - "build:i18n": "src/locales/*", + "build:css": "src/styles/**/*", + "build:manifest": "make-webmanifest.mjs", + "build:i18n": "src/locales/**/*", "copy:images": "src/fonts/*.js", "copy:fonts": "src/images/*.js", + "copy:sw": "src/sw.js", "build:js": "src/scripts/*.js", "build:jscomponents": "src/components/*.js" }, diff --git a/src/components/hubl-reactivity.js b/src/components/hubl-reactivity.js index 443a517f01b35b87433b6853e79395aaf4b86cbb..2dc766c264a3e7efda4ece0087db0bc9a6d91c4d 100644 --- a/src/components/hubl-reactivity.js +++ b/src/components/hubl-reactivity.js @@ -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', diff --git a/src/components/hubl-search-users.js b/src/components/hubl-search-users.js index b640f3bb857556bbaa812542aa3617f1a2817a26..f8bb6185f4c2ce873c22ab474d1695c6ca501ed4 100644 --- a/src/components/hubl-search-users.js +++ b/src/components/hubl-search-users.js @@ -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', diff --git a/src/components/hubl-status.js b/src/components/hubl-status.js index 76372c0dc3a6b6a1a3ca604454457b0d25b50e40..57296f001c2fc2509938de9e367dd8fe460b598f 100644 --- a/src/components/hubl-status.js +++ b/src/components/hubl-status.js @@ -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()); }, ); diff --git a/src/dependencies.pug b/src/dependencies.pug index fac6741937a56b94521f09033f4536c88de0e950..d6cec948d51fe0e838ad3aa370a20a35777cf651 100644 --- a/src/dependencies.pug +++ b/src/dependencies.pug @@ -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) diff --git a/src/header.pug b/src/header.pug index 9ea0b6f8129ec3c8c9ac60c03892ef1c09ec218f..ce24cfb024aba66bc0f9f506609e2334b3cf2c58 100644 --- a/src/header.pug +++ b/src/header.pug @@ -52,7 +52,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') diff --git a/src/images/favicon.png b/src/images/favicon.png deleted file mode 100644 index e7152788c0172d45c7ea4010246284dee8d303e9..0000000000000000000000000000000000000000 Binary files a/src/images/favicon.png and /dev/null differ diff --git a/src/images/favicon.webp b/src/images/favicon.webp new file mode 100644 index 0000000000000000000000000000000000000000..d16fe6821d0788692196b255eae5132c5b0cb775 Binary files /dev/null and b/src/images/favicon.webp differ diff --git a/src/images/hubl-icon-192.png b/src/images/hubl-icon-192.png new file mode 100644 index 0000000000000000000000000000000000000000..efe199bc66cacf329dd874a272b1378b34f714a0 Binary files /dev/null and b/src/images/hubl-icon-192.png differ diff --git a/src/images/hubl-icon-512.png b/src/images/hubl-icon-512.png new file mode 100644 index 0000000000000000000000000000000000000000..3b3e05982c2ce7e87fde3cc1ea5164a68d2c6318 Binary files /dev/null and b/src/images/hubl-icon-512.png differ diff --git a/src/images/logo.png b/src/images/logo.png deleted file mode 100644 index ea256f29d210e739754ab48ece88df8aa11eb104..0000000000000000000000000000000000000000 Binary files a/src/images/logo.png and /dev/null differ diff --git a/src/images/logo.webp b/src/images/logo.webp new file mode 100644 index 0000000000000000000000000000000000000000..a7f0c09c09ef1ef5f9f454c68ec8b3bb5678e48e Binary files /dev/null and b/src/images/logo.webp differ diff --git a/src/index.pug b/src/index.pug index 291fb4ce271c190320c5f116326cbffb226c0f13..eb91c41b58d8a19e47b87147d63783f8a282151f 100644 --- a/src/index.pug +++ b/src/index.pug @@ -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 //- header#header.header.is-spaced(role='banner') diff --git a/src/page-messages.pug b/src/page-messages.pug index 7487d67a4e62efc2a7c53c0e7498a0d111440af1..6bf87827e0ad7776c588129b43ed2905484a6b74 100644 --- a/src/page-messages.pug +++ b/src/page-messages.pug @@ -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 diff --git a/src/scripts/login-element-visibility.js b/src/scripts/login-element-visibility.js index cc0daf18b3ced57f71b1d2fc0c8ff4fb7ab543b9..3210e53027833fa297850882df17393851524c25 100644 --- a/src/scripts/login-element-visibility.js +++ b/src/scripts/login-element-visibility.js @@ -1,4 +1,4 @@ -document.addEventListener("DOMContentLoaded", function (event) { +document.addEventListener("DOMContentLoaded", function () { document .querySelector("sib-auth") .getUser() diff --git a/src/scripts/navigate-event.js b/src/scripts/navigate-event.js index ba4eb0b5de4d139165bdef0c1717796e8e176bb4..1ac1f3e1d5b2f7bfb1ab81f4c2947db168dd007e 100644 --- a/src/scripts/navigate-event.js +++ b/src/scripts/navigate-event.js @@ -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(); }); } diff --git a/src/scripts/register-sw.js b/src/scripts/register-sw.js new file mode 100644 index 0000000000000000000000000000000000000000..c479a1258f4e905c7ccb537f5c88d09fce61c7a0 --- /dev/null +++ b/src/scripts/register-sw.js @@ -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'); +// } \ No newline at end of file diff --git a/src/scripts/unreads-menu.js b/src/scripts/unreads-menu.js index ae5dc2ca00cc398bea10d6767da96c7075ff649a..e35c7e93f0fe549c7343aa6cd8e160e575fb9706 100644 --- a/src/scripts/unreads-menu.js +++ b/src/scripts/unreads-menu.js @@ -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 => { diff --git a/src/scripts/widget-extension.js b/src/scripts/widget-extension.js index 13c2295f14b528077b882dcd9d2940b771e3ed92..0c0339f0bb128413d91bca04e292d77464d642e3 100644 --- a/src/scripts/widget-extension.js +++ b/src/scripts/widget-extension.js @@ -44,7 +44,7 @@ function recursiveAdaptWidgets(prefix, element, user) { }); } -document.addEventListener("DOMContentLoaded", function (event) { +document.addEventListener("DOMContentLoaded", function () { document .querySelector("sib-auth") .getUser() diff --git a/src/styles/base/header.scss b/src/styles/base/header.scss index c6a342f212b5ee394b814632c2c6318525abe4b6..1f1650d22fe275f879b9d95745eb45a326592554 100644 --- a/src/styles/base/header.scss +++ b/src/styles/base/header.scss @@ -54,8 +54,8 @@ border-radius: 3px; background: var(--color-primary); color: var(--color-white); - position: absolute; - top: -9px; + position: fixed; + top: 12px; left: 267px; } } diff --git a/src/styles/base/main.scss b/src/styles/base/main.scss index e2412d022385c9a9a178ea9b45136c5f9530c671..1f9970fab03af6ee9a9f57563c17bba35728704a 100644 --- a/src/styles/base/main.scss +++ b/src/styles/base/main.scss @@ -674,7 +674,7 @@ h5 { margin: 0 1.6rem; @include breakpoint(lg) { - padding: 3rem; + padding: 2rem; margin: 0; } diff --git a/src/styles/layout/user/_index.scss b/src/styles/layout/user/_index.scss index 5158e8e537a4caea276c4cecdb76ae42c160ab85..865c28195c4af7c137ef9c56e993007530e6f6a0 100644 --- a/src/styles/layout/user/_index.scss +++ b/src/styles/layout/user/_index.scss @@ -1 +1 @@ -@import 'user-profile'; +@import 'messages'; diff --git a/src/styles/layout/user/messages.scss b/src/styles/layout/user/messages.scss new file mode 100644 index 0000000000000000000000000000000000000000..f0ae1ec8c78943bd308846e7da5d17a7e38f0643 --- /dev/null +++ b/src/styles/layout/user/messages.scss @@ -0,0 +1,13 @@ +.avatar-container { + display: inline-block; + margin-right: 10px; + + .avatar { + height: 40px; + width: 40px; + } +} +.avatar-text { + position: absolute; + top: 2.8rem; +} \ No newline at end of file diff --git a/src/styles/layout/user/user-profile.scss b/src/styles/layout/user/user-profile.scss deleted file mode 100644 index 8a2be675193abeda567526632a47152a3d517227..0000000000000000000000000000000000000000 --- a/src/styles/layout/user/user-profile.scss +++ /dev/null @@ -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; - } - } - } -}*/ diff --git a/src/sw.js b/src/sw.js new file mode 100644 index 0000000000000000000000000000000000000000..a61d59b4d34e81b71ac9bb0ae737991bcf0db679 --- /dev/null +++ b/src/sw.js @@ -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)); + } + } + } +}); \ No newline at end of file