diff --git a/src/scripts/scrumHelper.js b/src/scripts/scrumHelper.js index 9508b3ff..dc9ff097 100644 --- a/src/scripts/scrumHelper.js +++ b/src/scripts/scrumHelper.js @@ -995,20 +995,16 @@ function allIncluded(outputTarget = 'email') { log('[DEBUG] Both data processing functions completed, generating scrum body'); if (subjectForEmail) { // Synchronized subject and body injection for email - let lastWeekUl = ''; - let nextWeekUl = ''; + const lastWeekUl = buildActivityListHtml(); + const nextWeekUl = buildNextWeekListHtml(); + const blockerText = buildBlockerTextHtml(); const weekOrDay = yesterdayContribution ? 'yesterday' : 'the period'; const weekOrDay2 = 'today'; let content; if (yesterdayContribution) { - content = `1. What did I do ${weekOrDay}?
${lastWeekUl}
2. What do I plan to do ${weekOrDay2}?
${nextWeekUl}
3. What is blocking me from making progress?
${userReason}`; + content = `1. What did I do ${weekOrDay}?
${lastWeekUl}
2. What do I plan to do ${weekOrDay2}?
${nextWeekUl}
3. What is blocking me from making progress?
${blockerText}`; } else { - content = `1. What did I do from ${formatDate(startingDate)} to ${formatDate(endingDate)}?
${lastWeekUl}
2. What do I plan to do ${weekOrDay2}?
${nextWeekUl}
3. What is blocking me from making progress?
${userReason}`; + content = `1. What did I do from ${formatDate(startingDate)} to ${formatDate(endingDate)}?
${lastWeekUl}
2. What do I plan to do ${weekOrDay2}?
${nextWeekUl}
3. What is blocking me from making progress?
${blockerText}`; } // Wait for both subject and body to be available, then inject both let injected = false; @@ -1036,15 +1032,49 @@ function allIncluded(outputTarget = 'email') { return date.toLocaleDateString('en-US', options); } + const compactTextStyle = 'display: inline-block; padding: 0 8px; margin: 0; line-height: 1.2;'; + + function wrapCompactText(content) { + return `${content}`; + } + + function buildActivityListHtml() { + if (lastWeekArray.length === 0 && reviewedPrsArray.length === 0) { + return wrapCompactText('No activity to report for the selected time period.'); + } + + let activityList = ''; + return activityList; + } + + function buildNextWeekListHtml() { + if (nextWeekArray.length === 0) { + return wrapCompactText('No plans added yet.'); + } + + let nextWeekList = ''; + return nextWeekList; + } + + function buildBlockerTextHtml() { + return wrapCompactText(userReason); + } + function writeScrumBody() { - let lastWeekUl = ''; + const isToggleDisabled = typeof enableToggle !== 'undefined' && !enableToggle; + if (isToggleDisabled) { + scrumGenerationInProgress = false; + return; + } - let nextWeekUl = ''; + const lastWeekUl = buildActivityListHtml(); + const nextWeekUl = buildNextWeekListHtml(); + const blockerText = buildBlockerTextHtml(); const weekOrDay = yesterdayContribution ? 'yesterday' : 'the period'; const weekOrDay2 = 'today'; @@ -1056,14 +1086,14 @@ ${lastWeekUl}
2. What do I plan to do ${weekOrDay2}?
${nextWeekUl}
3. What is blocking me from making progress?
-${userReason}`; +${blockerText}`; } else { content = `1. What did I do from ${formatDate(startingDate)} to ${formatDate(endingDate)}?
${lastWeekUl}
2. What do I plan to do ${weekOrDay2}?
${nextWeekUl}
3. What is blocking me from making progress?
-${userReason}`; +${blockerText}`; } if (outputTarget === 'popup') {