Dayparting + automatic destination health checks for the rotator
Hours: rotation.hours / destination.hours = null (always on) or 7 strings of 24 chars '1'/'0' (index 0 = Sunday); rotation.tz = IANA zone name or 'visitor' (country -> representative zone, Central when unknown). Outside the link's hours visitors go to the fallback (hit.oh = 1 so stats show it); a destination outside its own hours is skipped by the pick. Presets always/business/evenings/weekends, server-side validation of grid and zone (Intl), "my best hours" = top quarter of weekday-hour cells by uniques over 30 days, unlocks at 200 clicks. Health (health.js): every 30 min each active destination and the fallback is fetched (10 s timeout, 5 redirects, HEAD then GET, 4 at a time) and classed ok / slow / dead / parked, with frameBlocked noted. Three failing checks in a row pause the destination (never the last live one of a rotation without a fallback); paused ones are re-checked every 6 h and come back after two clean passes only when LinkSpin paused them. Owner gets one on-site inbox notice per pause. POST /api/my/rotations/:id/health = Check now, once a minute. Links screen: Hours chip + inline 7x24 editor (tap, drag to paint, presets, zone picker, plain-English summary, heat tint), per-destination clock button and chip, health dot + line per row, Check now button, auto-paused note. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+28
-4
@@ -23,7 +23,26 @@
|
||||
.dhead{display:flex;align-items:center;gap:14px;padding:12px 24px;border-bottom:1px solid var(--line);background:var(--panel);flex-wrap:wrap}
|
||||
.dhead h2{font-family:var(--display);font-size:24px;font-weight:700;letter-spacing:.02em;margin:0}
|
||||
.dbody{padding:16px 24px;display:grid;gap:14px}
|
||||
.dest .hd,.dest .rw{grid-template-columns:minmax(0,2fr) 150px 80px 80px 110px 90px}
|
||||
.dest .hd,.dest .rw{grid-template-columns:minmax(0,2fr) 150px 80px 80px 110px 130px}
|
||||
.dest .rw.edit{grid-template-columns:1fr;background:var(--panel-2)}
|
||||
.dest .dl{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
|
||||
.hdot{display:inline-block;width:9px;height:9px;border-radius:50%;background:var(--line-strong);flex:none;vertical-align:middle}
|
||||
.hdot.ok{background:var(--ok);box-shadow:0 0 0 2px rgba(14,138,92,.2)} .hdot.warn{background:#D98B0C;box-shadow:0 0 0 2px rgba(217,139,12,.2)} .hdot.bad{background:var(--bad);box-shadow:0 0 0 2px rgba(185,28,28,.2)}
|
||||
.hchip{display:inline-flex;align-items:center;gap:5px;font-family:var(--mono);font-size:10px;font-weight:700;color:var(--ink-2);border:1px solid var(--line-strong);border-radius:999px;padding:2px 8px;white-space:nowrap;background:#fff;cursor:pointer;letter-spacing:.02em}
|
||||
.hchip.set{color:var(--sig-2);border-color:rgba(255,106,26,.5);background:var(--sig-soft)}
|
||||
.he{display:grid;gap:10px}
|
||||
.he-presets{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
|
||||
.he-tz{display:flex;gap:8px;align-items:center;flex-wrap:wrap} .he-tz select{width:auto;min-width:180px} .he-tz input{width:200px}
|
||||
.he-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;padding-bottom:6px}
|
||||
.he-grid{display:grid;grid-template-columns:36px repeat(24,22px);gap:2px;touch-action:pan-x;user-select:none;-webkit-user-select:none;width:max-content}
|
||||
.he-grid .hl{font-family:var(--mono);font-size:9px;font-weight:700;color:var(--muted);text-align:center;align-self:end;line-height:1}
|
||||
.he-grid .dlb{font-family:var(--mono);font-size:11px;font-weight:700;color:var(--ink-2);align-self:center;cursor:pointer}
|
||||
.he-grid .c{width:22px;height:22px;border-radius:3px;background:var(--panel-2);border:1px solid var(--line);cursor:pointer;box-sizing:border-box}
|
||||
.he-grid .c.heat{background:rgba(31,111,235,var(--heat))}
|
||||
.he-grid .c.on{background:var(--sig);border-color:var(--sig-2)}
|
||||
.he-sum{font-weight:700} .he-sum small{font-weight:500;color:var(--muted)}
|
||||
.he .acts{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
|
||||
.note{border:1px solid rgba(194,65,12,.4);background:var(--warn-soft);color:var(--warn);border-radius:8px;padding:8px 12px;font-size:12px}
|
||||
.wrow{display:flex;align-items:center;gap:8px} .wrow input{width:56px}
|
||||
.empty{padding:40px 24px;color:var(--muted);text-align:center;display:grid;gap:10px;justify-items:center}
|
||||
.two{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:16px}
|
||||
@@ -52,7 +71,9 @@
|
||||
<span class="code" id="dUrl"></span>
|
||||
<button class="btn sm" type="button" id="copyBtn">Copy</button>
|
||||
<span class="mono" id="dLive"></span>
|
||||
<button class="hchip" type="button" id="hoursChip" title="Hours this link is on">Always on</button>
|
||||
<span class="grow"></span>
|
||||
<button class="btn sm" type="button" id="checkBtn" title="Check every destination right now">Check now</button>
|
||||
<button class="btn sm" type="button" id="renameBtn">Rename</button>
|
||||
<button class="btn sm" type="button" id="pauseBtn">Pause</button>
|
||||
<button class="btn sm danger" type="button" id="delBtn">Delete</button>
|
||||
@@ -67,6 +88,7 @@
|
||||
<button type="button" data-tab="share">Share kit</button>
|
||||
</div>
|
||||
<div id="tab-dest">
|
||||
<div class="note" id="autoNote" hidden style="margin-bottom:10px"></div>
|
||||
<div class="tbl dest">
|
||||
<div class="hd"><span>Destination</span><span>Weight</span><span class="r">Clicks</span><span class="r">Unique</span><span>Status</span><span></span></div>
|
||||
<div id="destRows"></div>
|
||||
@@ -81,11 +103,13 @@
|
||||
<button class="btn pri" type="button" id="addBtn">Add</button>
|
||||
</div>
|
||||
<div class="muted">Macros in a destination are filled per visitor: <span class="mono">{clickid} {subid} {s1}…{s5} {source} {country} {device} {lsid}</span>. Example: <span class="mono">https://tracker.example/?cid={clickid}&src={source}</span></div>
|
||||
<label class="lbl">Fallback, used when every destination is paused or the link is paused<input class="field mono" id="fallback" type="url" placeholder="https://"></label>
|
||||
<label class="lbl">Fallback, used when every destination is paused, the link is paused, or the link is outside its hours<input class="field mono" id="fallback" type="url" placeholder="https://"></label>
|
||||
<div class="muted mono" id="fallbackHealth" style="font-size:11px"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tab-hours" hidden>
|
||||
<div class="panel"><h2>Clicks by hour, UTC, all time</h2><div class="bars" id="hourBars" style="grid-template-columns:repeat(24,minmax(0,1fr))"></div><div class="axis"><span>00</span><span>06</span><span>12</span><span>18</span><span>23</span></div><div class="muted">Hour rules (open a destination only at set hours) come in the next pass; this is where they will live.</div></div>
|
||||
<div class="panel"><h2>Hours this link is on</h2><div class="muted">Outside these hours visitors go to the fallback. Each destination can have its own hours too (the clock button on its row). Tap a cell to flip it, drag to paint, or start from a preset.</div><div id="rotHours"></div></div>
|
||||
<div class="panel" style="margin-top:12px"><h2>Clicks by hour, UTC, all time</h2><div class="bars" id="hourBars" style="grid-template-columns:repeat(24,minmax(0,1fr))"></div><div class="axis"><span>00</span><span>06</span><span>12</span><span>18</span><span>23</span></div><div class="muted" id="offNote"></div></div>
|
||||
</div>
|
||||
<div id="tab-sources" hidden>
|
||||
<div class="two">
|
||||
@@ -112,6 +136,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/cr-shell.js?v=20261008c"></script>
|
||||
<script src="/assets/links.js?v=20260929d"></script>
|
||||
<script src="/assets/links.js?v=20261010a"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user