Give the phone a native harbour scene with interruptible dermaga pans.

Replace stacked zone strips with one water scene per dermaga, a shore sheet, and a continuous Prod↔Staging camera pan; closing Perlu kamu clears the dim filter.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-08 02:33:25 +07:00
parent 1b246afdde
commit 9c66b83e41
5 changed files with 449 additions and 122 deletions

View File

@@ -56,6 +56,8 @@ button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px soli
.brand { position: relative; display: flex; align-items: center; gap: 10px; }
.brand span { font-family: var(--serif); font-size: 28px; font-weight: 600; letter-spacing: -.5px; }
.brand-me { display: none; margin-left: auto; }
.toolbar { display: none; }
h1 { position: relative; margin: 0; font-family: var(--serif); font-weight: 600; font-size: 46px; line-height: 1.05; letter-spacing: -1px; }
.empty { position: relative; margin: 0; max-width: 520px; font-size: 17px; line-height: 1.5; }
.legend { position: relative; margin: -8px 0 0; max-width: 520px; font-size: 13px; line-height: 1.4; color: #1E4A51; opacity: .78; }
@@ -180,7 +182,7 @@ aside { min-width: 0; }
:root { --boat-w: 104px; }
}
/* Phone: full harbour + floating dock + bottom sheet for detail. */
/* Phone: one harbour scene + bottom sheet from the shore. */
@media (max-width: 899px) {
.harbour {
display: block;
@@ -190,69 +192,165 @@ aside { min-width: 0; }
overflow: visible;
}
.water {
padding: 18px 16px calc(88px + env(safe-area-inset-bottom));
gap: 14px;
padding: 14px 16px 0;
gap: 12px;
min-height: 100vh;
min-height: 100dvh;
}
.brand span { font-size: 22px; }
h1 { font-size: 28px; letter-spacing: -.5px; }
.legend { margin-top: -4px; font-size: 12px; }
.zone .floats, .quay, .pilings { display: none; }
.lane, .lane.has-break { padding: 14px 0 22px; }
.lane h2 { font-size: 20px; }
.breakwater {
left: 0; right: 0; bottom: -6px; height: 10px;
border-radius: 999px;
background-image: none;
background-color: rgba(168, 158, 140, .55);
box-shadow: none;
}
.breakwater svg { display: none; }
/* One strip per zone; boats scroll sideways. */
.zones {
display: flex;
flex-direction: column;
gap: 12px;
height: auto;
padding-right: 0;
transition: none;
}
.zone {
background: rgba(255, 253, 248, .34);
border-radius: 18px;
padding: 10px 10px 8px;
}
.zone-label { margin-bottom: 2px; }
.boats {
.brand { padding-top: env(safe-area-inset-top); }
.brand span { font-size: 22px; }
.brand { width: 100%; }
.brand-me { display: block; margin: 0 0 0 auto; }
.brand-me .avatar { width: 40px; height: 40px; }
h1 { font-size: 28px; letter-spacing: -.5px; max-width: 18ch; }
.legend { display: none; }
.empty { font-size: 15px; }
.toolbar {
display: flex;
flex-wrap: nowrap;
gap: 4px 8px;
overflow-x: auto;
overscroll-behavior-x: contain;
scroll-snap-type: x mandatory;
-webkit-overflow-scrolling: touch;
padding: 2px 4px 6px;
margin: 0 -2px;
scrollbar-width: none;
flex-wrap: wrap;
align-items: center;
gap: 8px;
position: relative;
}
.toolbar[hidden] { display: none !important; }
.dermaga {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.chip-pill {
min-height: 32px;
padding: 4px 12px;
border: 0;
border-radius: 999px;
background: rgba(255, 253, 248, .55);
color: #1E4A51;
font-size: 13px;
font-weight: 700;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 6px;
}
.chip-pill[aria-pressed="true"] {
background: var(--teal);
color: #fff;
}
.chip-pill.filter { background: rgba(246, 242, 234, .9); }
.chip-pill.filter[aria-pressed="true"] { background: #FBEBD0; color: #5C4310; }
.chip-pill .count {
min-width: 20px;
height: 20px;
font-size: 12px;
}
.chip-pill.filter[aria-pressed="true"] .count { background: var(--buoy); color: var(--ink); }
.zone .floats, .quay, .pilings, .breakwater, .lane h2, .zone-label { display: none; }
.lane, .lane.has-break, .lane.phone-harbour {
padding: 0;
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
}
/* Full-bleed harbour so the camera pan clips at the screen edge, not the padded water. */
main#lanes {
position: relative;
flex: 1 1 auto;
min-height: 280px;
display: flex;
flex-direction: column;
margin: 0 -16px;
width: calc(100% + 32px);
overflow: hidden;
}
.phone-harbour { overflow: visible; }
/* Dual-scene camera pan: both harbours stay mounted so a reverse tap can retarget. */
main#lanes.lane-panning {
display: block;
}
main#lanes.lane-panning .lane-pan {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
flex: none;
will-change: transform;
}
.stale { margin: 0 16px 12px; align-self: center; }
/* One water plane: Dicek high, Siap mid, Beres near the sand. */
.harbour-scene {
position: relative;
flex: 1 1 auto;
min-height: 300px;
display: grid;
grid-template-rows: 1fr 1.15fr 1fr auto;
padding: 4px 16px 0;
}
.band {
position: relative;
z-index: 1;
min-width: 0;
display: flex;
align-items: center;
justify-content: center;
}
.band-cek { align-items: flex-end; padding-bottom: 4px; }
.band-siap { align-items: center; }
.band-beres { align-items: flex-start; padding-top: 6px; }
.band .boats {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: flex-start;
gap: 4px 14px;
width: 100%;
overflow: visible;
padding: 0 4px;
margin: 0;
}
.beach {
height: 28px;
margin: 8px -16px 0;
width: calc(100% + 32px);
border-radius: 40% 40% 0 0 / 100% 100% 0 0;
background: linear-gradient(180deg, #E4D4B0 0%, var(--sand) 55%, #DFCDA3 100%);
box-shadow: 0 -8px 18px rgba(23, 43, 51, .06);
}
.boats::-webkit-scrollbar { display: none; }
.zone.beres .boats { justify-content: flex-start; }
.boat {
flex: 0 0 auto;
width: 112px;
scroll-snap-align: start;
min-height: 148px;
padding-top: 6px;
width: 108px;
min-height: 0;
padding: 4px 2px 2px;
gap: 2px;
}
.boat .hull { width: 88px; height: 66px; }
.boat .hull svg { width: 88px; height: 66px; }
.boat .boat-title { font-size: 12px; -webkit-line-clamp: 2; }
.boat .boat-title { display: none; }
.boat .chip {
font-size: 12px;
padding: 5px 10px;
background: rgba(255, 253, 248, .88);
box-shadow: 0 4px 12px rgba(23, 43, 51, .08);
}
.boat.picked {
z-index: 2;
}
.boat.picked .chip {
background: var(--teal);
color: #fff;
padding: 7px 12px;
border-radius: 12px;
box-shadow: 0 10px 22px rgba(23, 43, 51, .2);
transform: translateY(-2px);
}
.boat.picked .shade { background: rgba(255, 255, 248, .95); }
/* Dock + sheet share .shore so the scrim can never paint over #detail.
Shore must be a full-viewport layer: its children are all out-of-flow, so
height:auto collapses to 0 and the sheet ends up above the screen. */
/* Sheet only: no floating dock. Shore is a full-viewport layer so #detail anchors to the bottom. */
.shore {
position: fixed;
z-index: 20;
@@ -279,33 +377,7 @@ aside { min-width: 0; }
pointer-events: none;
}
.shore .edge { display: none; }
.shore-top {
position: relative;
z-index: 3;
pointer-events: auto;
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin: 0 12px calc(12px + env(safe-area-inset-bottom));
padding: 8px;
background: rgba(246, 242, 234, .96);
border: 1px solid rgba(23, 43, 51, .06);
border-radius: 22px;
box-shadow: 0 10px 28px rgba(23, 43, 51, .14);
backdrop-filter: blur(10px);
transition: opacity .2s ease, transform .2s ease;
}
.harbour[data-sheet="detail"] .shore-top,
.harbour[data-sheet="list"] .shore-top {
opacity: 0;
transform: translateY(12px);
pointer-events: none;
}
.seg { flex: 1 1 auto; min-width: 0; }
.seg button { flex: 1 1 auto; justify-content: center; min-height: 44px; padding: 6px 12px; font-size: 14px; }
.seg #show-mine { padding-right: 8px; }
.avatar { width: 40px; height: 40px; }
.shore-top { display: none !important; }
.scrim {
display: block;
@@ -333,11 +405,11 @@ aside { min-width: 0; }
left: 0;
right: 0;
bottom: 0;
max-height: min(92dvh, 860px);
max-height: min(88dvh, 820px);
overflow-y: auto;
overscroll-behavior: contain;
pointer-events: auto;
padding: 0 14px calc(18px + env(safe-area-inset-bottom));
padding: 0 14px calc(14px + env(safe-area-inset-bottom));
background: var(--paper);
background-image: radial-gradient(#E2D8C6 1.2px, transparent 1.4px);
background-size: 24px 24px;
@@ -352,7 +424,7 @@ aside { min-width: 0; }
display: block;
width: 44px;
height: 5px;
margin: 10px auto 14px;
margin: 10px auto 12px;
border-radius: 999px;
background: #D5CBB8;
}
@@ -365,18 +437,21 @@ aside { min-width: 0; }
}
body.sheet-open { overflow: hidden; }
.card { padding: 4px 4px 18px; gap: 18px; border-radius: 0; box-shadow: none; background: transparent; }
.card h2 { font-size: 22px; }
.card { padding: 4px 4px 10px; gap: 16px; border-radius: 0; box-shadow: none; background: transparent; }
.card h2 { font-size: 24px; }
.card .title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.tone { padding: 16px; }
.tone .icon { width: 44px; height: 44px; }
.tone .word { font-size: 24px; }
/* Thumb zone: Gas right under the tone; findings scroll below. */
.actions .buttons.main { display: flex; flex-direction: column; gap: 10px; }
.actions .buttons.main .act { width: 100%; min-height: 52px; }
.actions .buttons.main .act { width: 100%; min-height: 52px; border-radius: 18px; }
.actions .buttons.side { display: flex; gap: 10px; }
.actions .buttons.side .act { flex: 1 1 0; min-height: 48px; }
.actions .buttons.side .act { flex: 1 1 0; min-height: 48px; border-radius: 16px; }
.release-row { flex-direction: column; }
.release-row .act { width: 100%; min-height: 52px; }
.card .more { display: flex; flex-direction: column; gap: 16px; }
}
@media (prefers-reduced-motion: reduce) {

View File

@@ -41,7 +41,7 @@
todo: '<svg width="12" height="12" viewBox="0 0 12 12"><path d="M3 6h6M6.5 3.5L9 6l-2.5 2.5" fill="none" stroke="#6B4206" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',
};
const state = { cols: null, data: null, sel: null, filter: 'all', listOpen: false, seen: new Set(), first: true, failedAt: null, shown: null, composing: null, busy: false, error: null, releaseTag: null };
const state = { cols: null, data: null, sel: null, lane: null, laneDir: 0, filter: 'all', listOpen: false, seen: new Set(), first: true, failedAt: null, shown: null, composing: null, busy: false, error: null, releaseTag: null };
const $ = (id) => document.getElementById(id);
const phone = window.matchMedia('(max-width: 899px)');
const shortTitle = (t, n = 28) => {
@@ -169,15 +169,15 @@
const duration = Math.min(3200, 1300 + dist * 2.4);
const lift = Math.min(22, dist / 14);
const tilt = Math.abs(dx) < 4 ? 0 : dx < 0 ? 2.5 : -2.5;
const zone = b.closest('.zone');
zone.style.zIndex = '3';
const berth = b.closest('.zone, .band');
if (berth) berth.style.zIndex = '3';
const move = b.animate([{ transform: `translate(${dx}px, ${dy}px)` }, { transform: 'translate(0, 0)' }], { duration, easing: SAIL_EASE });
b.animate([
{ transform: 'translateY(0) rotate(0deg)', easing: SWELL_EASE },
{ transform: `translateY(${-lift}px) rotate(${tilt}deg)`, offset: 0.5, easing: SWELL_EASE },
{ transform: 'translateY(0) rotate(0deg)' },
], { duration, composite: 'add' });
move.onfinish = move.oncancel = () => { zone.style.zIndex = ''; };
move.onfinish = move.oncancel = () => { if (berth) berth.style.zIndex = ''; };
}
}
@@ -289,26 +289,259 @@
}
}
// Interruptible motion (phone dermaga pan) — reuse this pattern for later board animations.
//
// Goal: a reverse tap mid-flight continues from the pixels on screen (UIKit / UIViewPropertyAnimator),
// never jumps back to a rest pose, and never tears the moving layer down early.
//
// Do:
// 1. Animate whole layers (here: two `.phone-harbour` scenes), not clones of children.
// 2. Keep both layers mounted for the whole pan (`#lanes.lane-panning`). On interrupt, swap
// which one is "stay" vs "leave" and retarget — do not replaceChildren / remove ghosts.
// 3. Retarget with commitStyles → cancel → animate from getComputedStyle().transform to the
// new end. That presentation value is the continuous join point.
// 4. Use one long ease-in-ease-out (Apple CAMediaTimingFunction easeInEaseOut below), no stagger,
// so it reads as a camera pan. Bump lanePanGen so stale finished callbacks no-op.
// 5. Clip at the real screen edge (full-bleed `#lanes`); padding belongs inside the scene.
//
// Don't:
// - Snapshot boats into absolute ghosts and delete the live tree (killing in-flight work).
// - Start a new keyframe from translate(0) / off-screen while an old animation still owns the node.
// - clear() or cancel without commitStyles first (causes a visible snap).
//
// Reference implementation: interruptiblePan + panPhoneHarbour below.
const LANE_SLIDE_MS = 920;
const LANE_SLIDE_EASE = 'cubic-bezier(0.42, 0, 0.58, 1)'; // CAMediaTimingFunction easeInEaseOut
let lanePanGen = 0;
function interruptiblePan(el, to, { onDone } = {}) {
for (const a of el.getAnimations()) {
try { a.commitStyles(); } catch { /* not fill:forwards yet */ }
a.cancel();
}
const from = getComputedStyle(el).transform;
const anim = el.animate(
[{ transform: from === 'none' ? 'matrix(1, 0, 0, 1, 0, 0)' : from }, { transform: to }],
{ duration: LANE_SLIDE_MS, easing: LANE_SLIDE_EASE, fill: 'forwards' },
);
const gen = lanePanGen;
anim.finished.then(() => {
if (gen !== lanePanGen) return;
try { anim.commitStyles(); } catch { /* already cancelled */ }
anim.cancel();
if (to === 'translateX(0px)') el.style.transform = '';
if (onDone) onDone();
}).catch(() => {});
return anim;
}
function buildPhoneScene(laneName) {
const scene = el('div', { class: 'harbour-scene' });
for (const z of ZONES) {
const items = zoneItems(state.data, laneName, z);
scene.append(
el('div', { class: `band band-${z.key}`, 'aria-label': z.label },
el('div', { class: 'boats' }, items.map((a) => boat(a))),
),
);
}
scene.append(el('div', { class: 'beach', 'aria-hidden': 'true' }));
return el('section', { class: 'lane phone-harbour', 'aria-label': laneName }, scene);
}
function settlePhoneHarbour(main, keep) {
for (const child of [...main.children]) {
if (child === keep) continue;
for (const a of child.getAnimations()) a.cancel();
child.remove();
}
for (const a of keep.getAnimations()) {
try { a.commitStyles(); } catch { /* ignore */ }
a.cancel();
}
keep.classList.remove('lane-pan', 'lane-in', 'lane-out');
keep.style.transform = '';
main.classList.remove('lane-panning');
main.style.height = '';
}
function panPhoneHarbour(main, dir) {
const target = state.lane;
if (!target) {
main.replaceChildren();
main.classList.remove('lane-panning');
return;
}
if (calm.matches) {
main.classList.remove('lane-panning');
main.replaceChildren(buildPhoneScene(target));
return;
}
lanePanGen += 1;
const gen = lanePanGen;
const scenes = [...main.querySelectorAll('.phone-harbour')];
let stay = scenes.find((s) => s.getAttribute('aria-label') === target) || null;
let leave = scenes.find((s) => s !== stay) || null;
// Mid-pan interrupt: both scenes stay mounted; only the targets change.
if (stay && leave && main.classList.contains('lane-panning')) {
stay.classList.add('lane-pan', 'lane-in');
stay.classList.remove('lane-out');
leave.classList.add('lane-pan', 'lane-out');
leave.classList.remove('lane-in');
interruptiblePan(leave, dir > 0 ? 'translateX(-100%)' : 'translateX(100%)', {
onDone: () => { if (gen === lanePanGen && leave.isConnected) leave.remove(); },
});
interruptiblePan(stay, 'translateX(0px)', {
onDone: () => { if (gen === lanePanGen) settlePhoneHarbour(main, stay); },
});
return;
}
// Fresh pan from a settled harbour.
const current = main.querySelector('.phone-harbour');
if (!current) {
main.replaceChildren(buildPhoneScene(target));
return;
}
if (current.getAttribute('aria-label') === target) return;
main.style.height = `${Math.max(main.offsetHeight, 280)}px`;
main.classList.add('lane-panning');
current.classList.add('lane-pan', 'lane-out');
current.classList.remove('lane-in');
const next = buildPhoneScene(target);
next.classList.add('lane-pan', 'lane-in');
next.style.transform = dir > 0 ? 'translateX(100%)' : 'translateX(-100%)';
main.append(next);
interruptiblePan(current, dir > 0 ? 'translateX(-100%)' : 'translateX(100%)', {
onDone: () => { if (gen === lanePanGen && current.isConnected) current.remove(); },
});
interruptiblePan(next, 'translateX(0px)', {
onDone: () => { if (gen === lanePanGen) settlePhoneHarbour(main, next); },
});
}
function visibleLanes(data) {
const used = new Set(data.ajuan.map((a) => a.lane));
return data.lanes.filter((l, i) => used.has(l) || (l !== 'Lainnya' && i < 2));
}
function zoneItems(data, lane, z) {
let items = data.ajuan.filter((a) => a.lane === lane && META[a.status].zone === z.key);
// Beres in the order boats docked, so the first in is the first out.
if (z.key === 'beres') items = items.slice().sort((x, y) => Date.parse(x.dockedAt) - Date.parse(y.dockedAt));
return items;
}
function drawToolbar(lanes) {
const bar = $('toolbar');
if (!phone.matches) {
bar.hidden = true;
bar.replaceChildren();
return;
}
const { data } = state;
const mine = data.ajuan.filter((a) => a.needsYou).length;
bar.hidden = false;
bar.replaceChildren(
el('div', { class: 'dermaga', role: 'group', 'aria-label': 'Dermaga' },
lanes.map((name) => el('button', {
type: 'button',
class: 'chip-pill',
'aria-pressed': String(state.lane === name),
onclick: () => {
if (state.lane === name) return;
const from = lanes.indexOf(state.lane);
const to = lanes.indexOf(name);
state.laneDir = to >= 0 && from >= 0 && to !== from ? (to > from ? 1 : -1) : 1;
state.lane = name;
state.sel = null;
state.listOpen = false;
history.replaceState(null, '', location.pathname);
drawnLanes = '';
draw();
},
}, name)),
),
el('button', {
type: 'button',
class: 'chip-pill filter',
'aria-pressed': String(state.filter === 'mine'),
onclick: () => {
// Toggle off restores the full harbour; only open the list when turning the filter on.
if (state.filter === 'mine') {
state.filter = 'all';
state.listOpen = false;
} else {
state.filter = 'mine';
state.sel = null;
state.listOpen = true;
history.replaceState(null, '', location.pathname);
}
draw();
},
}, 'Perlu kamu', el('span', { class: 'count' }, mine)),
);
}
// Phone: one dermaga as a single water scene (no zone-card chrome).
function resolvePhoneLane(data, lanes) {
const selected = state.sel && data.ajuan.find((a) => a.id === state.sel);
if (selected && lanes.includes(selected.lane)) state.lane = selected.lane;
else if (!state.lane || !lanes.includes(state.lane))
state.lane = lanes.find((l) => data.ajuan.some((a) => a.lane === l)) || lanes[0] || null;
}
function drawPhoneHarbour(main, data, lanes) {
resolvePhoneLane(data, lanes);
drawToolbar(lanes);
main.classList.remove('lane-panning');
if (!state.lane) {
main.replaceChildren();
return;
}
main.replaceChildren(buildPhoneScene(state.lane));
}
let drawnLanes = '';
function drawLanes() {
const { data } = state;
const used = new Set(data.ajuan.map((a) => a.lane));
const lanes = data.lanes.filter((l, i) => used.has(l) || (l !== 'Lainnya' && i < 2));
const lanes = visibleLanes(data);
const main = $('lanes');
// A refresh that changes nothing on the water leaves the boats alone, so none restarts mid-glide.
const key = JSON.stringify([lanes, state.sel, state.filter, data.ajuan.map((a) => [a.id, a.lane, a.status, a.label, a.title, a.needsYou, state.seen.has(a.id)])]);
if (key === drawnLanes && main.childElementCount) return;
const key = JSON.stringify([phone.matches, state.lane, lanes, state.sel, state.filter, data.ajuan.map((a) => [a.id, a.lane, a.status, a.label, a.title, a.needsYou, state.seen.has(a.id)])]);
if (key === drawnLanes && main.childElementCount) {
if (phone.matches) drawToolbar(lanes);
return;
}
drawnLanes = key;
const before = new Map([...main.querySelectorAll('.boat[data-id]')].map((b) => [b.dataset.id, { rect: b.getBoundingClientRect(), node: b }]));
const shown = new Set();
if (phone.matches) {
const dir = state.laneDir;
state.laneDir = 0;
if (dir) {
resolvePhoneLane(data, lanes);
drawToolbar(lanes);
panPhoneHarbour(main, dir);
return;
}
// Don't tear down a live pan when the queue merely refreshes.
if (main.classList.contains('lane-panning')) {
drawToolbar(lanes);
return;
}
drawPhoneHarbour(main, data, lanes);
for (const b of main.querySelectorAll('.boat[data-id]')) shown.add(b.dataset.id);
sail(new Map([...before].map(([id, b]) => [id, b.rect])));
depart(before, shown);
return;
}
$('toolbar').hidden = true;
$('toolbar').replaceChildren();
main.replaceChildren();
lanes.forEach((name, li) => {
// A redrawn row starts at the widths it had, so the change to new widths can transition.
const zones = el('div', { class: 'zones', style: state.cols ? { gridTemplateColumns: state.cols } : null });
for (const z of ZONES) {
let items = data.ajuan.filter((a) => a.lane === name && META[a.status].zone === z.key);
// Beres in the order boats docked, so the first in is the first out.
if (z.key === 'beres') items = items.slice().sort((x, y) => Date.parse(x.dockedAt) - Date.parse(y.dockedAt));
const items = zoneItems(data, name, z);
zones.append(
el('div', { class: `zone ${z.key}` },
z.key !== 'cek' && el('div', { class: 'floats', 'aria-hidden': 'true' }),
@@ -329,14 +562,12 @@
main.append(lane);
});
// A full Beres lets its earliest finished boats go; deploys still running or failed stay.
if (!phone.matches) {
const room = ROWS * BERES_PER_ROW;
for (const boats of main.querySelectorAll('.zone.beres .boats')) {
const docked = [...boats.children];
const finished = docked.filter((b) => b.finished);
finished.slice(0, Math.max(0, Math.min(finished.length, docked.length - room))).forEach((b) => b.remove());
boats.parentElement.querySelector('.zone-label .n').textContent = boats.childElementCount;
}
const room = ROWS * BERES_PER_ROW;
for (const boats of main.querySelectorAll('.zone.beres .boats')) {
const docked = [...boats.children];
const finished = docked.filter((b) => b.finished);
finished.slice(0, Math.max(0, Math.min(finished.length, docked.length - room))).forEach((b) => b.remove());
boats.parentElement.querySelector('.zone-label .n').textContent = boats.childElementCount;
}
for (const b of main.querySelectorAll('.boat[data-id]')) shown.add(b.dataset.id);
// Boats take their new slots at once; the columns then widen or narrow through their
@@ -517,24 +748,27 @@
el('div', {}, el('span', { class: 'word' }, m.word), el('span', { class: 'reason' }, a.reason)),
),
);
// Decide first (Gas under the thumb), then findings and history below the fold.
if (a.actions.length || a.gasAt || a.closeAt) card.append(actions(a));
if (a.release) card.append(releaseBox(a));
if (a.deployUrl) card.append(el('p', { class: 'note' }, el('a', { href: a.deployUrl, target: '_blank', rel: 'noopener' }, 'Pipeline deploy')));
const more = el('div', { class: 'more' });
if (a.release) more.append(releaseBox(a));
if (a.deployUrl) more.append(el('p', { class: 'note' }, el('a', { href: a.deployUrl, target: '_blank', rel: 'noopener' }, 'Pipeline deploy')));
if (a.findings.length)
card.append(el('ul', { class: 'findings' }, a.findings.map((f) => el('li', {}, el('span', { class: `k ${f.kind}`, 'aria-hidden': 'true', html: KIND[f.kind] }), el('span', {}, f.text, evidenceLinks(f.evidence))))));
more.append(el('ul', { class: 'findings' }, a.findings.map((f) => el('li', {}, el('span', { class: `k ${f.kind}`, 'aria-hidden': 'true', html: KIND[f.kind] }), el('span', {}, f.text, evidenceLinks(f.evidence))))));
if (a.postDeploy.length) {
card.append(el('p', { class: 'section-title' }, 'Habis deploy'));
card.append(el('ul', { class: 'findings' }, a.postDeploy.map((p) => el('li', {}, el('span', { class: 'k todo', 'aria-hidden': 'true', html: KIND.todo }), el('span', {}, p.text, evidenceLinks(p.evidence))))));
more.append(el('p', { class: 'section-title' }, 'Habis deploy'));
more.append(el('ul', { class: 'findings' }, a.postDeploy.map((p) => el('li', {}, el('span', { class: 'k todo', 'aria-hidden': 'true', html: KIND.todo }), el('span', {}, p.text, evidenceLinks(p.evidence))))));
}
for (const o of a.overrides) card.append(el('p', { class: 'note' }, `Aturan Labuh: ${o}`));
if (a.reviewedSha) card.append(el('p', { class: 'stamp' }, `${state.data.reviewer} · commit ${a.reviewedSha.slice(0, 8)} · ${a.tokens.toLocaleString('id-ID')} token`));
for (const o of a.overrides) more.append(el('p', { class: 'note' }, `Aturan Labuh: ${o}`));
if (a.reviewedSha) more.append(el('p', { class: 'stamp' }, `${state.data.reviewer} · commit ${a.reviewedSha.slice(0, 8)} · ${a.tokens.toLocaleString('id-ID')} token`));
const history = el('ol', {}, a.timeline.map((t) => el('li', {}, el('span', {}, clock(t.at)), el('span', {}, t.text))));
card.append(
more.append(
el('div', { class: 'foot' },
el('details', {}, el('summary', {}, 'Riwayat'), history),
el('a', { class: 'open', href: a.webUrl, target: '_blank', rel: 'noopener', html: 'Buka MR <svg width="14" height="14" viewBox="0 0 16 16" aria-hidden="true"><path d="M6 3h7v7M13 3L5 11" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>' }),
),
);
if (more.childElementCount) card.append(more);
return card;
}
@@ -595,13 +829,17 @@
state.shown = key;
const mine = data.ajuan.filter((x) => x.needsYou).length;
$('mine-count').textContent = mine;
const mineCount = $('mine-count');
if (mineCount) mineCount.textContent = mine;
$('show-all').setAttribute('aria-pressed', String(state.filter === 'all'));
$('show-mine').setAttribute('aria-pressed', String(state.filter === 'mine'));
const v = data.viewer;
$('avatar').textContent = (v.name || v.username).charAt(0).toUpperCase();
$('avatar').title = `Keluar (@${v.username})`;
$('avatar').setAttribute('aria-label', `Keluar dari akun @${v.username}`);
const initial = (v.name || v.username).charAt(0).toUpperCase();
for (const av of document.querySelectorAll('[data-avatar]')) {
av.textContent = initial;
av.title = `Keluar (@${v.username})`;
av.setAttribute('aria-label', `Keluar dari akun @${v.username}`);
}
}
function drawHeadline() {
@@ -636,6 +874,8 @@
}
function closeSheet() {
// Closing the "Perlu kamu" list exits the filter so boats are not left dimmed.
if (state.listOpen) state.filter = 'all';
state.listOpen = false;
if (state.sel) pick(null);
else draw();
@@ -718,12 +958,17 @@
}
}, 1000);
document.addEventListener('visibilitychange', () => { if (!document.hidden) load(); });
window.addEventListener('resize', () => {
const onViewport = () => {
drawnLanes = '';
if (state.data) {
if (!phone.matches) state.listOpen = false;
if (!phone.matches) {
state.listOpen = false;
state.lane = null;
}
draw();
}
});
};
window.addEventListener('resize', onViewport);
phone.addEventListener('change', onViewport);
});
})();

View File

@@ -19,8 +19,12 @@
<header class="brand">
<svg width="36" height="36" viewBox="0 0 64 64" aria-hidden="true"><rect width="64" height="64" rx="16" fill="#172B33"/><path d="M22 14V42H44" fill="none" stroke="#F6F2EA" stroke-width="8" stroke-linecap="round" stroke-linejoin="round"/><circle cx="44" cy="26" r="5.5" fill="#E8A33D"/></svg>
<span>labuh</span>
<form method="post" action="/auth/logout" class="me brand-me">
<button type="submit" class="avatar" data-avatar title="Keluar">?</button>
</form>
</header>
<h1 id="headline">Membaca antrean…</h1>
<div class="toolbar" id="toolbar" hidden></div>
<p id="empty" class="empty" hidden></p>
<p id="legend" class="legend">Pelampung = siap gas · Jangkar = ditahan · Tali = berlabuh</p>
<main id="lanes"></main>
@@ -36,8 +40,8 @@
<button type="button" id="show-all" aria-pressed="true">Semua</button>
<button type="button" id="show-mine" aria-pressed="false">Perlu kamu <span class="count" id="mine-count">0</span></button>
</div>
<form method="post" action="/auth/logout" class="me">
<button type="submit" id="avatar" class="avatar" title="Keluar">?</button>
<form method="post" action="/auth/logout" class="me dock-me">
<button type="submit" class="avatar" data-avatar title="Keluar">?</button>
</form>
</div>
<aside id="detail" aria-label="Detail" aria-live="polite"></aside>