From aa4a229fc43e2c0259bd8457f03b39e202189090 Mon Sep 17 00:00:00 2001 From: Paolo Veronelli Date: Sat, 4 Apr 2026 12:45:34 +0100 Subject: [PATCH 1/2] chore: spago.yaml:23-30 --- spago.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spago.yaml b/spago.yaml index 3885fdd..b82ef94 100644 --- a/spago.yaml +++ b/spago.yaml @@ -23,7 +23,7 @@ package: - js-promise - js-promise-aff bundle: - module: Main + module: App.Main outfile: dist/index.js platform: browser type: app From 577613a6e2ef9d9b02065851b25b8ca28947dba1 Mon Sep 17 00:00:00 2001 From: Paolo Veronelli Date: Sat, 4 Apr 2026 12:45:35 +0100 Subject: [PATCH 2/2] chore: src/App/View/Widgets.purs:0-0 --- src/App/View/Widgets.purs | 102 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 src/App/View/Widgets.purs diff --git a/src/App/View/Widgets.purs b/src/App/View/Widgets.purs new file mode 100644 index 0000000..6bf1cca --- /dev/null +++ b/src/App/View/Widgets.purs @@ -0,0 +1,102 @@ +-- | App-specific widgets that depend on Action type. +module App.View.Widgets + ( refreshButton + , copyButton + , hideButton + , launchButton + ) where + +import Prelude + +import Data.Set as Set +import Halogen.HTML as HH +import Halogen.HTML.Core (AttrName(..)) +import Halogen.HTML.Events as HE +import Halogen.HTML.Properties as HP +import App.View.Types (Action(..)) + +-- | Refresh button for a single item. +refreshButton + :: forall w. Action -> HH.HTML w Action +refreshButton action = + HH.button + [ HE.onClick \_ -> action + , HP.class_ (HH.ClassName "btn-hide") + , HP.title "Refresh" + , HP.attr (AttrName "onclick") + "event.stopPropagation()" + ] + [ HH.text "\x21BB" ] + +-- | Copy title to clipboard button. +copyButton + :: forall w. String -> HH.HTML w Action +copyButton text = + HH.button + [ HE.onClick \_ -> CopyText text + , HP.class_ (HH.ClassName "btn-hide") + , HP.title "Copy title" + , HP.attr (AttrName "onclick") + "event.stopPropagation()" + ] + [ HH.text "\x2398" ] + +-- | Hide/unhide toggle button. +hideButton + :: forall w. String -> Boolean -> HH.HTML w Action +hideButton url isHidden = + HH.button + [ HE.onClick \_ -> HideItem url + , HP.class_ (HH.ClassName "btn-hide") + , HP.title + (if isHidden then "Unhide" else "Hide") + ] + [ HH.text + (if isHidden then "\x25C9" else "\x25CC") + ] + +-- | Launch/detach/stop buttons for an issue agent. +launchButton + :: forall w + . Set.Set String + -> String + -> String + -> Int + -> Array (HH.HTML w Action) +launchButton launched toggleKey repoName issueNum = + let + key = repoName <> "#" <> show issueNum + isActive = Set.member key launched + in + if isActive then + [ HH.button + [ HE.onClick \_ -> + DetachAgent repoName issueNum + , HP.class_ (HH.ClassName "btn-hide") + , HP.title "Detach terminal" + , HP.attr (AttrName "onclick") + "event.stopPropagation()" + ] + [ HH.text "\x23CF" ] + , HH.button + [ HE.onClick \_ -> + StopAgent repoName issueNum + , HP.class_ (HH.ClassName "btn-hide") + , HP.title "Stop agent" + , HP.attr (AttrName "onclick") + "event.stopPropagation()" + ] + [ HH.text "\x23F9" ] + ] + else + [ HH.button + [ HE.onClick \_ -> + LaunchAgent toggleKey repoName + issueNum + , HP.class_ (HH.ClassName "btn-hide") + , HP.title "Launch agent" + , HP.attr (AttrName "onclick") + "event.stopPropagation()" + ] + [ HH.text "\x25B6" ] + ]