Skip to content

Commit a465f58

Browse files
committed
Updated shoelace library to 2.18.0; Additional styling corrections including fixing issues with carousel-item and default theme switch
1 parent 9cf6052 commit a465f58

File tree

5 files changed

+107
-40
lines changed

5 files changed

+107
-40
lines changed

src/main/resources/static/css/index.css

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,51 @@ sl-radio-group[name='predefinedDataSelection']::part(form-control-input) {
282282
sl-alert {
283283
white-space: normal;
284284
overflow-wrap: break-word;
285+
}
286+
287+
/* Hide vertical scrollbar for WebKit browsers (Chrome, Safari) */
288+
sl-carousel-item::-webkit-scrollbar {
289+
width: 0; /* Hide vertical scrollbar */
290+
}
291+
292+
/* Hide vertical scrollbar for Firefox */
293+
sl-carousel-item {
294+
scrollbar-width: none; /* Hide vertical scrollbar */
295+
}
296+
297+
/* For Edge and Internet Explorer */
298+
sl-carousel-item {
299+
-ms-overflow-style: none; /* Hide scrollbar */
300+
}
301+
302+
@media (max-width: 451px) {
303+
#jiraActivityStreamDiv {
304+
font-size: 0.42vw;
305+
text-align: center;
306+
font-family: monospace;
307+
}
308+
}
309+
310+
@media (min-width: 551px) and (max-width: 780px) {
311+
#jiraActivityStreamDiv {
312+
font-size: 0.59vw;
313+
text-align: center;
314+
font-family: monospace;
315+
}
316+
}
317+
318+
@media (min-width: 780px) and (max-width: 1180px) {
319+
#jiraActivityStreamDiv {
320+
font-size: 0.78vw;
321+
text-align: center;
322+
font-family: monospace;
323+
}
324+
}
325+
326+
@media (min-width: 1180px) {
327+
#jiraActivityStreamDiv {
328+
font-size: 0.95vw;
329+
text-align: center;
330+
font-family: monospace;
331+
}
285332
}

src/main/resources/static/js/developers.js

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'https://cdn.jsdelivr.net/npm/@shoelace-style/[email protected]/cdn/components/alert/alert.js';
2+
13
$(window).on("load", async () => {
24
await Promise.all([
35
customElements.whenDefined("sl-tab-panel"),
@@ -10,18 +12,35 @@ $(window).on("load", async () => {
1012
const themeSwitch = $('#theme-switch');
1113

1214
themeSwitch.on('sl-change', (event) => {
15+
alert = Object.assign(document.createElement('sl-alert'), {
16+
variant: 'primary',
17+
closable: false,
18+
duration: 1000,
19+
innerHTML: `
20+
<sl-icon name="info-circle" slot="icon"></sl-icon>
21+
Theme switched to ${event.target.checked ? 'dark' : 'light'}
22+
`
23+
});
24+
1325
if (event.target.checked) {
1426
$('html').addClass('sl-theme-dark');
1527
themeDarkLink.removeAttr('disabled');
1628
themeLightLink.attr('disabled', 'disabled');
29+
1730
} else {
1831
$('html').removeClass('sl-theme-dark');
1932
themeDarkLink.attr('disabled', 'disabled');
2033
themeLightLink.removeAttr('disabled');
2134
}
35+
36+
document.body.append(alert);
37+
alert.toast();
2238
});
2339

24-
setTimeout(() => themeSwitch.click(), 1);
40+
const switchThemeInterval = setInterval(() => {
41+
themeSwitch.click();
42+
clearInterval(switchThemeInterval);
43+
}, 100);
2544

2645
$('.sl-rating-developer').each((index, slRating) => slRating.getSymbol = (() => '<sl-icon name="code-slash"></sl-icon>')); // Change icon for every sl-rating with class .rating-developers
2746
$(".developerExperienceSlRange").each((index, slRange) => slRange.tooltipFormatter = value => `Developer experience - ${value}/10`); // Change tooltip message on each slRange instances
@@ -106,15 +125,16 @@ $(window).on("load", async () => {
106125
const developersCarousel = $("#sl-tab-panel-1 sl-carousel")[0];
107126
$(developersCarousel.shadowRoot).find("#scroll-container").css("overflow-y", "auto");
108127

109-
const observer = new MutationObserver(mutationsList => {
110-
for (const mutation of mutationsList) {
111-
if (mutation.type === 'attributes' && mutation.attributeName === 'inert') {
112-
mutation.target.removeAttribute('inert');
128+
const observer = new MutationObserver(mutations => {
129+
mutations.forEach(mutation => {
130+
// Check if the mutation is related to the 'inert' attribute
131+
if ((mutation.type === 'attributes' && mutation.attributeName === 'inert') || mutation.target.hasAttribute('inert')) {
132+
mutation.target.removeAttribute('inert'); // Remove the 'inert' attribute
113133
}
114-
}
134+
});
115135
});
116136

117-
observer.observe(developersCarousel, { childList: true, subtree: true, attributes: true });
137+
observer.observe(developersCarousel, { childList: true, subtree: true, attributeFilter: ["inert"] });
118138
})
119139

120140
function setupResize() {

src/main/resources/static/js/index.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
import 'https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.16.0/cdn/components/alert/alert.js';
2-
import 'https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.16.0/cdn/components/popup/popup.js';
1+
import 'https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.18.0/cdn/components/alert/alert.js';
2+
import 'https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.18.0/cdn/components/popup/popup.js';
33
import {ansi2html_string} from './ansi2html.js';
44

5-
const observer = new MutationObserver(mutationsList => {
6-
for (const mutation of mutationsList) {
7-
if (mutation.type === 'attributes' && mutation.attributeName === 'inert') {
8-
mutation.target.removeAttribute('inert');
9-
}
10-
}
11-
});
12-
135
$(window).on("load", async () => {
146
const themeLightLink = $('#theme-light');
157
const themeDarkLink = $('#theme-dark');
@@ -31,9 +23,14 @@ $(window).on("load", async () => {
3123
flatpickrDark.attr('disabled', 'disabled');
3224
flatpickrLight.removeAttr('disabled');
3325
}
26+
27+
notifyInfo(`Theme switched to ${event.target.checked ? 'dark' : 'light'}`)
3428
});
3529

36-
setTimeout(() => themeSwitch.click(), 1);
30+
const switchThemeInterval = setInterval(() => {
31+
themeSwitch.click();
32+
clearInterval(switchThemeInterval);
33+
}, 100);
3734

3835
flatpickr("sl-input[name='epicCreatedOn']", {
3936
enableTime: true,
@@ -1020,6 +1017,15 @@ function updateCustomEpicsList() {
10201017
const customUserStories = $("#customUserStories")[0];
10211018
const customTechnicalTasks = $("#customTechnicalTasks")[0];
10221019

1020+
const observer = new MutationObserver(mutations => {
1021+
mutations.forEach(mutation => {
1022+
// Check if the mutation is related to the 'inert' attribute
1023+
if ((mutation.type === 'attributes' && mutation.attributeName === 'inert') || mutation.target.hasAttribute('inert')) {
1024+
mutation.target.removeAttribute('inert'); // Remove the 'inert' attribute
1025+
}
1026+
});
1027+
});
1028+
10231029
currentPredefinedData.forEach((value, key) => {
10241030
$("#epicsWrapper").append(`<sl-card id="epic_#${key}" style="height:100%; --border-color: rgb(150, 2, 253, 1); text-align: -webkit-center;" xmlns="http://www.w3.org/1999/html">
10251031
<strong>ID: ${value.epicId}</strong>
@@ -1058,10 +1064,7 @@ function updateCustomEpicsList() {
10581064

10591065
const userStoriesCarousel = $("sl-tab-panel[name='customUserStoriesViewTab'] sl-carousel");
10601066

1061-
setTimeout(() => {
1062-
$(userStoriesCarousel[0].shadowRoot).find("#scroll-container").css("overflow-y", "auto");
1063-
observer.observe(userStoriesCarousel[0], { childList: true, subtree: true, attributes: true });
1064-
}, 500);
1067+
observer.observe(userStoriesCarousel[0], { childList: true, subtree: true, attributeFilter: ["inert"] });
10651068

10661069
$(userStoriesCarousel).on('sl-slide-change', event => {
10671070
$(customUserStories.shadowRoot).find("#title slot").html($(customUserStories.shadowRoot).find("#title slot").html().split("(")[0] + "(Currently viewing Epic: '" + $(event.target.children).filter((index, child) => $(child).attr('class') && $(child).attr('class').includes('--is-active'))[0].id.split("Of")[1] + "')");
@@ -1076,10 +1079,7 @@ function updateCustomEpicsList() {
10761079

10771080
const technicalTasksCarousel = $("sl-tab-panel[name='customTechnicalTasksViewTab'] sl-carousel");
10781081

1079-
setTimeout(() => {
1080-
$(technicalTasksCarousel[0].shadowRoot).find("#scroll-container").css("overflow-y", "auto");
1081-
observer.observe(technicalTasksCarousel[0], { childList: true, subtree: true, attributes: true });
1082-
}, 500);
1082+
observer.observe(technicalTasksCarousel[0], { childList: true, subtree: true, attributeFilter: ["inert"] });
10831083

10841084
$(technicalTasksCarousel).on('sl-slide-change', event => {
10851085
$(customTechnicalTasks.shadowRoot).find("#title slot").html($(customTechnicalTasks.shadowRoot).find("#title slot").html().split("(")[0] + "(Currently viewing User story: '" + $(event.target.children).filter((index, child) => $(child).attr('class') && $(child).attr('class').includes('--is-active'))[0].id.split("Of")[1] + "')");
@@ -1108,7 +1108,7 @@ function updateCustomEpicsList() {
11081108
function updateCustomUserStoriesList(relatedEpicId, userStories) {
11091109
const userStoriesCarousel = $("sl-tab-panel[name='customUserStoriesViewTab'] sl-carousel");
11101110

1111-
userStoriesCarousel.append(`<sl-carousel-item id="userStoriesOf${relatedEpicId}" style="display: grid; grid-template-columns: repeat(var(--numberOfColumns), 1fr); height: 100%; row-gap: 1%; column-gap: 1%; text-align: -webkit-center;"></sl-carousel-item>`)
1111+
userStoriesCarousel.append(`<sl-carousel-item id="userStoriesOf${relatedEpicId}" style="display: grid; grid-template-columns: repeat(var(--numberOfColumns), 1fr); height: 100%; width: 99%; row-gap: 1%; column-gap: 1%; text-align: -webkit-center; overflow-y: auto;"></sl-carousel-item>`)
11121112

11131113
const userStorySlSelect = $("sl-select[name='selectedUserStory']");
11141114

@@ -1151,9 +1151,9 @@ function updateCustomUserStoriesList(relatedEpicId, userStories) {
11511151
}
11521152

11531153
function updateCustomTechnicalTasksList(relatedUserStoryId, technicalTasks) {
1154-
const technicalTaskCarousel = $("sl-tab-panel[name='customTechnicalTasksViewTab'] sl-carousel");
1154+
const technicalTasksCarousel = $("sl-tab-panel[name='customTechnicalTasksViewTab'] sl-carousel");
11551155

1156-
technicalTaskCarousel.append(`<sl-carousel-item id="technicalTaskOf${relatedUserStoryId}" style="display: grid; grid-template-columns: repeat(var(--numberOfColumns), 1fr); height: 100%; row-gap: 1%; column-gap: 1%; text-align: -webkit-center;"></sl-carousel-item>`)
1156+
technicalTasksCarousel.append(`<sl-carousel-item id="technicalTaskOf${relatedUserStoryId}" style="display: grid; grid-template-columns: repeat(var(--numberOfColumns), 1fr); height: 100%; width: 99%; row-gap: 1%; column-gap: 1%; text-align: -webkit-center; overflow-y: auto;"></sl-carousel-item>`)
11571157

11581158
setTimeout(() => $($("#customTechnicalTasks")[0].shadowRoot).find("#title slot").html("Manage technical tasks for predefined application flow (Currently viewing User story: '" + relatedUserStoryId + "')"), 500);
11591159

src/main/resources/templates/developersPage.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
55
<title>Software development simulator - Developers page</title>
6-
<link type="text/css" id="theme-light" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.16.0/cdn/themes/light.css" integrity="sha512-/wsGyRaDm069iXIoScQcUGhJKd5ifFvwidDeiaUA1moLaLQJrIDuskK6ZTYaibFvQT1wxgQhc51apWB6XShnzg==" crossorigin="anonymous">
7-
<link type="text/css" id="theme-dark" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.16.0/cdn/themes/dark.css" integrity="sha512-EiN8ncJeSJDtpZJTPNIvJ8MB6kdj7mPe5nQVK9cc9Ci8+92F3mUy3xHufAUzqKqCteas7rBLLmahmHYu35mJIA==" crossorigin="anonymous">
6+
<link type="text/css" id="theme-light" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.18.0/cdn/themes/light.css" integrity="sha512-/wsGyRaDm069iXIoScQcUGhJKd5ifFvwidDeiaUA1moLaLQJrIDuskK6ZTYaibFvQT1wxgQhc51apWB6XShnzg==" crossorigin="anonymous">
7+
<link type="text/css" id="theme-dark" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.18.0/cdn/themes/dark.css" integrity="sha512-EiN8ncJeSJDtpZJTPNIvJ8MB6kdj7mPe5nQVK9cc9Ci8+92F3mUy3xHufAUzqKqCteas7rBLLmahmHYu35mJIA==" crossorigin="anonymous">
88
<link type="text/css" rel="stylesheet" th:href="@{/css/developers.css}"/>
9-
<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.16.0/cdn/shoelace-autoloader.js" integrity="sha512-iTpkJ1vB9YD5jFwrppJ+0A6NIa8faZcY+iQTmkg4bkOfEw2R1OlLZnxsC43GzqHX92i87xCLULbYnFpBZFbAxA==" crossorigin="anonymous"></script>
9+
<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.18.0/cdn/shoelace-autoloader.js" integrity="sha512-Op8WeqWF7nCUmV9JTE/qM2VxVJJs4nwGbWQkUk6cNkCEFRLpe+/PVDeMtHlMdEX8mTmaPpEFyPnJThLZzsLhIg==" crossorigin="anonymous"></script>
1010
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js" integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous"></script>
11-
<script type="module" th:src="@{/js/developers.js}"></script>
11+
<script type="module" th:src="@{/js/developers.js}" defer></script>
1212
</head>
1313
<body>
1414
<div id="titleContainer" style="position: absolute; text-align: center;">

src/main/resources/templates/index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
<head>
44
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
55
<title>Software development simulator - Home page</title>
6-
<link type="text/css" id="theme-light" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.16.0/cdn/themes/light.css" integrity="sha512-/wsGyRaDm069iXIoScQcUGhJKd5ifFvwidDeiaUA1moLaLQJrIDuskK6ZTYaibFvQT1wxgQhc51apWB6XShnzg==" crossorigin="anonymous">
7-
<link type="text/css" id="theme-dark" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.16.0/cdn/themes/dark.css" integrity="sha512-EiN8ncJeSJDtpZJTPNIvJ8MB6kdj7mPe5nQVK9cc9Ci8+92F3mUy3xHufAUzqKqCteas7rBLLmahmHYu35mJIA==" crossorigin="anonymous">
6+
<link type="text/css" id="theme-light" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.18.0/cdn/themes/light.css" integrity="sha512-/wsGyRaDm069iXIoScQcUGhJKd5ifFvwidDeiaUA1moLaLQJrIDuskK6ZTYaibFvQT1wxgQhc51apWB6XShnzg==" crossorigin="anonymous">
7+
<link type="text/css" id="theme-dark" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.18.0/cdn/themes/dark.css" integrity="sha512-EiN8ncJeSJDtpZJTPNIvJ8MB6kdj7mPe5nQVK9cc9Ci8+92F3mUy3xHufAUzqKqCteas7rBLLmahmHYu35mJIA==" crossorigin="anonymous">
88
<link type="text/css" id="flatpickr-light" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css" integrity="sha512-MQXduO8IQnJVq1qmySpN87QQkiR1bZHtorbJBD0tzy7/0U9+YIC93QWHeGTEoojMVHWWNkoCp8V6OzVSYrX0oQ==" crossorigin="anonymous">
99
<link type="text/css" id="flatpickr-dark" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/themes/dark.css" integrity="sha512-fRrsq2NfGA3jgajOMPsvcxypg4Nhcm8cf+/FFT49o8cfXx0I1TagS6SieQgGqwlxVYP6sdYbqqny2e7F0bTjbQ==" crossorigin="anonymous">
1010
<link type="text/css" rel="stylesheet" th:href="@{/css/index.css}"/>
1111
<script type="module" src="https://cdn.jsdelivr.net/npm/flatpickr" integrity="sha512-K/oyQtMXpxI4+K0W7H25UopjM8pzq0yrVdFdG21Fh5dBe91I40pDd9A4lzNlHPHBIP2cwZuoxaUSX0GJSObvGA==" crossorigin="anonymous"></script>
12-
<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.16.0/cdn/shoelace-autoloader.js" integrity="sha512-iTpkJ1vB9YD5jFwrppJ+0A6NIa8faZcY+iQTmkg4bkOfEw2R1OlLZnxsC43GzqHX92i87xCLULbYnFpBZFbAxA==" crossorigin="anonymous"></script>
12+
<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.18.0/cdn/shoelace-autoloader.js" integrity="sha512-Op8WeqWF7nCUmV9JTE/qM2VxVJJs4nwGbWQkUk6cNkCEFRLpe+/PVDeMtHlMdEX8mTmaPpEFyPnJThLZzsLhIg==" crossorigin="anonymous"></script>
1313
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js" integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous"></script>
1414
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.0.1/mqttws31.min.js" integrity="sha512-nlrGqnXyDyswl/oRH13cQUfr7ZsQs0XxVAZP0Ygs1hzJcq0PiBgTzqnI3YSEFosXOPznrul6lDYcwVvc7gX0UA==" crossorigin="anonymous"></script>
15-
<script type="module" th:src="@{/js/index.js}"></script>
15+
<script type="module" th:src="@{/js/index.js}" defer></script>
1616
</head>
1717
<body>
1818
<header style="display: flex; align-items: center; justify-content: center; text-align: center;">
@@ -77,7 +77,7 @@
7777
</body>
7878

7979
<sl-dialog id="jiraActivityStream" label="Jira Activity Stream" style="--width: 96vw">
80-
<div style="text-align: center; font-family: monospace"></div>
80+
<div id="jiraActivityStreamDiv"></div>
8181
</sl-dialog>
8282

8383
<sl-dialog id="customEpics" label="Manage epics for predefined application flow" style="--width: 96vw">
@@ -132,7 +132,7 @@
132132
<sl-tab panel="customUserStoriesAddTab" slot="nav">Add</sl-tab>
133133
<sl-tab disabled panel="customUserStoriesEditTab" slot="nav">Edit</sl-tab>
134134

135-
<sl-tab-panel name="customUserStoriesViewTab">
135+
<sl-tab-panel name="customUserStoriesViewTab" style="overflow: hidden">
136136
<p>There aren't any user stories created in this session</p>
137137
</sl-tab-panel>
138138
<sl-tab-panel name="customUserStoriesAddTab">
@@ -176,7 +176,7 @@
176176
<sl-tab panel="customTechnicalTasksAddTab" slot="nav">Add</sl-tab>
177177
<sl-tab disabled panel="customTechnicalTasksEditTab" slot="nav">Edit</sl-tab>
178178

179-
<sl-tab-panel name="customTechnicalTasksViewTab">
179+
<sl-tab-panel name="customTechnicalTasksViewTab" style="overflow: hidden">
180180
<p>There aren't any technical tasks created in this session</p>
181181
</sl-tab-panel>
182182
<sl-tab-panel name="customTechnicalTasksAddTab">

0 commit comments

Comments
 (0)