Commit b52c1b60 authored by James Laver's avatar James Laver Committed by Alexandre Delanoë

Comment extra logging and remove all but one warning from touched modules

parent 5e813179
...@@ -12,26 +12,21 @@ ...@@ -12,26 +12,21 @@
module Gargantext.Components.Annotated.AnnotatedField where module Gargantext.Components.Annotated.AnnotatedField where
import Prelude hiding (div) import Prelude hiding (div)
import Data.Unit (Unit, unit)
import Data.Array (fromFoldable) import Data.Array (fromFoldable)
import Data.Map as Map import Data.Map as Map
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import Data.Lens (Lens', Prism', over, view, lens) import Data.Lens (Lens', lens)
import Data.List as List import Data.List as List
import Data.List (List(..), mapWithIndex, toUnfoldable, sortBy) import Data.List (List(..))
import Data.Ordering (Ordering(..))
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Effect (Effect) import Effect (Effect)
import Effect.Class.Console (log) import Effect.Class.Console (log)
import Effect.Unsafe (unsafePerformEffect) import Effect.Unsafe (unsafePerformEffect)
import React (Children, ReactElement, ReactClass, createElement) import React (ReactElement, ReactClass, createElement)
import React.DOM (a, div, p, span, nav, text) import React.DOM (p, span, text)
import React.DOM.Props (className, onContextMenu) import React.DOM.Props (className, onContextMenu)
import Thermite ( PerformAction, Render, Spec import Thermite (PerformAction, Render, createReactSpec, simpleSpec, writeState)
, defaultPerformAction, createClass, createReactSpec import Gargantext.Types (TermList)
, _render, modifyState, writeState, focus, focusState
, simpleSpec, withState)
import Gargantext.Types (TermList(..))
import Gargantext.Components.NgramsTable (NgramsTable(..), highlightNgrams, termStyle) import Gargantext.Components.NgramsTable (NgramsTable(..), highlightNgrams, termStyle)
import Gargantext.Utils.React (WithChildren) import Gargantext.Utils.React (WithChildren)
import Gargantext.Utils.Selection (getSelection, toString) import Gargantext.Utils.Selection (getSelection, toString)
...@@ -95,7 +90,7 @@ forceRefresh props state = ...@@ -95,7 +90,7 @@ forceRefresh props state =
do wrote <- writeState (compile props) do wrote <- writeState (compile props)
log $ msg wrote log $ msg wrote
pure unit pure unit
where msg = maybe "AnnotatedField: failed to write new state" (const "AnnotatedField: wrote new state") where msg = maybe "AnnotatedField: failed to write new state" (const "AnnotatedField: recompiled")
-- showContextMenu :: PerformAction State Props String -- showContextMenu :: PerformAction State Props String
-- showContextMenu p s = pure unit -- showContextMenu p s = pure unit
...@@ -107,13 +102,11 @@ compile :: Props -> State ...@@ -107,13 +102,11 @@ compile :: Props -> State
compile props = compile props =
unsafePerformEffect $ unsafePerformEffect $
do let ret = { runs: runs props.text, contextMenu: { visible: false } } do let ret = { runs: runs props.text, contextMenu: { visible: false } }
log "Compiling..." -- log "Compiling..."
pure ret pure ret
where runs (Just txt) = highlight props.ngrams txt where runs (Just txt) = highlight props.ngrams txt
runs _ = Nil runs _ = Nil
-- highlightNgrams :: NgramsTable -> String -> Array (Tuple String (Maybe TermList))
highlight :: NgramsTable -> String -> List Run highlight :: NgramsTable -> String -> List Run
highlight n t = List.fromFoldable $ highlightNgrams n t highlight n t = List.fromFoldable $ highlightNgrams n t
...@@ -129,6 +122,8 @@ contextMenuHandler d e = ...@@ -129,6 +122,8 @@ contextMenuHandler d e =
y <- pageY e y <- pageY e
pure $ PageOffset { x, y } pure $ PageOffset { x, y }
_runs :: Lens' State (List Run)
_runs = lens (\a -> a.runs) (\a r -> a { runs = r }) _runs = lens (\a -> a.runs) (\a r -> a { runs = r })
_contextMenu = lens (\a -> a.contextMenu) (\a m -> a { contextMenu = m })
-- _contextMenu :: Lens' State ???
-- _contextMenu = lens (\a -> a.contextMenu) (\a m -> a { contextMenu = m })
module Gargantext.Pages.Corpus.Document where module Gargantext.Pages.Corpus.Document where
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject, (.?), (.??), (:=), (~>)) import Data.Argonaut (class DecodeJson, decodeJson, (.?), (.??))
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Lens (Lens', lens, (?~)) import Data.Lens (Lens', lens, (?~))
import Data.Generic.Rep.Show (genericShow) import Data.Generic.Rep.Show (genericShow)
...@@ -9,11 +9,10 @@ import Data.Map as Map ...@@ -9,11 +9,10 @@ import Data.Map as Map
import Data.Set as Set import Data.Set as Set
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import Data.Either (Either(..))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import React (ReactElement) import React (ReactElement)
import React.DOM (a, button, div, h4, h6, input, li, nav, option, p, select, span, text, ul) import React.DOM (div, h4, li, option, p, span, text, ul)
import React.DOM.Props (_data, _id, _type, aria, className, href, name, onChange, onInput, placeholder, role, style, value) import React.DOM.Props (className, value)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec) import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
import Unsafe.Coerce (unsafeCoerce) import Unsafe.Coerce (unsafeCoerce)
import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Class (lift)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment