diff --git a/pages/calendar/calendar.go b/pages/calendar/calendar.go index aedca801..2897750b 100644 --- a/pages/calendar/calendar.go +++ b/pages/calendar/calendar.go @@ -39,8 +39,13 @@ func Get(ctx *aero.Context) string { for i := 0; i < 7; i++ { days[i] = &utils.CalendarDay{ Name: weekdayNames[(weekdayIndex+i)%7], + Class: "weekday", Entries: []*utils.CalendarEntry{}, } + + if days[i].Name == "Saturday" || days[i].Name == "Sunday" { + days[i].Class += " weekend" + } } // Add anime episodes to the days @@ -66,14 +71,14 @@ func Get(ctx *aero.Context) string { entry := &utils.CalendarEntry{ Anime: animeEpisodes.Anime(), Episode: episode, - Class: "calendar-entry mountable", + Added: false, } if user != nil { animeListItem := user.AnimeList().Find(entry.Anime.ID) if animeListItem != nil && (animeListItem.Status == arn.AnimeListStatusWatching || animeListItem.Status == arn.AnimeListStatusPlanned) { - entry.Class += " calendar-entry-personal" + entry.Added = true } } diff --git a/pages/calendar/calendar.pixy b/pages/calendar/calendar.pixy index 3d81a0e2..d181e387 100644 --- a/pages/calendar/calendar.pixy +++ b/pages/calendar/calendar.pixy @@ -1,13 +1,17 @@ component Calendar(days []*utils.CalendarDay, user *arn.User) h1.mountable Calendar + .corner-buttons-hide-on-mobile + button.action(data-trigger="click", data-action="calendarShowAddedAnimeOnly", title="Show anime in my collection") + RawIcon("eye") + .week each day in days - .weekday + div(class=day.Class) h3.weekday-name.mountable(data-mountable-type=day.Name)= day.Name .calendar-entries each entry in day.Entries - div(data-mountable-type=day.Name, class=entry.Class) + .calendar-entry.mountable(data-mountable-type=day.Name, data-added=entry.Added) a.ajax(href=entry.Anime.Link()) img.calendar-entry-image.lazy(data-src=entry.Anime.Image("large"), data-webp="true", alt=entry.Anime.Title.ByUser(user)) a.ajax(href=entry.Anime.Link()) diff --git a/pages/calendar/calendar.scarlet b/pages/calendar/calendar.scarlet index 773b4475..cd9d15c5 100644 --- a/pages/calendar/calendar.scarlet +++ b/pages/calendar/calendar.scarlet @@ -14,6 +14,10 @@ text-align center margin-bottom 1rem +.weekend + .weekday-name + font-weight bold + .calendar-entries vertical @@ -28,7 +32,7 @@ height 4rem object-fit cover -.calendar-entry-personal +.calendar-entry[data-added="true"] border 2px solid main-color :hover diff --git a/scripts/Actions/Explore.ts b/scripts/Actions/Explore.ts index 79045c98..80f13966 100644 --- a/scripts/Actions/Explore.ts +++ b/scripts/Actions/Explore.ts @@ -17,4 +17,13 @@ export function hideAddedAnime() { anime.classList.toggle("anime-grid-cell-hide") } } +} + +// Hides anime that are not in your list. +export function calendarShowAddedAnimeOnly() { + for(let anime of findAll("calendar-entry")) { + if(anime.dataset.added === "false") { + anime.classList.toggle("hidden") + } + } } \ No newline at end of file diff --git a/utils/Calendar.go b/utils/Calendar.go index 6817c5ad..4a026711 100644 --- a/utils/Calendar.go +++ b/utils/Calendar.go @@ -5,6 +5,7 @@ import "github.com/animenotifier/arn" // CalendarDay is a calendar day. type CalendarDay struct { Name string + Class string Entries []*CalendarEntry } @@ -12,5 +13,5 @@ type CalendarDay struct { type CalendarEntry struct { Anime *arn.Anime Episode *arn.AnimeEpisode - Class string + Added bool }