SET ":view" = COALESCE(:content, '') <> '' AND COALESCE(:action, '') <> ('Edit as New');
SELECT 'button' AS component;
SELECT 'Open' AS title
, 1 AS width
, '/clip.sql?action=open' AS link
;
SELECT 'New' AS title
, 1 AS width
, 'gray-500' AS color
, '/clip.sql' AS link
;

SELECT 'form' AS component
, '/clip.sql' AS action
, CASE :view WHEN TRUE THEN 'Edit as New' ELSE 'Paste' END AS validate
, :tabler_color AS validate_color
, 'post' AS method
;
SELECT 'Paste' AS value
, '' AS label
, 'hidden' type
, 'action' AS name
WHERE NOT :view
;
SELECT 'Edit as New' AS value
, '' AS label
, 'hidden' AS type
, 'action' AS name
WHERE :view
;
SELECT :hash AS value
, '' AS label
, 'hidden' AS type
, 'hash' AS name
WHERE :view
;
SELECT 'Paste something here...' AS placeholder
, 'content' AS name
, 'textarea' AS type
, '' AS label
, :view AS disabled
, CASE COALESCE(:action, '')
  WHEN 'New' THEN NULL
  ELSE :content
END AS value
;