diff --git a/blueprints/risdeveau/__init__.py b/blueprints/risdeveau/__init__.py index 3b24234..e75621f 100644 --- a/blueprints/risdeveau/__init__.py +++ b/blueprints/risdeveau/__init__.py @@ -48,7 +48,8 @@ def render_tmpl(filename: str, **kwargs) -> str: template_path = os.path.join("risdeveau/templates", filename) return minify( render_template(template_path, **kwargs), - remove_empty_space=True + remove_empty_space=True, + remove_all_empty_space=True ) @bp.route("/static/") diff --git a/blueprints/risdeveau/modules/api/steam.py b/blueprints/risdeveau/modules/api/steam.py index 5061d33..d36439a 100644 --- a/blueprints/risdeveau/modules/api/steam.py +++ b/blueprints/risdeveau/modules/api/steam.py @@ -34,12 +34,13 @@ data = { def modify_game_list(json: dict) -> dict: if 'games' in json.keys(): apps = (3301060, 404790, 1281930, 1920960, 1325960, 431960) - new_games = [] + new_games = {} for i, g in enumerate(json['games']): if g['appid'] not in apps: json['games'][i]['h_cover'] = f"https://shared.fastly.steamstatic.com/store_item_assets//steam/apps/{g['appid']}/header.jpg" json['games'][i]['v_cover'] = f"https://shared.fastly.steamstatic.com/store_item_assets//steam/apps/{g['appid']}/library_600x900.jpg" - new_games.append(json['games'][i]) + + new_games[g['appid']] = json['games'][i] json['games'] = new_games return json diff --git a/blueprints/risdeveau/static/style/risdeveau.scss b/blueprints/risdeveau/static/style/risdeveau.scss index 73d6673..83c28a3 100644 --- a/blueprints/risdeveau/static/style/risdeveau.scss +++ b/blueprints/risdeveau/static/style/risdeveau.scss @@ -51,7 +51,27 @@ h3 { .steam { .block { - display: flex; + &:not(.popup) { + display: flex; + position: relative; + z-index: 1; + } + + &.popup { + margin-top: -.5rem; + padding-top: 1rem; + background-color: theme.$mantle; + transition: all ease-out 300ms; + + &.enter {} + + &.off { + margin-bottom: -.5rem; + padding: 0 .5rem; + opacity: 0; + transform: translateY(-100%); + } + } img { height: 7rem; diff --git a/blueprints/risdeveau/templates/steam.htm b/blueprints/risdeveau/templates/steam.htm index 2ed1331..b235d8a 100644 --- a/blueprints/risdeveau/templates/steam.htm +++ b/blueprints/risdeveau/templates/steam.htm @@ -1,3 +1,7 @@ +{% if request.headers.get('hx-request') != "true" %} +
+{% endif %} +

Steam

+ {{ steam.caches.recent.status }} + {{ steam.caches.owned.status }} {% if steam.caches.recent.data.games %}

Recently played:

- {% for g in steam.caches.recent.data.games %} - + {% for g in steam.caches.recent.data.games.values() %} + {% endfor %}

Top played games: - {% set owned_games = steam.caches.owned.data.games | sort(attribute="playtime_forever", reverse=true) %} + {% set owned_games = steam.caches.owned.data.games.values() | sort(attribute="playtime_forever", reverse=true) %} {% for g in owned_games[:5] %} - +

- +
+ {% endfor %}

{% endif %} +
+ +{% if request.headers.get('hx-request') != "true" %} + +{% endif %} diff --git a/blueprints/root/static/style/tw.scss b/blueprints/root/static/style/tw.scss index 0fbb9f3..cb75e8f 100644 --- a/blueprints/root/static/style/tw.scss +++ b/blueprints/root/static/style/tw.scss @@ -1,5 +1,11 @@ @use "catppuccin" as theme; +.m { + &t { + &-1 { margin-top: .5rem; } + } +} + .t { &-red { color: theme.$red; } &-orange { color: theme.$peach; }