From b59bee07b76104e598018ab7d5a9703328da63c3 Mon Sep 17 00:00:00 2001 From: hex Date: Mon, 19 May 2025 21:09:50 -0700 Subject: [PATCH] game shelf rather than cards --- app/routes.py | 100 ++----------------------------- app/static/css/styles.css | 53 ++++++++++------- app/templates/base.html | 8 +-- app/templates/index.html | 122 ++++++-------------------------------- 4 files changed, 58 insertions(+), 225 deletions(-) diff --git a/app/routes.py b/app/routes.py index 1316520..dc7ba50 100644 --- a/app/routes.py +++ b/app/routes.py @@ -24,105 +24,13 @@ def index(): games = Game.query.all() return render_template('index.html', games=games) -@main_bp.route('/search', methods=['GET', 'POST']) -def search_games(): - """Search for games using IGDB API""" - results = [] - query = '' - - if request.method == 'POST': - query = request.form.get('query', '') - - if query: - try: - results = igdb.search_games(query) - except Exception as e: - flash(f"Oopsie! Couldn't search IGDB: {str(e)}", 'error') - - return render_template('search.html', results=results, query=query) +# Search functionality moved to admin area only -@main_bp.route('/add_game/', methods=['GET', 'POST']) -def add_game(igdb_id): - """Add a game to tracking list""" - # Check if we already have this game - existing_game = Game.query.filter_by(igdb_id=igdb_id).first() - - if existing_game: - flash(f"You'we alweady twacking {existing_game.name}!", 'info') - return redirect(url_for('main.index')) - - # Check if we're at the 5 game limit - if Game.query.count() >= 5: - flash("You can onwy twack up to 5 games at once! Pwease wemove a game fiwst~", 'error') - return redirect(url_for('main.index')) - - # Get game details from IGDB - try: - game_data = igdb.get_game_by_id(igdb_id) - - # Create new Game object - new_game = Game( - igdb_id=game_data['id'], - name=game_data['name'], - cover_url=game_data['cover_url'], - description=game_data['description'], - release_date=game_data['release_date'], - platform=', '.join(game_data['platforms']) if game_data['platforms'] else None, - developer=game_data['developer'], - publisher=game_data['publisher'], - status="Playing", - progress=0 - ) - - db.session.add(new_game) - db.session.commit() - - flash(f"Added {new_game.name} to youw twacking wist! ^w^", 'success') - return redirect(url_for('main.index')) - - except Exception as e: - flash(f"Faiwed to add game: {str(e)}", 'error') - return redirect(url_for('main.search_games')) +# Add game functionality moved to admin area only -@main_bp.route('/update_game/', methods=['POST']) -def update_game(game_id): - """Update game progress and status""" - game = Game.query.get_or_404(game_id) - - if request.method == 'POST': - # Update status if provided - if 'status' in request.form: - game.status = request.form['status'] - - # Update progress if provided - if 'progress' in request.form: - try: - progress = int(request.form['progress']) - if 0 <= progress <= 100: - game.progress = progress - except ValueError: - flash("Pwogwess must be a numbew between 0 and 100!", 'error') - - # Update notes if provided - if 'notes' in request.form: - game.notes = request.form['notes'] - - db.session.commit() - flash(f"Updated {game.name}! (。・ω・。)", 'success') - - return redirect(url_for('main.index')) +# Update game functionality moved to admin area only -@main_bp.route('/remove_game/', methods=['POST']) -def remove_game(game_id): - """Remove a game from tracking list""" - game = Game.query.get_or_404(game_id) - name = game.name - - db.session.delete(game) - db.session.commit() - - flash(f"Removed {name} from tracking list!", 'success') - return redirect(url_for('main.index')) +# Remove game functionality moved to admin area only # Admin Routes @main_bp.route('/admin/login', methods=['GET', 'POST']) diff --git a/app/static/css/styles.css b/app/static/css/styles.css index 275602d..945843d 100644 --- a/app/static/css/styles.css +++ b/app/static/css/styles.css @@ -1,8 +1,8 @@ :root { --primary-color: #3a0570; --primary-light: #6a35a0; - --primary-dark: #260050; - --accent-color: #9c27b0; + --primary-dark: #333333; + --accent-color: #b344c7; --text-light: #f0f0f0; --text-dark: #121212; --bg-dark: #121212; @@ -11,7 +11,7 @@ --border-color: #333333; --danger-color: #f44336; --success-color: #4caf50; - --info-color: #2196f3; + --info-color: #a621f3; --warning-color: #ff9800; } @@ -22,7 +22,7 @@ } body { - font-family: 'Nunito', sans-serif; + font-family: monospace; background-color: var(--bg-dark); color: var(--text-light); line-height: 1.6; @@ -152,11 +152,11 @@ footer .heart { /* Page header */ .page-header { margin-bottom: 2rem; + margin-top: 2rem; text-align: center; } .page-header h1 { - color: var(--accent-color); font-size: 2.2rem; margin-bottom: 0.2rem; } @@ -222,9 +222,9 @@ footer .heart { } /* Game cards */ -.game-cards { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); +.game-list { + display: flex; + flex-direction: column; gap: 1.5rem; margin-bottom: 2rem; } @@ -239,40 +239,49 @@ footer .heart { } .game-card:hover { - transform: translateY(-5px); + transform: translateY(-3px); box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3); background-color: var(--bg-card-hover); } -.game-cover { - height: 200px; - overflow: hidden; +/* Horizontal card layout */ +.game-card.horizontal { + display: flex; + align-items: stretch; +} + +.game-cover-side { + width: 120px; + min-width: 120px; position: relative; + display: flex; + align-items: center; + justify-content: center; + overflow: hidden; + margin: 1rem; } -.game-cover img { +.game-cover-side img { width: 100%; - height: 100%; + height: auto; object-fit: cover; - transition: transform 0.5s; + display: block; + border-radius: 8px; } -.game-card:hover .game-cover img { - transform: scale(1.1); -} - -.no-cover { +.no-cover-medium { + width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; - font-size: 4rem; - background: linear-gradient(45deg, var(--primary-dark), var(--primary-light)); + font-size: 2.5rem; color: rgba(255, 255, 255, 0.5); } .game-info { padding: 1.2rem; + flex: 1; } .game-info h2 { diff --git a/app/templates/base.html b/app/templates/base.html index 1225faf..c7f6967 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -3,7 +3,7 @@ - {% block title %}Game Twacker{% endblock %} + {% block title %}Game Tracker{% endblock %} @@ -11,11 +11,11 @@
-

Game Twacker

+

Game Tracker

diff --git a/app/templates/index.html b/app/templates/index.html index 42c512e..514722f 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -1,28 +1,29 @@ {% extends 'base.html' %} -{% block title %}My Games ~ Game Twacker{% endblock %} +{% block title %}What am I playing? ~ Game Tracker{% endblock %} {% block content %} {% if games %} -
+
{% for game in games %} -
-
+
+
{% if game.cover_url %} {{ game.name }} cover {% else %} -
+
{% endif %}

{{ game.name }}

+
{% if game.developer %} {{ game.developer }} @@ -31,61 +32,22 @@ {{ game.platform }} {% endif %}
+
- {{ game.status }} + {{ game.status }} {{ game.progress }}%
-
+
-
- Update Pwogwess -
-
- - -
- -
- - - {{ game.progress }}% -
- -
- - -
- -
- - -
-
-
-
- - - {% endfor %} @@ -96,58 +58,12 @@
-

No games being twacked yet~ >w<

-

Click the button bewow to seawch and add games to twack!

- - Add Youw Fiwst Game - +

No games being tracked yet

+

Ask an administrator to add games to your tracking list

{% endif %} -{% if games|length < 5 %} - -{% endif %} - + + {% endblock %}