1
0
forked from orson/bachemap

added leaderboard page, improved dashboard, centered QR invite

This commit is contained in:
Orson 2024-09-12 14:35:52 -06:00
parent de826cd658
commit 7546b78610
4 changed files with 50 additions and 23 deletions

13
app.py
View File

@ -246,8 +246,8 @@ def create_app(config=Config):
{ {
"$lookup": { "$lookup": {
"from": "users", "from": "users",
"localField": "_id", "localField": "added_by",
"foreignField": "_id", "foreignField": "added_by",
"as": "user_info" "as": "user_info"
} }
}, },
@ -263,14 +263,17 @@ def create_app(config=Config):
} }
} }
]) ])
print(leaders) #print(list(leaders))
for leader in leaders: cleaned_leaders=list()
for leader in list(leaders):
leader["username"] = leader["username"][0]+"***"+leader["username"][-1] leader["username"] = leader["username"][0]+"***"+leader["username"][-1]
cleaned_leaders.append(leader)
if current_user.is_authenticated: if current_user.is_authenticated:
username = user.username username = user.username
else: else:
username = None username = None
return render_template('leaderboard.html', leaders=leaders, username=username)
return render_template('leaderboard.html', leaders=cleaned_leaders, username=username)
return app return app

View File

@ -44,6 +44,14 @@ div.leaflet-popup-content {
} }
div#qrgen img {
padding-left: 0;
padding-right: 0;
margin-left: auto;
margin-right: auto;
display: block;
}
section#pinner-modal { section#pinner-modal {
position: absolute; position: absolute;
top: 7vh; top: 7vh;

View File

@ -9,22 +9,25 @@
</style> </style>
<div style="padding-top: 30px;"> <div style="padding-top: 30px;">
<h3>Hola <span style="color: darkgreen;">{{current_user.username}}</span></h3> <h3>Hola <span style="color: darkgreen;">{{current_user.username}}</span></h3>
<p>Aquí puedes ver los pines que has agregado y ver tu enlace/QR de invitación. Cada vez que recargas esta página, tu enlace de invitacón cambia y el anterior se vuelve inválido.</p> <p>Aquí puedes ver los pines que has agregado y consultar tu enlace/QR de invitación. Cada vez que recargas esta página, tu enlace de invitacón cambia y el anterior se vuelve inválido.</p>
<div id="qrgen" style="border-width:5px; border-color:#e6e6fa"> <div class="grid" style="padding-bottom: 2rem;">
<div id="qrgen" style="">
</div>
<script type="text/javascript">
var qrcode = new QRCode(document.getElementById("qrgen"), {
text: "https://baches.qro.mx/registrame/{{current_user.referral_code}}",
width: 256,
height: 256,
colorDark : "#000000",
colorLight : "#e6e6fa",
correctLevel : QRCode.CorrectLevel.L
});
</script>
<div>
<h2>Tu link es:</h2>
<p><a href="https://baches.qro.mx/registrame/{{current_user.referral_code}}">https://baches.qro.mx/registrame/{{current_user.referral_code}}</a></p>
</div>
</div> </div>
<script type="text/javascript">
var qrcode = new QRCode(document.getElementById("qrgen"), {
text: "https://baches.qro.mx/registrame/{{current_user.referral_code}}",
width: 128,
height: 128,
colorDark : "#000000",
colorLight : "#e6e6fa",
correctLevel : QRCode.CorrectLevel.L
});
</script>
<h3>Tu link es:</h3>
<h2>https://baches.qro.mx/registrame/{{current_user.referral_code}}</h2>
{% if pins %} {% if pins %}
{% for pin in pins %} {% for pin in pins %}

View File

@ -1,6 +1,19 @@
{% extends 'secondbase.html' %} {% extends 'secondbase.html' %}
<ul> {% block content %}
<h2>Aquí puedes consultar quiénes están contribuyendo. Por cuestiones de privacidad, los nombres están modificados, pero si sabes, sabes</h2>
<table>
<thead>
<tr>
<th scope="col">Mapista</th>
<th scope="col">Marcador</th>
</tr>
</thead>
<tbody>
{% for leader in leaders %} {% for leader in leaders %}
{% if username != None and leader.username == username %}<li><span style="padding-left: -100%;">¡Felicidades, estás aquí!</span><b>{{ leader.username }} -> {{leader.count}}</b></li>{% else %}{{leader.username}} -> {{leader.count}}{% endif %} <th scope="row">{{leader.username}}</th>
<th scope="row">{{leader.count}}</th>
{% endfor %} {% endfor %}
</ul> </tbody>
</table>
{% endblock %}