From 60de54c981f088e948a4f00e6afb4640d43edc24 Mon Sep 17 00:00:00 2001 From: David Ogborn Date: Tue, 3 Oct 2023 11:28:06 -0400 Subject: [PATCH] available audio samples can be inspected on new Resources tab of settings pane --- client/src/Estuary/Types/Term.hs | 5 ++++- client/src/Estuary/Widgets/AudioMap.hs | 2 ++ client/src/Estuary/Widgets/Reflex.hs | 2 +- client/src/Estuary/Widgets/Sidebar.hs | 5 ++++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/client/src/Estuary/Types/Term.hs b/client/src/Estuary/Types/Term.hs index eb5b12b3..60bafa4c 100644 --- a/client/src/Estuary/Types/Term.hs +++ b/client/src/Estuary/Types/Term.hs @@ -54,7 +54,8 @@ data Term = TerminalViewCommands | Voices | AddATitle | - Tap + Tap | + Resources deriving (Show,Eq) translate :: Term -> Language -> Text @@ -226,4 +227,6 @@ translate Voices English = "voices" translate Tap English = "Tap" +translate Resources English = "Resources" + translate x _ = translate x English diff --git a/client/src/Estuary/Widgets/AudioMap.hs b/client/src/Estuary/Widgets/AudioMap.hs index 6f6514c8..77eb0148 100644 --- a/client/src/Estuary/Widgets/AudioMap.hs +++ b/client/src/Estuary/Widgets/AudioMap.hs @@ -11,9 +11,11 @@ import TextShow import Data.List (nub) import Data.Tuple.Select import Control.Monad.Fix (MonadFix) +import Control.Monad.IO.Class import Estuary.Widgets.W import Estuary.Resources.LocMap +import Estuary.Widgets.Reflex (traceDynamic) audioMapWidget :: (Reflex t, Monad m, MonadFix m, Adjustable t m, PostBuild t m, MonadHold t m, DomBuilder t m) => W t m () diff --git a/client/src/Estuary/Widgets/Reflex.hs b/client/src/Estuary/Widgets/Reflex.hs index f4b487cc..c156c4da 100644 --- a/client/src/Estuary/Widgets/Reflex.hs +++ b/client/src/Estuary/Widgets/Reflex.hs @@ -525,7 +525,7 @@ traceDynamic msg x = do let u = traceEvent msg (updated x) holdDyn i u -traceDynamicWith :: (MonadIO m, Reflex t, MonadSample t m, MonadHold t m, Show a) => (a -> String) -> Dynamic t a -> m (Dynamic t a) +traceDynamicWith :: (MonadIO m, Reflex t, MonadSample t m, MonadHold t m) => (a -> String) -> Dynamic t a -> m (Dynamic t a) traceDynamicWith f x = do i <- sample $ current x let i' = f i diff --git a/client/src/Estuary/Widgets/Sidebar.hs b/client/src/Estuary/Widgets/Sidebar.hs index 97783714..6231e800 100644 --- a/client/src/Estuary/Widgets/Sidebar.hs +++ b/client/src/Estuary/Widgets/Sidebar.hs @@ -9,6 +9,7 @@ import Estuary.Widgets.W import Estuary.Widgets.Reflex import Estuary.Widgets.Reference import Estuary.Widgets.Config +import Estuary.Widgets.AudioMap import Estuary.Types.Term import Estuary.Types.RenderInfo @@ -16,6 +17,8 @@ sidebarWidget :: MonadWidget t m => W t m () sidebarWidget = do referenceEvent <- fmap (1 <$) $ clickableDiv "sidebar-tab" $ (dynText =<< term Reference) configEvent <- fmap (2 <$) $ clickableDiv "sidebar-tab" $ (dynText =<< term Settings) - curPage <- holdDyn 1 $ leftmost [referenceEvent,configEvent] + resourcesEvent <- fmap (3 <$) $ clickableDiv "sidebar-tab" $ (dynText =<< term Resources) + curPage <- holdDyn 1 $ leftmost [referenceEvent,configEvent,resourcesEvent] hideableWidget (fmap (==1) curPage) "reference" $ navigation -- Reference panel hideableWidget (fmap (==2) curPage) "config-options" configWidget + hideableWidget (fmap (==3) curPage) "reference" $ audioMapWidget