From fac6fb78e1055de89639367608adb55f9edf09d4 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Wed, 19 Mar 2025 13:27:29 -0700 Subject: [PATCH 1/2] Chapter list 'last action' column color/tooltip Updated color ranges based on request from IC (Michelle) and add tooltips for days since last action / days remaining before offboarding. --- frontend/ChapterList.vue | 64 ++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/frontend/ChapterList.vue b/frontend/ChapterList.vue index da8a4ba..fb0fb1e 100644 --- a/frontend/ChapterList.vue +++ b/frontend/ChapterList.vue @@ -94,7 +94,6 @@ {{ props.row.LastContact || 'None' }} @@ -103,15 +102,14 @@ {{ props.row.LastAction || 'None' }} - {{ - props.row.LastFBEvent || 'None' - }} + {{ props.row.LastFBEvent || 'None' }} @@ -584,6 +582,14 @@ interface Organizer { Facebook: string; } +const Colors = { + GREEN: 'is-success', + YELLOW: 'is-warning', + RED: 'is-danger', + GRAY: 'is-grey', + BLACK: 'is-black', +}; + export default Vue.extend({ name: 'chapter-list', computed: { @@ -754,12 +760,13 @@ export default Vue.extend({ const csrfToken = $('meta[name="csrf-token"]').attr('content'); this.disableConfirmButton = true; + const data = JSON.stringify(this.currentChapter); $.ajax({ url: '/chapter/save', method: 'POST', headers: { 'X-CSRF-Token': csrfToken }, contentType: 'application/json', - data: JSON.stringify(this.currentChapter), + data, success: (data) => { this.disableConfirmButton = false; @@ -853,31 +860,50 @@ export default Vue.extend({ }, colorFBSyncStatus(text: string) { const time = dayjs(text).add(8, 'hour'); // this converts our DB time for this field to UTC - let c = 'is-grey'; + let c = Colors.GRAY; if (time.isValid()) { - c = 'is-danger'; + c = Colors.RED; } if (time.isAfter(dayjs().add(-1, 'day'))) { - c = 'is-warning'; + c = Colors.YELLOW; } if (time.isAfter(dayjs().add(-1, 'hour'))) { - c = 'is-success'; + c = Colors.GREEN; } return c; }, - colorQuarterlyGoal(text: string) { + colorLastAction(text: string) { const time = dayjs(text); - let c = ''; - if (time.isValid()) { - c = 'is-danger'; + + if (!time.isValid()) { + return Colors.GRAY; } - if (time.isAfter(dayjs().add(-58, 'day'))) { - c = 'is-warning'; + + if (time.isAfter(dayjs().subtract(30 * 2, 'day'))) { + return Colors.GREEN; + } else if (time.isAfter(dayjs().subtract(30 * 3.5, 'day'))) { + return Colors.YELLOW; + } else if (time.isAfter(dayjs().subtract(30 * 4 + 1, 'day'))) { + // + 1 because "black" means the chapter should be offboarded, but + // when there are "0" days remaining according to date subtraction, + // there still may be a fraction of a day remaining in reality because + // protests don't start at the 0th hour of the day. + return Colors.RED; + } else { + return Colors.BLACK; } - if (time.isAfter(dayjs().add(-29, 'day'))) { - c = 'is-success'; + }, + lastActionTooltip(text: string) { + const time = dayjs(text); + + if (!time.isValid()) { + return undefined; } - return c; + + const daysSinceLastActionText = dayjs().diff(time, 'day') + ' days since last action'; + const daysRemainingToHostActionText = + time.add(30 * 4, 'day').diff(dayjs(), 'day') + ' days remaining to host an action'; + return daysSinceLastActionText + '\n' + daysRemainingToHostActionText; }, dateInLastThreeMonths(text: string): boolean { return dayjs(text).isAfter(dayjs().add(-3, 'month')); From 5392cc301f806a9a8078719029e9521225807a11 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Wed, 19 Mar 2025 21:00:53 +0000 Subject: [PATCH 2/2] Hide FB columns on chapter page by default --- frontend/ChapterList.vue | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/frontend/ChapterList.vue b/frontend/ChapterList.vue index fb0fb1e..c468722 100644 --- a/frontend/ChapterList.vue +++ b/frontend/ChapterList.vue @@ -64,10 +64,19 @@ +
+ Show FB columns +
- +
@@ -108,11 +117,25 @@ > - + {{ props.row.LastFBEvent || 'None' }} - + @@ -914,6 +937,7 @@ export default Vue.extend({ currentChapter: {} as Chapter, currentChapterIndex: -1, chapters: [] as Chapter[], + showFacebookColumns: false, disableConfirmButton: false, currentModalName: '', showMoreOptions: false,