From 170a5cd3de92913a620dfee12c988091b7f1dda5 Mon Sep 17 00:00:00 2001 From: tnagorra Date: Wed, 16 Oct 2024 10:29:25 +0545 Subject: [PATCH] Add icon support on group titles - Add clock on daily standup - Use human friendly date format on monthly calendar - Better UX for the availability dialog - Show disabled options instead of no option --- src/components/MonthlyCalendar/index.tsx | 15 ++++-- .../MonthlyCalendar/styles.module.css | 4 ++ .../DailyJournal/AvailabilityDialog/index.tsx | 54 +++++++++---------- src/views/DailyJournal/DayView/index.tsx | 39 ++++++++++++++ .../DailyJournal/DayView/styles.module.css | 8 +++ src/views/DailyJournal/index.tsx | 2 +- src/views/DailyStandup/StartSection/index.tsx | 50 +++++++++++++++++ 7 files changed, 140 insertions(+), 32 deletions(-) diff --git a/src/components/MonthlyCalendar/index.tsx b/src/components/MonthlyCalendar/index.tsx index 1bef486..ce56274 100644 --- a/src/components/MonthlyCalendar/index.tsx +++ b/src/components/MonthlyCalendar/index.tsx @@ -19,6 +19,14 @@ import DateContext from '#contexts/date'; import styles from './styles.module.css'; +const dateFormatter = new Intl.DateTimeFormat( + [], + { + year: 'numeric', + month: 'short', + }, +); + const weekDaysName = [ 'Su', 'Mo', @@ -129,6 +137,8 @@ function MonthlyCalendar(props: Props) { return days; }, [year, month]); + const formattedDate = dateFormatter.format(new Date(year, month, 1)); + return (
@@ -150,10 +160,9 @@ function MonthlyCalendar(props: Props) { > +
- {year} - / - {String(month + 1).padStart(2, '0')} + {formattedDate}
diff --git a/src/components/MonthlyCalendar/styles.module.css b/src/components/MonthlyCalendar/styles.module.css index e30eefe..1ee0139 100644 --- a/src/components/MonthlyCalendar/styles.module.css +++ b/src/components/MonthlyCalendar/styles.module.css @@ -8,6 +8,10 @@ gap: var(--spacing-sm); align-items: baseline; font-size: var(--font-size-sm); + + .spacer { + flex-grow: 1; + } } .monthly-calendar { diff --git a/src/views/DailyJournal/AvailabilityDialog/index.tsx b/src/views/DailyJournal/AvailabilityDialog/index.tsx index 60413d6..c464464 100644 --- a/src/views/DailyJournal/AvailabilityDialog/index.tsx +++ b/src/views/DailyJournal/AvailabilityDialog/index.tsx @@ -188,7 +188,8 @@ function AvailabilityDialog(props: Props) { return key === 'FIRST_HALF'; } if (dialogState.wfhType === 'FULL') { - return false; + // NOTE: So that we can see all options + return true; } return true; }, @@ -204,7 +205,8 @@ function AvailabilityDialog(props: Props) { return key === 'FIRST_HALF'; } if (dialogState.leaveType === 'FULL') { - return false; + // NOTE: So that we can see all options + return true; } return true; }, @@ -221,32 +223,28 @@ function AvailabilityDialog(props: Props) { contentClassName={styles.modalContent} className={styles.availabilityDialog} > - {dialogState.wfhType !== 'FULL' && ( - - )} - {dialogState.leaveType !== 'FULL' && ( - - )} + +
- {!isTruthyString(dateFromParams) && ( + {selectedDate !== fullDate && ( { + const date = new Date(); + return formatTime(date); + }); + useEffect( + () => { + const timeout = window.setInterval( + () => { + const date = new Date(); + const dateAsString = formatTime(date); + setDateStr(dateAsString); + }, + 500, + ); + return () => { + window.clearInterval(timeout); + }; + }, + [], + ); + return ( +
+ {dateStr} +
+ ); +} + interface Props { date: string; }