Merge branch 'impl/perfectdraft-card'

This commit is contained in:
2026-04-18 19:07:50 +02:00
4 changed files with 47 additions and 15 deletions
+19 -6
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -25,6 +25,7 @@ const CATALOG: BeerEntry[] = [
{ slug: "leffe-ruby", name: "Leffe Ruby", brewery: "Abbaye de Leffe", style: "Belgian Fruit Beer", abv: 5.0, colors: { primary: "#8B1A4A", secondary: "#FFE6F0", text: "#FFFFFF" }, imagePath: kegImage("leffe-ruby") },
{ slug: "leffe-blanche", name: "Leffe Blanche", brewery: "Abbaye de Leffe", style: "Belgian Witbier", abv: 5.0, colors: { primary: "#E8DCC8", secondary: "#FFFDF5", text: "#2C2C2C" }, imagePath: kegImage("leffe-blanche") },
{ slug: "leffe-winter", name: "Leffe Winter", brewery: "Abbaye de Leffe", style: "Belgian Winter Ale", abv: 6.6, colors: { primary: "#1B3A5C", secondary: "#E0ECF8", text: "#FFFFFF" }, imagePath: kegImage("leffe-winter") },
{ slug: "leffe-noel", name: "Leffe Noël", brewery: "Abbaye de Leffe", style: "Belgian Winter Ale", abv: 6.6, colors: { primary: "#1B3A5C", secondary: "#E0ECF8", text: "#FFFFFF" }, imagePath: kegImage("leffe-winter") },
{ slug: "leffe-dete", name: "Leffe d'Été", brewery: "Abbaye de Leffe", style: "Belgian Summer Ale", abv: 5.2, colors: { primary: "#F5C242", secondary: "#FFFBE6", text: "#1A0F00" }, imagePath: kegImage("leffe-dete") },
{ slug: "leffe-rituel", name: "Leffe Rituel 9°", brewery: "Abbaye de Leffe", style: "Belgian Strong Ale", abv: 9.0, colors: { primary: "#2C1A00", secondary: "#F5E6D0", text: "#C8922A" }, imagePath: kegImage("leffe-rituel") },
{ slug: "leffe-prestige", name: "Leffe Prestige 1240", brewery: "Abbaye de Leffe", style: "Belgian Strong Blonde", abv: 8.5, colors: { primary: "#1A3366", secondary: "#E0E8F5", text: "#C8922A" }, imagePath: kegImage("leffe-prestige") },
+1 -1
View File
@@ -5,7 +5,7 @@ import type { PerfectDraftCardConfig } from "./types.js";
import { GLASS_SIZES, DEFAULT_GLASS_SIZE, DOMAIN } from "./const.js";
import { getAllBeers } from "./beer-catalog.js";
const EDITOR_VERSION = "0.1.0-b2";
const EDITOR_VERSION = "0.1.2";
interface DiscoveredDevice {
deviceId: string;
+26 -8
View File
@@ -224,12 +224,21 @@ export class PerfectDraftCard extends LitElement {
}
private _renderEmojiGrid(count: number): TemplateResult {
if (count === 0) {
return html`<div class="emoji-grid" style="font-size: 3em; opacity: 0.3;">🍺</div>`;
const maxGlasses = Math.floor(KEG_TOTAL_VOLUME_ML / this._glassSize);
const cols = maxGlasses <= 10 ? 5 : 6;
const size = maxGlasses <= 10 ? 3.2 : maxGlasses <= 12 ? 2.8 : maxGlasses <= 18 ? 2.4 : 2;
const slots = [];
for (let i = 0; i < maxGlasses; i++) {
slots.push(i < count
? html`<span class="glass full">🍺</span>`
: html`<span class="glass empty">🍺</span>`
);
}
const size = count <= 5 ? 4 : count <= 10 ? 3 : count <= 18 ? 2.2 : 1.8;
const emojis = "🍺".repeat(count);
return html`<div class="emoji-grid" style="font-size: ${size}em;">${emojis}</div>`;
return html`
<div class="emoji-grid" style="grid-template-columns: repeat(${cols}, 1fr); font-size: ${size}em;">
${slots}
</div>
`;
}
private _renderEmptyKeg(): TemplateResult {
@@ -447,12 +456,21 @@ export class PerfectDraftCard extends LitElement {
/* === KEG EMOJI GRID === */
.emoji-grid {
text-align: center;
line-height: 1.25;
word-break: break-all;
display: grid;
gap: 2px;
justify-items: center;
align-items: center;
max-width: 100%;
padding: 0 8px;
}
.glass {
line-height: 1;
text-align: center;
}
.glass.empty {
opacity: 0.15;
filter: grayscale(1);
}
.count-label {
margin-top: 12px;
font-size: 1.1em;