GG.deals clone: CodeIgniter 4 + MongoDB game price tracker
- Full gg.deals-style UI: deal feed with filters, game pages with price history charts, rankings, vouchers, news, prepaids, subscriptions, bundles, franchises, wishlist, API docs - Real data crawlers: * gg:crawl (Steam Store API + GOG Catalog + Epic free games) * gg:catalog (252K game slugs from gg.deals sitemaps) * gg:ggdeals (per-game prices via FlareSolverr session, JSON-LD parsing) * gg:seed / gg:crawl-covers (demo seed + Steam CDN cover art) - 24/7 self-updating scheduler (scripts/scheduler_loop.php, lockfile-protected) - Tailwind v4 dark/light theme, Alpine.js, Chart.js
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
<?= $this->extend('layout') ?>
|
||||
<?= $this->section('content') ?>
|
||||
|
||||
<div class="mb-6">
|
||||
<h1 class="text-2xl font-extrabold text-white tracking-tight">Promo Codes & Coupons</h1>
|
||||
<p class="text-sm text-muted mt-1">Active discount codes across all stores. Copy a code and apply it at checkout.</p>
|
||||
</div>
|
||||
|
||||
<?php if ($vouchers === []): ?>
|
||||
<div class="bg-card border border-line rounded-xl p-10 text-center">
|
||||
<div class="text-4xl mb-3">🎟️</div>
|
||||
<div class="text-zinc-200 font-semibold">No active vouchers for this store</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="grid sm:grid-cols-2 lg:grid-cols-3 gap-3">
|
||||
<?php foreach ($vouchers as $v):
|
||||
$store = $stores[$v['store']] ?? null;
|
||||
$expires = $v['expires'] ?? null;
|
||||
$daysLeft = $expires instanceof MongoDB\BSON\UTCDateTime
|
||||
? max(1, (int) floor(($expires->toDateTime()->getTimestamp() - time()) / 86400))
|
||||
: null;
|
||||
?>
|
||||
<div class="bg-card border border-line rounded-xl p-4 hover:border-accent/40 transition-colors group">
|
||||
<div class="flex items-center gap-3 mb-3">
|
||||
<?php if ($store): ?><?= view('partials/store_badge', ['store' => $store, 'size' => 'lg']) ?><?php endif; ?>
|
||||
<div class="min-w-0">
|
||||
<div class="text-sm font-semibold text-zinc-100 truncate"><?= esc($v['title']) ?></div>
|
||||
<div class="text-xs text-muted"><?= esc($store['name'] ?? $v['store']) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div x-data="{ copied: false }" class="flex items-center gap-2">
|
||||
<button @click="navigator.clipboard.writeText('<?= esc($v['code']) ?>').then(() => { copied = true; setTimeout(() => copied = false, 2000) })"
|
||||
class="flex-1 bg-page border border-dashed border-accent/50 rounded-lg py-2.5 text-center font-mono font-bold text-accent hover:bg-accent/10 transition-colors"
|
||||
title="Click to copy">
|
||||
<?= esc($v['code']) ?>
|
||||
</button>
|
||||
<button @click="navigator.clipboard.writeText('<?= esc($v['code']) ?>').then(() => { copied = true; setTimeout(() => copied = false, 2000) })"
|
||||
class="px-3 py-2.5 rounded-lg bg-accent text-accent-ink text-xs font-bold hover:bg-accent/90 transition-colors">
|
||||
<span x-show="!copied">Copy</span>
|
||||
<span x-show="copied" x-cloak>✓</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 flex items-center justify-between text-xs text-muted">
|
||||
<span class="cut <?= cut_class((int) $v['discount']) ?> cut-badge">-<?= (int) $v['discount'] ?>%</span>
|
||||
<?php if ($v['min_spend'] > 0): ?><span>min. <?= money((float) $v['min_spend']) ?></span><?php endif; ?>
|
||||
<?php if ($daysLeft !== null): ?><span class="text-amber-400/90">expires in <?= $daysLeft ?>d</span><?php endif; ?>
|
||||
</div>
|
||||
<?php if (! empty($v['description'])): ?>
|
||||
<p class="mt-2 text-xs text-muted/80 leading-relaxed"><?= esc($v['description']) ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
Reference in New Issue
Block a user