Files
scrabble-game/backend/internal/adminconsole/templates/pages/banners.gohtml
T
Ilia Denisov 0946a3f66c
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 14s
CI / ui (pull_request) Successful in 49s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m12s
feat(ads): server-driven ad-banner backend, wire & admin console (PR1)
Turn the gated-off mock banner into a real advertising subsystem (backend +
admin half; the UI rotation lands in PR2).

- internal/ads: campaigns (percent weight + validity window; a perpetual,
  undeletable default that fills the remainder up to 100%), 1..N bilingual
  messages (en+ru), global display timings; ActiveSet computes the
  window-filtered, default-remainder, GCD-reduced, language-resolved rotation
  feed. Smooth-weighted-round-robin math is unit-tested.
- migration 00006 (+ jetgen): ad_campaigns / ad_messages / ad_settings, seeded
  default campaign + house message + default timings.
- eligibility = !paid_account && hint_balance==0 && !no_banner role (new role;
  guests qualify). The resolved feed rides the profile.get response (no new RPC,
  works for guests, nothing distinct to filter); language by service_language.
- live update: a notify `banner` sub-kind (re-poll signal) published when an
  operator grants hints or grants/revokes no_banner, so the client shows/hides
  in place.
- admin console /_gm/banners (+ /_gm/banner-settings): campaign + message CRUD
  with reorder, default protection, clamped timings.
- wire: fbs BannerInfo/BannerCampaign on Profile; gateway transcode forwards it.
- docs: ARCHITECTURE §10, FUNCTIONAL (+ _ru), backend README, PRERELEASE tracker
  (incl. the deferred app.load aggregator note).
2026-06-15 23:00:19 +02:00

33 lines
1.7 KiB
Go Template

{{define "content" -}}
<h1>Advertising banners</h1>
{{with .Data}}
<p class="note">Campaigns compete for the one-line banner shown to free users (no paid account, an empty hint wallet, and no <code>no_banner</code> role). A campaign's weight is a show percent; the perpetual <strong>default</strong> campaign fills the remainder up to 100% and drops out of the rotation when timed campaigns already total 100%. <a href="/_gm/banner-settings">Display timings →</a></p>
<section class="panel"><h2>Add campaign</h2>
<form class="form col" method="post" action="/_gm/banners">
<label>Name <input type="text" name="name" maxlength="80" required></label>
<label>Weight (%) <input type="number" name="weight" min="1" max="100" value="10" required></label>
<label>Starts (UTC) <input type="datetime-local" name="starts_at"></label>
<label>Ends (UTC) <input type="datetime-local" name="ends_at"></label>
<label><input type="checkbox" name="enabled" checked> Enabled</label>
<div><button type="submit">Add</button></div>
</form>
</section>
<section class="panel"><h2>Campaigns</h2>
<table class="list">
<thead><tr><th>Name</th><th class="num">Weight</th><th>Window</th><th class="num">Messages</th><th>Status</th></tr></thead>
<tbody>
{{range .Items}}
<tr>
<td><a href="/_gm/banners/{{.ID}}">{{.Name}}</a>{{if .IsDefault}} <span class="pill">default</span>{{end}}</td>
<td class="num">{{if .IsDefault}}remainder{{else}}{{.Weight}}%{{end}}</td>
<td>{{.Window}}</td>
<td class="num">{{.Messages}}</td>
<td>{{if .ActiveNow}}live{{else if .Enabled}}idle{{else}}disabled{{end}}</td>
</tr>
{{else}}<tr><td colspan="5"><span class="note">no campaigns</span></td></tr>{{end}}
</tbody>
</table>
</section>
{{end}}
{{- end}}