Skip to content

Commit

Permalink
imp - Only show dates with events and reminders
Browse files Browse the repository at this point in the history
---

We've improved the calendar TUI by reducing clutter. That is, we don't need to show dates in the main infobox that don't contain any event or reminder.

---

Type: imp
Breaking: False
Doc Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Feb 26, 2024
1 parent d8185a3 commit de38fc0
Showing 1 changed file with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,11 @@ private static void RenderCalendar((int Year, int Month, int Day, CalendarTypes
// Populate some variables
var CurrentDate = new DateTime(year, month, CurrentDay);
int CurrentWeekIndex = CurrentWeek - 1;
builder.Append(
TextWriterWhereColor.RenderWhere($"{month}/{CurrentDay}/{year}", eventEntryLeft, eventEntryTop, boxForeground, background)
);
eventEntryLeft += 2;
eventEntryTop++;
// Some flags
bool ReminderMarked = false;
bool EventMarked = false;
bool dayMarked = false;
bool IsWeekend = CurrentDate.DayOfWeek == DayOfWeek.Friday || CurrentDate.DayOfWeek == DayOfWeek.Saturday;
bool IsToday = CurrentDate == new DateTime(state.Year, state.Month, state.Day);
var foreground =
Expand All @@ -352,6 +348,17 @@ private static void RenderCalendar((int Year, int Month, int Day, CalendarTypes
eventEntryTop++;
if (eventEntryTop - 1 > eventBoxHeight + eventBoxTop)
break;
if (!dayMarked)
{
dayMarked = true;
builder.Append(
TextWriterWhereColor.RenderWhere($"{month}/{CurrentDay}/{year}", eventEntryLeft, eventEntryTop - 1, boxForeground, background)
);
eventEntryLeft += 2;
eventEntryTop++;
if (eventEntryTop - 1 > eventBoxHeight + eventBoxTop)
break;
}
builder.Append(
TextWriterWhereColor.RenderWhere(Reminder.ReminderTitle.Truncate(eventBoxWidth - 5), eventEntryLeft, eventEntryTop - 1, boxForeground, background)
);
Expand All @@ -377,6 +384,17 @@ private static void RenderCalendar((int Year, int Month, int Day, CalendarTypes
eventEntryTop++;
if (eventEntryTop - 1 > eventBoxHeight + eventBoxTop)
break;
if (!dayMarked)
{
dayMarked = true;
builder.Append(
TextWriterWhereColor.RenderWhere($"{month}/{CurrentDay}/{year}", eventEntryLeft, eventEntryTop - 1, boxForeground, background)
);
eventEntryLeft += 2;
eventEntryTop++;
if (eventEntryTop - 1 > eventBoxHeight + eventBoxTop)
break;
}
builder.Append(
TextWriterWhereColor.RenderWhere(EventInstance.EventTitle.Truncate(eventBoxWidth - 5), eventEntryLeft, eventEntryTop - 1, boxForeground, background)
);
Expand Down

0 comments on commit de38fc0

Please sign in to comment.