From 180a4f5bdafce24b09f9e0ca30ed272631e9cf1b Mon Sep 17 00:00:00 2001 From: Eemeli Kukkonen Date: Mon, 10 Feb 2025 15:11:44 +0200 Subject: [PATCH 1/5] KAPI-89 fix css for rolling info text-input in fieldsets --- src/components/input/Input.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/input/Input.scss b/src/components/input/Input.scss index caa17ff5d..bd3de62c3 100644 --- a/src/components/input/Input.scss +++ b/src/components/input/Input.scss @@ -718,7 +718,7 @@ background-color: $color-fog-light; padding-bottom: 27.5px; .field{ - .text-input,.selection,.ad-combobox{ + .text-input:not(.rolling-info-container .text-input),.selection,.ad-combobox{ max-width: 256px; } } From 513be3de324a22e48a4de9d6ed184aae205b90be Mon Sep 17 00:00:00 2001 From: Eemeli Kukkonen Date: Mon, 10 Feb 2025 16:30:42 +0200 Subject: [PATCH 2/5] KAPI-99 Encode second colon in pw urn to avoid window.open error --- src/components/input/Link.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/input/Link.js b/src/components/input/Link.js index f2dd19cd8..aae183f06 100644 --- a/src/components/input/Link.js +++ b/src/components/input/Link.js @@ -7,7 +7,19 @@ import { useTranslation } from 'react-i18next'; import RollingInfo from '../input/RollingInfo' const Link = props => { - const openLink = () => window.open(currentValue) + const openLink = () => { + try { + window.open(currentValue); + } + catch (e) { + if (currentValue.includes("pw://")){ + const encoded_URN = "pw://" + currentValue.split("pw://")[1].replace(":", "%3A"); + window.open(encoded_URN); + } else { + throw e; + } + } + } const {t} = useTranslation() From 3ed45e4a67a0043ad7d93ba773dd4e1fc14c4de9 Mon Sep 17 00:00:00 2001 From: Eemeli Kukkonen Date: Mon, 10 Feb 2025 17:09:01 +0200 Subject: [PATCH 3/5] KAPI-100 fix missing project card values when items have been deleted from fieldsets --- src/components/projectCard/index.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/components/projectCard/index.js b/src/components/projectCard/index.js index a6c90a3d1..086225169 100644 --- a/src/components/projectCard/index.js +++ b/src/components/projectCard/index.js @@ -129,17 +129,12 @@ function ProjectCardPage({ ) projectCardFields && projectCardFields.forEach(field => { - let value = projectUtils.findValueFromObject(projectData, field.name) + let value; + const returnValues = []; + projectUtils.findValuesFromObject(projectData, field.name, returnValues); - const returnValues = [] - projectUtils.findValuesFromObject(projectData, field.name, returnValues) - - if (returnValues.length > 1) { - let currentValues = [] - returnValues.forEach(current => { - currentValues.push(current) - }) - value = currentValues + if (returnValues.length > 0) { + value = returnValues.length === 1 ? returnValues[0] : returnValues; } let newField = { From 92b8914c7f03d44f6558eed193c6a5a5ad482756 Mon Sep 17 00:00:00 2001 From: Eemeli Kukkonen Date: Tue, 11 Feb 2025 15:51:09 +0200 Subject: [PATCH 4/5] KAAV-2452 Fix timeline not appearing when phase start and end are out of visible range --- .../helpers/createDeadlines.js | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/components/ProjectTimeline/helpers/createDeadlines.js b/src/components/ProjectTimeline/helpers/createDeadlines.js index 1ddcb8e17..182a506b5 100644 --- a/src/components/ProjectTimeline/helpers/createDeadlines.js +++ b/src/components/ProjectTimeline/helpers/createDeadlines.js @@ -152,11 +152,13 @@ function fillGaps(inputMonths, deadlines) { let deadlinePropAbbreviation = null let monthDateIndex = null const has = Object.prototype.hasOwnProperty + let has_endpoint_in_range = false; for (let i = 0; i < monthDates.length; i++) { for (const prop in monthDates[i]) { if (has.call(monthDates[i], prop)) { if (Object.keys(monthDates[i]).length < 4) { if (Array.isArray(monthDates[i][prop].deadline_type)) { + has_endpoint_in_range = true; if (monthDates[i][prop].deadline_type[0] === 'phase_start' || monthDates[i][prop].deadline_type[0] === 'past_start_point') { deadlineAbbreviation = monthDates[i][prop].abbreviation color_code = monthDates[i][prop].color_code @@ -212,6 +214,34 @@ function fillGaps(inputMonths, deadlines) { } } } + + // Special case: no phase start/endpoints are in visible range + if (!has_endpoint_in_range) { + let [min_year, min_month] = monthDates[0].date.split('-'); + min_month = min_month.length == 1 ? "0" + min_month : min_month; + let min_day = (((monthDates[0].week-1) * 7) +1).toString(); + min_day = min_day.length == 1 ? "0" + min_day : min_day; + const min_date = Date.parse([min_year, min_month, min_day].join('-')); + + let phase_color, abbr; + for (const dl of deadlines) { + if (dl.deadline?.deadline_types?.includes('phase_start')) { + phase_color = dl.deadline?.phase_color_code; + abbr = dl.deadline?.abbreviation + } + if (dl.date && Date.parse(dl.date) > min_date){ + break; + } + } + for (let i = 0; i < monthDates.length; i++) { + monthDates[i].midpoint = { + abbreviation: abbr, + deadline_type: ['mid_point'], + color_code: phase_color + } + } + } + return createMilestones(monthDates, deadlines) } /** From ed315aae1591fb74ebd0bb676f6065f9fe1c304b Mon Sep 17 00:00:00 2001 From: Henri Haapala <124666191+henrihaapalasiili@users.noreply.github.com> Date: Thu, 13 Feb 2025 14:34:38 +0200 Subject: [PATCH 5/5] KAAV-1627 Limit Matomo analytics to prod env (#507) --- src/components/App.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/components/App.js b/src/components/App.js index abb6bf17d..4a2fb9c65 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -34,16 +34,20 @@ class App extends Component { componentDidMount(){ //Matomo analytic - let _paq = window._paq = window._paq || []; - _paq.push(['trackPageView']); - _paq.push(['enableLinkTracking']); - (function() { - let u="//matomo.hel.fi/"; - _paq.push(['setTrackerUrl', u+'matomo.php']); - _paq.push(['setSiteId', '74']); - let d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; - g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); - })(); + const currentEnv = process.env.REACT_APP_ENVIRONMENT + + if(currentEnv === 'production'){ + let _paq = window._paq = window._paq || []; + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + (function() { + let u="//matomo.hel.fi/"; + _paq.push(['setTrackerUrl', u+'matomo.php']); + _paq.push(['setSiteId', '74']); + let d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; + g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); + })(); + } } componentDidUpdate(prevProps) {