yak shaving

This commit is contained in:
Michael Zhang 2024-07-22 14:43:01 -05:00
parent 61dc53cf32
commit 3763a1f062
2 changed files with 9 additions and 6 deletions

View file

@ -16,6 +16,7 @@
h3 { margin: 0; }
table { border-spacing: 0; }
a.cell { text-decoration: none; }
.cell {
display: flex;
flex-direction: column;

View file

@ -34,13 +34,14 @@ let interpColor = {|p|
let viz = { |k, n, cell|
let ratio = $k / $n
let percent = $ratio * 100 | math round --precision 1
let color = if $n == 0 { "gray" } else { do $interpColor $ratio }
let textColor = if $k == $n { "gold" } else { "white" }
let bgColorOpacity = if $k == 0 { 50 } else { 100 }
let bgColor = if ($n == 0 or $k == 0) { "gray" } else { $"color-mix\(in srgb, (do $interpColor $ratio) ($bgColorOpacity)%, transparent\)" }
let textColor = if $k == $n { "gold" } else if $k == 0 { "lightgray" } else { "white" }
let isExercise = $cell.0.section == "Exercise"
let percentStr = $"<small style=\"font-size: 0.7rem\">($percent)%</small>"
$"<div class=\"cell\" style=\"
background-color: ($color);
background-color: ($bgColor);
color: ($textColor);
\">
<span>($k)&nbsp;/&nbsp;($n)</span>
@ -57,15 +58,16 @@ let vizCh = { |n, table|
let percent = ($ratio * 100 | math round --precision 1)
let color = if $n == 0 { "gray" } else { do $interpColor $ratio }
let textColor = if $completed == $total { "gold" } else { "white" }
let url = $"https://git.mzhang.io/school/type-theory/issues/($chapters | get $n)"
$"<div data-ch=\"($n)\" class=\"cell\" style=\"
$"<a data-ch=\"($n)\" class=\"cell\" style=\"
background-color: ($color);
color: ($textColor);
\">
\" href=\"($url)\" target=\"_blank\">
<h3>($n)</h3>
<small>($completed) / ($total)</small>
<small style=\"font-size: 0.5rem;\">($percent)%</small>
</div>" | str replace -a "\n" ""
</a>" | str replace -a "\n" ""
}
let vizChapter = { |n|