component "Approval latch" on browser
state approved: u1 = 0 public
view status "Approved" = approved

action approve "Approve" when not approved
  set approved = 1
  ensures locked = approved and not enabled(approve)
end

claim available = enabled(approve) == not shown(status)

page "Approve once and inspect the resulting state."
  main
    h1 "Approval latch"
    p "Approved (0 or 1)"
    read status "0" label "Approved"
    press approve
    p "Reload to start a new instance."
    a "Return to the tutorial" href "/docs/start/"
end
style "main"
  font_family "system-ui, sans-serif"
  max_width "38rem"
  margin "3rem auto"
  padding "0 1.2rem"
end
style "output"
  display "block"
  font "3rem Georgia, serif"
  margin_bottom "1rem"
end
style "button"
  padding ".55rem 1rem"
end
