Added "new" indicator to sidebar

Update sidebar.yml, commons.yml, and 4 more files...
This commit is contained in:
2024-10-20 22:56:42 +02:00
parent 74e3ab2948
commit 124dc1042f
6 changed files with 24 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
from dataclasses import dataclass, field
from datetime import datetime, timezone
from typing import Optional
import yaml
@@ -9,9 +10,13 @@ class SidebarEntry:
title_key: str
icon: str
active_id: str
has_new_until_utc: int
abs_href: Optional[str] = field(default=None)
raw_href: Optional[str] = field(default=None)
def has_new(self) -> bool:
return datetime.fromtimestamp(self.has_new_until_utc, tz=timezone.utc) > datetime.now(timezone.utc)
__SIDEBAR_ENTRIES: list[Optional[SidebarEntry]] = list()