Files
Bookworm/web/templates/index.html
T
2026-04-10 21:42:56 +08:00

91 lines
2.5 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Bookworm Solver</title>
<link rel="stylesheet" href="/static/styles.css" />
</head>
<body>
<main class="shell">
<section class="hero">
<p class="eyebrow">Golang word finder</p>
<h1>Bookworm-style solver</h1>
<p class="lede">
Type the letters you have, and the app ranks the strongest words it
can build from them.
</p>
</section>
<section class="panel search-panel">
<form class="search-form" method="GET" action="/">
<label>
<span>Letters</span>
<input
name="letters"
type="text"
value="{{.Letters}}"
placeholder="example: triangle"
autocomplete="off"
/>
</label>
<label>
<span>Minimum length</span>
<input
name="min"
type="number"
min="2"
max="12"
value="{{.MinLength}}"
/>
</label>
<button type="submit">Find best word</button>
</form>
<p class="hint">
Scoring favors both valuable letters and longer words. Add more words
later with <strong>words/words.txt</strong>.
</p>
</section>
{{if .Error}}
<section class="panel message-panel">
<p class="message">{{.Error}}</p>
</section>
{{end}} {{if .Best}}
<section class="results-grid">
<article class="panel best-card">
<p class="card-label">Best word</p>
<h2>{{.Best.Word}}</h2>
<div class="stats">
<span>Score {{.Best.Score}}</span>
<span>{{.Best.Length}} letters</span>
</div>
</article>
<article class="panel results-card">
<div class="results-header">
<h3>Other strong matches</h3>
<p>Top ranked alternatives from the same letter set.</p>
</div>
<ul class="results-list">
<li>
<span>{{.Best.Word}}</span>
<span>{{.Best.Score}}</span>
</li>
{{range .Results}}
<li>
<span>{{.Word}}</span>
<span>{{.Score}}</span>
</li>
{{end}}
</ul>
</article>
</section>
{{end}}
</main>
</body>
</html>