Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.17 #509

Merged
merged 5 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
30 changes: 30 additions & 0 deletions src/components/ProjectTimeline/helpers/createDeadlines.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/input/Input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
14 changes: 13 additions & 1 deletion src/components/input/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
15 changes: 5 additions & 10 deletions src/components/projectCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Loading