landing page for new users
All checks were successful
Build Images and Deploy / Update-PROD-Stack (push) Successful in 30s

This commit is contained in:
2026-03-20 11:08:02 -04:00
parent 0d518ddd1e
commit 7086f42b9e
3 changed files with 118 additions and 2 deletions

View File

@@ -49,10 +49,20 @@ router.get('/:shortName/:code', (req, res) => {
return res.render('loot/expired', { title: 'Hunt Expired', pkg });
}
// If not logged in, save this URL and redirect to auth
// If not logged in, show teaser landing page
if (!req.session.userId) {
req.session.returnTo = req.originalUrl;
return res.redirect('/auth/login');
const hunt = Hunts.findById(pkg.hunt_id);
// Calculate potential points: next scan number determines points
const scanNumber = pkg.scan_count + 1;
const potentialPoints = scanNumber === 1 ? 500 : scanNumber === 2 ? 250 : scanNumber === 3 ? 100 : 50;
return res.render('loot/teaser', {
title: 'Loot Found!',
potentialPoints,
huntName: hunt.name,
cardNumber: pkg.card_number,
packageCount: hunt.package_count
});
}
// Perform the scan

36
src/views/loot/teaser.ejs Normal file
View File

@@ -0,0 +1,36 @@
<%- include('../partials/header') %>
<div class="container">
<div class="teaser-page">
<div class="teaser-emoji" id="teaserEmoji">🎉</div>
<h1 class="teaser-headline" id="teaserHeadline">Nice find!</h1>
<p class="teaser-subtext">This loot is worth</p>
<div class="teaser-points"><%= potentialPoints %> <span>points</span></div>
<p class="teaser-cta">Sign in or create an account to claim it!</p>
<div class="teaser-buttons">
<a href="/auth/login" class="btn btn-primary btn-lg">Log In</a>
<a href="/auth/register" class="btn btn-success btn-lg">Sign Up</a>
</div>
<p class="teaser-hunt-info"><%= huntName %> &middot; Package <%= cardNumber %> of <%= packageCount %></p>
</div>
</div>
<script>
(function() {
var messages = [
{ emoji: '🎉', text: 'Nice find!' },
{ emoji: '🔥', text: 'Woah, great discovery!' },
{ emoji: '💎', text: 'You found treasure!' },
{ emoji: '🏆', text: 'Lucky you!' },
{ emoji: '⚡', text: 'What a score!' },
{ emoji: '🎯', text: 'Bullseye!' },
{ emoji: '🚀', text: 'Incredible find!' },
{ emoji: '✨', text: 'Look what you found!' }
];
var pick = messages[Math.floor(Math.random() * messages.length)];
document.getElementById('teaserEmoji').textContent = pick.emoji;
document.getElementById('teaserHeadline').textContent = pick.text;
})();
</script>
<%- include('../partials/footer') %>