modified: app.py

modified:   templates/admin_giveaways.html
	modified:   templates/redeem_giveaway.html
	modified:   templates/user_giveaways.html
This commit is contained in:
SimolZimol
2024-09-12 16:09:57 +02:00
parent 0ac3dc09aa
commit bea9a109e1
4 changed files with 132 additions and 181 deletions

View File

@@ -4,8 +4,14 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Manage Giveaways</title>
<title>Admin - Giveaways</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<style>
th a {
color: inherit;
text-decoration: none;
}
</style>
</head>
<body>
@@ -25,15 +31,12 @@
<div class="container mt-5">
<h1 class="text-center">Giveaways Management</h1>
<p class="text-center">Manage all active and inactive giveaways in the system.</p>
<table class="table table-striped mt-4">
<thead>
<table class="table table-bordered table-hover mt-4">
<thead class="thead-dark">
<tr>
<th>ID</th>
<th>Platform</th>
<th>Name</th>
<th>UUID</th>
<th><a href="{{ url_for('admin_giveaways', sort='id', order='asc' if sort_field == 'id' and order == 'desc' else 'desc') }}">ID</a></th>
<th><a href="{{ url_for('admin_giveaways', sort='platform', order='asc' if sort_field == 'platform' and order == 'desc' else 'desc') }}">Platform</a></th>
<th><a href="{{ url_for('admin_giveaways', sort='name', order='asc' if sort_field == 'name' and order == 'desc' else 'desc') }}">Name</a></th>
<th>Game Key</th>
<th>Winner Discord ID</th>
<th>Active</th>
@@ -46,26 +49,26 @@
<td>{{ giveaway.id }}</td>
<td>{{ giveaway.platform }}</td>
<td>{{ giveaway.name }}</td>
<td>{{ giveaway.uuid }}</td>
<td>{{ giveaway.game_key }}</td>
<td>{{ giveaway.winner_dc_id }}</td>
<td>{{ 'Yes' if giveaway.aktiv else 'No' }}</td>
<td>{{ giveaway.winner_dc_id or 'Not Assigned' }}</td>
<td>
<a href="{{ url_for('edit_giveaway', id=giveaway.id) }}" class="btn btn-sm btn-primary">Edit</a>
<form method="POST" action="{{ url_for('delete_giveaway', id=giveaway.id) }}" style="display: inline;">
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
</form>
<form method="POST" action="{{ url_for('toggle_active', id=giveaway.id) }}" style="display: inline;">
<button type="submit" class="btn btn-sm {{ 'btn-success' if not giveaway.aktiv else 'btn-warning' }}">
{{ 'Activate' if not giveaway.aktiv else 'Deactivate' }}
</button>
</form>
{% if giveaway.aktiv %}
<span class="badge badge-success">Active</span>
{% else %}
<span class="badge badge-danger">Inactive</span>
{% endif %}
</td>
<td>
<a href="{{ url_for('edit_giveaway', giveaway_id=giveaway.id) }}" class="btn btn-primary btn-sm">Edit</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@@ -6,37 +6,57 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Redeem Giveaway</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<style>
.redeem-card {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
padding: 20px;
border-radius: 10px;
background-color: #f8f9fa;
}
.claim-btn {
background-color: #28a745;
color: white;
}
.claim-btn:hover {
background-color: #218838;
}
.key-display {
font-size: 1.5rem;
color: #007bff;
}
</style>
</head>
<body>
<div class="container mt-5">
<h1 class="text-center">Giveaway Prize</h1>
<p class="text-center">Congratulations! You have won the giveaway for <strong>{{ giveaway.name }}</strong> on
<strong>{{ giveaway.platform }}</strong>.</p>
<p class="text-center text-muted">Congratulations! You've won <strong>{{ giveaway.name }}</strong> on <strong>{{ giveaway.platform }}</strong>.</p>
{% if key %}
<!-- Wenn der Key aufgedeckt wurde -->
<div class="card mt-4">
<div class="card-body">
<h5 class="card-title">Your Key</h5>
<p class="card-text">{{ key }}</p>
<div class="redeem-card mx-auto">
{% if key %}
<!-- Wenn der Key aufgedeckt wurde -->
<h5 class="text-center">Your Game Key</h5>
<p class="text-center key-display">{{ key }}</p>
<div class="text-center">
<a href="{{ url_for('user_giveaways') }}" class="btn btn-primary mt-4">Back to Giveaways</a>
</div>
</div>
<a href="{{ url_for('user_giveaways') }}" class="btn btn-primary mt-4">Back to Giveaways</a>
{% else %}
<!-- Wenn der Key noch nicht aufgedeckt wurde -->
<div class="card mt-4">
<div class="card-body">
<h5 class="card-title">Claim Your Key</h5>
<p class="card-text">Do you want to reveal your game key? Once revealed, it will be marked as claimed and cannot be undone.</p>
{% else %}
<!-- Wenn der Key noch nicht aufgedeckt wurde -->
<h5 class="text-center">Claim Your Key</h5>
<p class="text-center">Do you want to reveal your game key? Once revealed, it will be marked as claimed and cannot be undone.</p>
<div class="text-center">
<form method="POST">
<button type="submit" class="btn btn-success">Reveal Key</button>
<button type="submit" class="btn claim-btn">Reveal Key</button>
</form>
</div>
<div class="text-center mt-3">
<a href="{{ url_for('user_giveaways') }}" class="btn btn-secondary">Back to Giveaways</a>
</div>
{% endif %}
</div>
<a href="{{ url_for('user_giveaways') }}" class="btn btn-secondary mt-4">Back to Giveaways</a>
{% endif %}
</div>
</body>

View File

@@ -6,29 +6,50 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Giveaways</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<style>
.giveaway-card {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: transform 0.2s;
}
.giveaway-card:hover {
transform: scale(1.05);
}
.no-giveaway {
background-color: #f8f9fa;
padding: 40px;
border-radius: 10px;
text-align: center;
}
</style>
</head>
<body>
<div class="container mt-5">
<h1 class="text-center">Your Giveaways</h1>
<p class="text-center">Here you can view the giveaways you've won.</p>
<p class="text-center text-muted">Here are the giveaways you've won. Click "Claim Your Key" to receive your prize.</p>
<div class="row mt-4">
{% if giveaways %}
{% for giveaway in giveaways %}
<div class="col-md-4">
<div class="card">
<div class="card-body">
<div class="card giveaway-card mb-4">
<div class="card-body text-center">
<h5 class="card-title">{{ giveaway.name }}</h5>
<p class="card-text">Platform: {{ giveaway.platform }}</p>
<a href="{{ url_for('redeem_giveaway', uuid=giveaway.uuid) }}" class="btn btn-primary">Claim Your
Key</a>
<a href="{{ url_for('redeem_giveaway', uuid=giveaway.uuid) }}" class="btn btn-primary">Claim Your Key</a>
</div>
</div>
</div>
{% endfor %}
{% else %}
<p class="text-center">You haven't won any giveaways yet.</p>
<div class="col-12">
<div class="no-giveaway">
<h3>No Giveaways Won</h3>
<p>It looks like you haven't won any giveaways yet. Keep participating and good luck!</p>
</div>
</div>
{% endif %}
</div>
</div>