Skip to content

Add events#26

Draft
frozenhelium wants to merge 1 commit intoproject/better-journalingfrom
feat/show-events
Draft

Add events#26
frozenhelium wants to merge 1 commit intoproject/better-journalingfrom
feat/show-events

Conversation

@frozenhelium
Copy link
Copy Markdown
Member

@frozenhelium frozenhelium commented Apr 16, 2026

@frozenhelium frozenhelium force-pushed the feat/show-events branch 6 times, most recently from b0519ff to b07d421 Compare April 16, 2026 07:09
Comment thread src/index.tsx
showDialog
>
<App />
<GoogleOAuthProvider clientId={import.meta.env.APP_GOOGLE_OAUTH_CLIENT_ID ?? ''}>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not define the Provider in src/App/index.tsx?

Day View
</h4>
<Checkbox
name="showEvents"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name="showEvents"
name="eventsEnabled"

Comment on lines -228 to -239
useEffect(
() => {
if (calendarRef.current && selectedDate) {
const selectedDateObj = new Date(selectedDate);
calendarRef.current.resetView(
selectedDateObj.getFullYear(),
selectedDateObj.getMonth(),
);
}
},
[selectedDate],
);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove calendarRef reset logic?

Comment thread src/utils/types.ts
Comment on lines +54 to +55
showEvents: boolean,
googleCalendarEnabled: boolean,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
showEvents: boolean,
googleCalendarEnabled: boolean,
eventsShown: boolean,
googleCalendarEventsShown: boolean,

Comment on lines +152 to +154
useEffect(() => {
onMonthChange?.(year, month);
}, [onMonthChange, year, month]);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just use if else

Comment on lines +200 to +226
const dateInfoMap = useMemo(() => {
const map = new Map<string, DateInfo>();

calendarDataResult.data?.private.hoursPerDay.forEach((entry) => {
const dateStr = String(entry.date);
map.set(dateStr, {
totalMinutes: entry.totalMinutes,
targetMinutes: entry.targetMinutes,
isHoliday: entry.isHoliday,
leaveType: entry.leaveType,
wfhType: entry.wfhType,
hasEvent: false,
});
});

calendarDataResult.data?.private.allProjects.forEach((project) => {
project.deadlines.forEach((deadline) => {
const dateStr = String(deadline.endDate);
const existing = map.get(dateStr) ?? {};
map.set(dateStr, { ...existing, hasEvent: true });
});
});

calendarDataResult.data?.private.events.items.forEach((event) => {
if (event.dates.length > 0) {
event.dates.forEach((d) => {
const dateStr = String(d);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use listToMap function instead.

const isPast = date <= fullDate;
const targetMinutes = info?.targetMinutes ?? 0;
const totalMinutes = info?.totalMinutes ?? 0;
const fillPct = isPast && targetMinutes > 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does Pct mean?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants