SET link = COALESCE($link, 'https://shandan.one/'||$tool);
SELECT 'text' AS component
, '<div class="pure-g" sty>
  <div class="pure-u-1">
    <div class="pure-button" style="margin: 1em 0 0; background: '||$color||';">
      <a href="'||$link||'" style="color: floralwhite;">'||$link||'</a>
    </div>
  </div>
</div>' AS html
;

SET inner = CASE $hash IS NULL
  WHEN TRUE THEN $tool||'/form.sql'
  ELSE 'sqlpage/validate.sql'
END;
SELECT 'dynamic' AS component, sqlpage.run_sql($inner) AS properties;