| from __future__ import annotations | |
| from .genome import Genome | |
| def genome_card_html(g: Genome, *, compact: bool = False) -> str: | |
| parts = ", ".join(f"{p.count}× {p.kind}" if p.count > 1 else p.kind for p in g.parts) | |
| # Compact variant for the Splice Bench: name + one parts line only. Dropping the | |
| # traits list and story keeps both A/B cards a fixed short height so the two | |
| # columns (and the Tweak/Apply rows below them) stay symmetric. The palette | |
| # swatches were removed from the reveal card (visual clutter under the name). | |
| if compact: | |
| return (f'<div class="buddy-genome-card is-compact"><h3>{g.name}</h3>' | |
| f'<p class="buddy-genome-parts">{parts}</p></div>') | |
| traits = "".join(f"<li>{t}</li>" for t in g.traits) | |
| return (f'<div class="buddy-genome-card"><h3>{g.name}</h3>' | |
| f'<p class="buddy-genome-parts">{parts}</p>' | |
| f'<ul class="buddy-genome-traits">{traits}</ul>' | |
| f'<p class="buddy-genome-story">{g.story}</p></div>') | |
| def share_text(g: Genome) -> str: | |
| return (f"I spliced {g.name} in Hatchimera — " | |
| f"{', '.join(p.kind for p in g.parts)}. {g.story} #BuildSmallHackathon") | |