implement platform icons
All checks were successful
Django CI/CD / test (push) Successful in 1m1s
Django CI/CD / build-and-push (push) Has been skipped

This commit is contained in:
2024-09-14 06:42:34 +02:00
parent 698c8966c0
commit 649351efde
20 changed files with 125 additions and 8 deletions

View File

@ -204,7 +204,7 @@ def view_game(request: HttpRequest, game_id: int) -> HttpResponse:
"rows": [
[
edition.name,
edition.platform,
Icon(str(edition.platform).lower().replace(".", "")),
edition.year_released,
render_to_string(
"cotton/button_group.html",

View File

@ -13,7 +13,7 @@ from django.template.loader import render_to_string
from django.urls import reverse
from django.utils import timezone
from common.components import A, Button, Icon
from common.components import A, Button, Div, Icon
from common.time import dateformat
from common.utils import truncate_with_popover
from games.forms import PurchaseForm
@ -48,7 +48,6 @@ def list_purchases(request: HttpRequest) -> HttpResponse:
"columns": [
"Name",
"Type",
"Platform",
"Price",
"Currency",
"Infinite",
@ -71,14 +70,27 @@ def list_purchases(request: HttpRequest) -> HttpResponse:
),
),
],
truncate_with_popover(
purchase.edition.game.name
if purchase.type == "game"
else f"{purchase.edition.game.name} ({purchase.name})"
Div(
attributes=[("class", "inline-flex gap-2 items-center")],
children=[
Icon(
str(purchase.platform)
.lower()
.translate(
str(purchase.platform)
.lower()
.maketrans("", "", ". /()")
)
),
truncate_with_popover(
purchase.edition.game.name
if purchase.type == "game"
else f"{purchase.edition.game.name} ({purchase.name})"
),
],
),
),
purchase.get_type_display(),
purchase.platform,
purchase.price,
purchase.price_currency,
purchase.infinite,