feat(ui): show country flag emoji next to country codes
This commit is contained in:
@@ -23,6 +23,15 @@ router = APIRouter(tags=["web"])
|
||||
templates = Jinja2Templates(directory=str(Path(__file__).resolve().parent.parent / "templates"))
|
||||
|
||||
|
||||
def _country_flag(code: str) -> str:
|
||||
if not code or len(code) != 2:
|
||||
return code or ""
|
||||
return chr(0x1F1E6 + ord(code[0].upper()) - ord("A")) + chr(0x1F1E6 + ord(code[1].upper()) - ord("A"))
|
||||
|
||||
|
||||
templates.env.filters["flag"] = _country_flag
|
||||
|
||||
|
||||
def _redirect(url: str) -> RedirectResponse:
|
||||
return RedirectResponse(url, status_code=303)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user