Skip to content

Commit

Permalink
feat: distinguish weekends
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-lednev committed Oct 15, 2024
1 parent 8a0a8ef commit 0914c0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ui/components/week/week.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { getVisibleHours } from "../../../global-store/derived-settings";
import { settings } from "../../../global-store/settings";
import type { ObsidianContext } from "../../../types";
import { isOnWeekend } from "../../../util/moment";
import ControlButton from "../control-button.svelte";
import ResizeHandle from "../resize-handle.svelte";
import ResizeableBox from "../resizeable-box.svelte";
Expand Down Expand Up @@ -64,7 +65,7 @@
visibleHours={getVisibleHours($settings)}
/>
{#each $dateRange as day}
<div class="day-column">
<div class="day-column" class:weekend={isOnWeekend(day)}>
<Timeline {day} isUnderCursor={true} />
</div>
{/each}
Expand Down Expand Up @@ -136,4 +137,8 @@
color: white;
background-color: var(--color-accent);
}
.weekend {
background-color: var(--background-primary);
}
</style>
4 changes: 4 additions & 0 deletions src/util/moment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,7 @@ export function getEarliestMoment(moments: Moment[]) {
return result;
});
}

export function isOnWeekend(day: Moment) {
return day.isoWeekday() === 6 || day.isoWeekday() === 7;
}

0 comments on commit 0914c0b

Please sign in to comment.