Highlight own entries
This commit is contained in:
parent
9a9e97f244
commit
924f21b48f
@ -53,13 +53,27 @@ func Get(ctx *aero.Context) string {
|
||||
airingDate, _ := time.Parse(time.RFC3339, episode.AiringDate.Start)
|
||||
since := airingDate.Sub(now)
|
||||
|
||||
if since >= 0 && since < oneWeek {
|
||||
if since < 0 || since >= oneWeek {
|
||||
continue
|
||||
}
|
||||
|
||||
dayIndex := int(since / (24 * time.Hour))
|
||||
days[dayIndex].Entries = append(days[dayIndex].Entries, &utils.CalendarEntry{
|
||||
|
||||
entry := &utils.CalendarEntry{
|
||||
Anime: animeEpisodes.Anime(),
|
||||
Episode: episode,
|
||||
})
|
||||
Class: "calendar-entry mountable",
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
days[dayIndex].Entries = append(days[dayIndex].Entries, entry)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ component Calendar(days []*utils.CalendarDay, user *arn.User)
|
||||
h3.weekday-name.mountable(data-mountable-type=day.Name)= day.Name
|
||||
.calendar-entries
|
||||
each entry in day.Entries
|
||||
.calendar-entry.mountable(data-mountable-type=day.Name)
|
||||
div(data-mountable-type=day.Name, class=entry.Class)
|
||||
a.ajax(href=entry.Anime.Link())
|
||||
.calendar-entry-title= entry.Anime.Title.ByUser(user)
|
||||
.calendar-entry-info
|
||||
|
@ -23,6 +23,9 @@
|
||||
margin-bottom 0.5rem
|
||||
overflow hidden
|
||||
|
||||
.calendar-entry-personal
|
||||
border 2px solid main-color
|
||||
|
||||
.calendar-entry-info
|
||||
horizontal
|
||||
|
||||
|
@ -12,4 +12,5 @@ type CalendarDay struct {
|
||||
type CalendarEntry struct {
|
||||
Anime *arn.Anime
|
||||
Episode *arn.AnimeEpisode
|
||||
Class string
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user