Pages Medium
Bar Display System
Single-column KDS for the bar — drink tickets stack with live age timer, ice/garnish flags, and a Bump action. Compact for a narrow under-counter screen.
Open in Lab
MCP
html css vanilla-js
Targets: JS HTML
Code
:root {
--bone: #faf7f1;
--cream: #f5f0e8;
--cream-2: #ece4d4;
--forest: #2d4a3e;
--forest-d: #1e3329;
--terracotta: #c1714a;
--gold: #c9a84c;
--gold-light: #e6c97a;
--ink: #2c1a0e;
--ink-2: #4a3828;
--warm-gray: #7a6a58;
--success: #4f7a3a;
--danger: #b3432a;
--warning: #d99020;
--font-body: "Inter", system-ui, sans-serif;
--font-mono: "JetBrains Mono", ui-monospace, monospace;
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
}
body {
background: var(--ink);
color: var(--bone);
font-family: var(--font-body);
-webkit-font-smoothing: antialiased;
display: flex;
flex-direction: column;
user-select: none;
}
.bar-top {
padding: 12px 20px;
background: var(--forest-d);
display: grid;
grid-template-columns: auto 1fr auto auto;
gap: 16px;
align-items: center;
border-bottom: 1px solid rgba(250, 247, 241, 0.08);
}
.brand-name {
font-weight: 800;
font-size: 1rem;
letter-spacing: -0.005em;
}
.brand-tag {
font-size: 0.66rem;
letter-spacing: 0.18em;
text-transform: uppercase;
color: var(--gold-light);
font-weight: 700;
}
.stats {
display: flex;
gap: 18px;
justify-content: center;
}
.stat {
font-size: 0.78rem;
color: rgba(250, 247, 241, 0.6);
}
.stat b {
color: var(--bone);
font-family: var(--font-mono);
font-weight: 700;
font-size: 1rem;
margin-right: 3px;
}
.add {
background: var(--gold);
color: var(--ink);
border: none;
border-radius: 999px;
padding: 8px 16px;
font-family: inherit;
font-size: 0.84rem;
font-weight: 700;
cursor: pointer;
}
.add:hover {
background: var(--gold-light);
}
.clock {
font-family: var(--font-mono);
font-weight: 700;
font-size: 1rem;
color: var(--gold);
}
.col {
flex: 1;
overflow-y: auto;
padding: 14px 18px 28px;
display: flex;
flex-direction: column;
gap: 10px;
max-width: 560px;
margin: 0 auto;
width: 100%;
}
.ticket {
background: var(--bone);
color: var(--ink);
border-radius: 10px;
padding: 12px 14px 12px;
border-left: 4px solid var(--forest);
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
animation: tIn 0.2s ease;
}
@keyframes tIn {
from {
opacity: 0;
transform: translateY(4px);
}
to {
opacity: 1;
transform: none;
}
}
.ticket.is-warm {
border-left-color: var(--warning);
}
.ticket.is-hot {
border-left-color: var(--danger);
animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
0%,
100% {
box-shadow: 0 0 0 0 rgba(179, 67, 42, 0.4);
}
50% {
box-shadow: 0 0 0 3px rgba(179, 67, 42, 0.18);
}
}
.ticket header {
display: flex;
justify-content: space-between;
align-items: baseline;
margin-bottom: 8px;
}
.t-table {
font-weight: 800;
font-size: 1rem;
}
.t-age {
font-family: var(--font-mono);
font-weight: 700;
font-size: 0.95rem;
background: var(--cream-2);
color: var(--ink);
padding: 3px 9px;
border-radius: 999px;
}
.ticket.is-warm .t-age {
background: rgba(217, 144, 32, 0.2);
color: #8a5a1a;
}
.ticket.is-hot .t-age {
background: rgba(179, 67, 42, 0.18);
color: var(--danger);
}
.drinks {
list-style: none;
margin-bottom: 8px;
}
.d-row {
display: grid;
grid-template-columns: 28px 1fr auto;
align-items: baseline;
gap: 8px;
padding: 5px 0;
border-bottom: 1px dashed rgba(44, 26, 14, 0.1);
font-size: 0.92rem;
cursor: pointer;
}
.d-row:last-child {
border-bottom: none;
}
.d-row.is-done .d-name,
.d-row.is-done .d-qty,
.d-row.is-done .d-flag {
text-decoration: line-through;
color: var(--warm-gray);
}
.d-qty {
font-family: var(--font-mono);
font-weight: 700;
color: var(--terracotta);
}
.d-name {
font-weight: 600;
}
.d-mods {
display: block;
font-size: 0.74rem;
font-style: italic;
color: var(--warm-gray);
margin-top: 1px;
}
.d-flag {
font-size: 0.66rem;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
padding: 2px 7px;
border-radius: 999px;
background: var(--cream-2);
color: var(--ink-2);
}
.ticket footer {
display: flex;
gap: 6px;
}
.back,
.bump {
border-radius: 6px;
padding: 8px 12px;
font-family: inherit;
font-size: 0.82rem;
font-weight: 700;
cursor: pointer;
border: 1px solid transparent;
}
.back {
background: var(--cream);
border-color: rgba(44, 26, 14, 0.12);
color: var(--ink-2);
flex: 0 0 auto;
}
.back:hover {
background: var(--cream-2);
}
.bump {
flex: 1;
background: var(--forest);
color: var(--bone);
}
.bump:hover {
background: var(--forest-d);
}const SEED = [
{
id: "b-101",
table: "Table 7 · Lina",
age: 5 * 60 + 22,
drinks: [
{ qty: 2, name: "Negroni sbagliato", mod: "extra orange peel", flag: "Up" },
{ qty: 1, name: "Spritz", mod: "less ice", flag: "Less ice" },
],
},
{
id: "b-102",
table: "Bar 2",
age: 8 * 60 + 41,
drinks: [
{ qty: 1, name: "Vermut casa", mod: "with olive", flag: "Rocks" },
{ qty: 1, name: "Tinto natural", mod: "" },
],
},
{
id: "b-103",
table: "Table 11 · Marco",
age: 1 * 60 + 38,
drinks: [
{ qty: 4, name: "Albariño", mod: "splash sparkling" },
{ qty: 1, name: "Agua mineral", mod: "with lemon" },
],
},
{
id: "b-104",
table: "Take-out",
age: 30,
drinks: [
{ qty: 1, name: "Espresso", mod: "double" },
{ qty: 1, name: "Cortado", mod: "" },
],
},
];
const ALL_OPTIONS = [
{ name: "Negroni sbagliato", flag: "Up" },
{ name: "Vermut casa", flag: "Rocks" },
{ name: "Tinto natural", flag: "" },
{ name: "Albariño", flag: "" },
{ name: "Spritz", flag: "Less ice" },
{ name: "Cold brew", flag: "" },
];
const TABLES = ["Table 3", "Table 5", "Bar 1", "Bar 3", "Patio 2"];
let tickets = SEED.map((t) => ({
...t,
createdAt: Date.now() - t.age * 1000,
doneSet: new Set(),
bumped: false,
}));
const col = document.getElementById("col");
const tt = document.getElementById("tt");
const statActive = document.getElementById("statActive");
const statAvg = document.getElementById("statAvg");
const statOver = document.getElementById("statOver");
const clockEl = document.getElementById("clock");
function age(t) {
return (Date.now() - t.createdAt) / 1000;
}
function fmtAge(s) {
const m = Math.floor(s / 60);
const ss = Math.floor(s % 60);
return `${m}:${String(ss).padStart(2, "0")}`;
}
function bucket(s) {
if (s >= 7 * 60) return "is-hot";
if (s >= 4 * 60) return "is-warm";
return "";
}
function render() {
col.innerHTML = "";
const live = tickets.filter((t) => !t.bumped);
live.sort((a, b) => a.createdAt - b.createdAt);
live.forEach((t) => {
const node = tt.content.cloneNode(true);
const art = node.querySelector(".ticket");
art.dataset.id = t.id;
const s = age(t);
const cls = bucket(s);
if (cls) art.classList.add(cls);
node.querySelector(".t-table").textContent = t.table;
node.querySelector(".t-age").textContent = fmtAge(s);
const ul = node.querySelector(".drinks");
ul.innerHTML = t.drinks
.map(
(d, i) => `<li class="d-row ${t.doneSet.has(i) ? "is-done" : ""}" data-line="${i}">
<span class="d-qty">${d.qty}×</span>
<div>
<span class="d-name">${d.name}</span>
${d.mod ? `<span class="d-mods">${d.mod}</span>` : ""}
</div>
${d.flag ? `<span class="d-flag">${d.flag}</span>` : ""}
</li>`
)
.join("");
col.appendChild(node);
});
statActive.textContent = live.length;
const overCount = live.filter((t) => age(t) >= 7 * 60).length;
statOver.textContent = overCount;
const avg = live.length
? Math.round(live.reduce((sum, t) => sum + age(t), 0) / live.length / 60)
: 0;
statAvg.textContent = avg;
}
function refreshAgesAndStats() {
const live = tickets.filter((t) => !t.bumped);
let overCount = 0;
let totalAge = 0;
live.forEach((t) => {
const s = age(t);
totalAge += s;
if (s >= 7 * 60) overCount += 1;
const ticketEl = col.querySelector(`.ticket[data-id="${t.id}"]`);
if (!ticketEl) return;
const ageEl = ticketEl.querySelector(".t-age");
if (ageEl) ageEl.textContent = fmtAge(s);
ticketEl.classList.remove("is-warm", "is-hot");
const cls = bucket(s);
if (cls) ticketEl.classList.add(cls);
});
statActive.textContent = live.length;
statOver.textContent = overCount;
statAvg.textContent = live.length ? Math.round(totalAge / live.length / 60) : 0;
}
col.addEventListener("click", (e) => {
const ticket = e.target.closest(".ticket");
if (!ticket) return;
const t = tickets.find((x) => x.id === ticket.dataset.id);
if (!t) return;
const action = e.target.closest("[data-action]");
if (action) {
if (action.dataset.action === "bump") t.bumped = true;
if (action.dataset.action === "back") {
t.bumped = false;
t.createdAt = Date.now() - 2 * 60 * 1000;
t.doneSet = new Set();
}
render();
return;
}
const row = e.target.closest("[data-line]");
if (row) {
const i = Number(row.dataset.line);
if (t.doneSet.has(i)) t.doneSet.delete(i);
else t.doneSet.add(i);
render();
}
});
document.getElementById("add").addEventListener("click", () => {
const count = 1 + Math.floor(Math.random() * 2);
const drinks = Array.from({ length: count }, () => {
const o = ALL_OPTIONS[Math.floor(Math.random() * ALL_OPTIONS.length)];
return { qty: 1 + Math.floor(Math.random() * 2), name: o.name, mod: "", flag: o.flag };
});
tickets.push({
id: `b-${Date.now()}`,
table: TABLES[Math.floor(Math.random() * TABLES.length)],
createdAt: Date.now(),
doneSet: new Set(),
bumped: false,
drinks,
});
render();
});
function tickClock() {
const d = new Date();
clockEl.textContent = `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
}
tickClock();
setInterval(tickClock, 20000);
setInterval(refreshAgesAndStats, 1000);
render();<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Inter:wght@500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap"
/>
<link rel="stylesheet" href="style.css" />
<title>Bar · KDS</title>
</head>
<body>
<header class="bar-top">
<div>
<p class="brand-name">Casa Olivar</p>
<p class="brand-tag">Bar · Theo</p>
</div>
<div class="stats">
<span class="stat"><b id="statActive">0</b> open</span>
<span class="stat"><b id="statAvg">0</b>m avg</span>
<span class="stat"><b id="statOver">0</b> over</span>
</div>
<button class="add" type="button" id="add">+ Drink ticket</button>
<span class="clock" id="clock">--:--</span>
</header>
<main class="col" id="col"></main>
<template id="tt">
<article class="ticket">
<header>
<p class="t-table"></p>
<span class="t-age">0:00</span>
</header>
<ul class="drinks"></ul>
<footer>
<button class="back" data-action="back">↶</button>
<button class="bump" data-action="bump">Bump · sent ✓</button>
</footer>
</article>
</template>
<script src="script.js"></script>
</body>
</html>Bar Display
The bartender’s KDS — a single tall column of drink tickets, ordered oldest-first. Each ticket shows table · drink list with quantity and a small icon for ice/garnish flags · a live age timer that turns amber after 4 minutes and red after 7. Tap the green Bump button to clear, ↶ to recall. Stays compact so it fits a 14” under-counter screen.