diff --git a/src/Mods/Reminder/reminder.js b/src/Mods/Reminder/reminder.js index f8675e215bcf8a7f1a9c21e97755e399af6082fb..a057c1350395656b22f96e68882c650f1ce74d6a 100644 --- a/src/Mods/Reminder/reminder.js +++ b/src/Mods/Reminder/reminder.js @@ -1,24 +1,32 @@ App.Reminders.add = function(entry, week) { - if (entry.length > 0 && week.length > 0 && !isNaN(week) && week > 0) { - V.reminders.entries.push(entry); - V.reminders.weeks.push(week); - V.reminders.text.push(`${entry} in ${numberWithPlural(week, 'week')}`); - } + if (entry.length > 0 && week.length > 0 && !isNaN(week)) { + if (week <= 0) { + V.reminders.overdue.push(`<br> ${entry} [[Clear|Manage Personal Affairs][App.Reminders.remove(${V.reminders.overdue.length}, $reminders.overdue)]]`); + } else { + V.reminders.entries.push(entry); + V.reminders.weeks.push(week); + V.reminders.text.push(`<br> ${entry} in ${numberWithPlural(week, 'week')} [[Clear|Manage Personal Affairs][App.Reminders.remove(${V.reminders.text.length}, $reminders.text)]]`); + } + } }; +App.Reminders.remove = (i, arr) => arr.splice(i, 1); + App.Reminders.update = function() { - let entries = V.reminders.entries, - weeks = V.reminders.weeks, - text = []; + let entries = V.reminders.entries, + weeks = V.reminders.weeks, + text = [], + overdue = []; - for (let i = 0; i < entries.length; i++) { - weeks[i]--; - if (weeks[i] > 0) { - text.push(`${entries[i]} in ${numberWithPluralOne(weeks[i], 'week')}`); - } else { - entries.splice(i, 1); - weeks.splice(i, 1); - } - } - V.reminders.text = text; + for (let i = 0; i < entries.length; i++) { + weeks[i]--; + if (weeks[i] > 0) { + text.push(`${entries[i]} in ${numberWithPluralOne(weeks[i], 'week')}`); + } else { + overdue.push(entries[i]); + entries.splice(i, 1); + weeks.splice(i, 1); + } + } + V.reminders.text = text; }; diff --git a/src/pregmod/managePersonalAffairs.tw b/src/pregmod/managePersonalAffairs.tw index 7e1791e1e43c4b22a7a21941dcd71afc593d34ef..dc15a51bd18f26dae90ac188f43d44f9187f83b4 100644 --- a/src/pregmod/managePersonalAffairs.tw +++ b/src/pregmod/managePersonalAffairs.tw @@ -218,11 +218,18 @@ Sclera: <br><br> +<<if $reminders.overdue.length > 0>> + <span class="yellow"> /* TODO: this would be a good place for an "attn" or "attention" class */ + You have <<= numberWithPluralOne($reminders.overdue.length, "overdue reminders")>>: + </span> + <<print $reminders.overdue.join('')>> + <br> +<</if>> <<if $reminders.text.length == 0>> - You do not have any reminders set. + You do not have any upcoming reminders set. <<else>> You have <<=numberWithPluralOne($reminders.text.length, "reminder")>> set: - <<print $reminders.text>> + <<print $reminders.text.join('')>> <</if>> <br> Remind me @@ -232,11 +239,8 @@ in weeks. [[Add|Manage Personal Affairs][App.Reminders.add($reminderEntry, $reminderWeek)]] <br> -<<if $reminders.text.length > 0 || $cheatMode || $debugMode>> - [[Clear your reminders|Manage Personal Affairs][$reminders = {entries: [], weeks: [], text: []}]] - /* TODO: <<link "Clear a reminder" "Manage Personal Affairs">> - <<include "Clear Reminder">> - <</link>> */ +<<if $reminders.text.length > 0 || $reminders.overdue.length > 0 || $cheatMode || $debugMode>> + [[Clear your reminders|Manage Personal Affairs][$reminders = {entries: [], weeks: [], text: [], overdue: []}]] <</if>> <br><br> diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw index 372acfa978f7e5f270ddff9f87684dec487daae1..564c08cc6c5b4c755ae955a72d99fb08c4560db0 100644 --- a/src/uncategorized/BackwardsCompatibility.tw +++ b/src/uncategorized/BackwardsCompatibility.tw @@ -153,8 +153,8 @@ <<set $weddingPlanned = 0>> <</if>> -<<if ndef $reminders>> - <<set $reminders = {entries: [], weeks: [], text: []}>> +<<if ndef $reminders || ndef $reminders.overdue>> + <<set $reminders = {entries: [], weeks: [], text: [], overdue: []}>> <</if>> <<if $releaseID < 1057>> diff --git a/src/uncategorized/main.tw b/src/uncategorized/main.tw index 9714f4b24f242567f938bfd970a4c296b1b915aa..b3c05a591a500b795b5fca102bbd4d3ddcae874d 100644 --- a/src/uncategorized/main.tw +++ b/src/uncategorized/main.tw @@ -80,13 +80,26 @@ <<include "Office Description">> [[Hide|Main][$seeDesk = 0]] <</if>> + +<<if $reminders.overdue.length > 0 || $reminders.text.length > 0>> + <br> +<</if>> +<<if $reminders.overdue.length > 0>> + + <span class="yellow"> /* TODO: this would be a good place for an "attn" or "attention" class */ + You have <<= numberWithPluralOne($reminders.overdue.length, "overdue reminders")>>: + <<print $reminders.overdue>> + </span> + [[View reminders|Manage Personal Affairs]] + <br> +<</if>> <<if $reminders.text.length > 0>> -<br> You have <<=numberWithPluralOne($reminders.text.length, "reminder")>>: <<print $reminders.text>> - <br><br> + <br> <</if>> + <<if $seeFCNN == 1>> <<if $FCNNstation != 1 && $week >= 90>> <center>FCNN: <<print "FCNN service has been temporarily suspended. Please stand by.">> [[Hide|Main][$seeFCNN = 0]]</center>