diff --git a/src/Gargantext/Components/GraphExplorer/DecodeMaybe.js b/src/Gargantext/Components/GraphExplorer/DecodeMaybe.js deleted file mode 100644 index 1f88a9e0d9c03b3af2daa0127e5949016108f951..0000000000000000000000000000000000000000 --- a/src/Gargantext/Components/GraphExplorer/DecodeMaybe.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -exports.isNull = function(v) { - return v === null; -}; diff --git a/src/Gargantext/Components/GraphExplorer/DecodeMaybe.purs b/src/Gargantext/Components/GraphExplorer/DecodeMaybe.purs deleted file mode 100644 index bb2c61e2fdc07ada1bff4155839a0f5a1edf08de..0000000000000000000000000000000000000000 --- a/src/Gargantext/Components/GraphExplorer/DecodeMaybe.purs +++ /dev/null @@ -1,17 +0,0 @@ -module GraphExplorer.DecodeMaybe where - -import Prelude - -import Data.Argonaut (class DecodeJson, JObject, getFieldOptional) -import Data.Either (Either) -import Data.Maybe (Maybe(..)) - -foreign import isNull :: forall a. a -> Boolean - -getFieldOptional' :: forall a. DecodeJson a => JObject -> String -> Either String (Maybe a) -getFieldOptional' o s = (case _ of - Just v -> if isNull v then Nothing else v - Nothing -> Nothing - ) <$> (getFieldOptional o s) - -infix 7 getFieldOptional' as .?| diff --git a/src/Gargantext/Components/GraphExplorer/Types.purs b/src/Gargantext/Components/GraphExplorer/Types.purs index 52cd21eaa84704802244bb37476e38a6085e5ae0..c33562533066320098ba98356ea3a57287a3c6e5 100644 --- a/src/Gargantext/Components/GraphExplorer/Types.purs +++ b/src/Gargantext/Components/GraphExplorer/Types.purs @@ -1,4 +1,4 @@ -module GraphExplorer.Types where +module Gargantext.Components.GraphExplorer.Types where import Prelude diff --git a/src/Gargantext/Components/Lang/Data/Landing.purs b/src/Gargantext/Components/Lang/Data/Landing.purs index 183a3e6f7f0badcb948a10c1557fbf3f42ef676b..ee9b9f10685007d171b2e0ef75165658b1bd01ce 100644 --- a/src/Gargantext/Components/Lang/Data/Landing.purs +++ b/src/Gargantext/Components/Lang/Data/Landing.purs @@ -1,5 +1,4 @@ -module Gargantext.Data.Landing - where +module Gargantext.Components.Data.Landing where data LandingData = LandingData { name :: String @@ -24,4 +23,3 @@ data Button = Button { title :: String , text :: String , href :: String } - diff --git a/src/Gargantext/Components/Lang/Data/Lang.purs b/src/Gargantext/Components/Lang/Data/Lang.purs index 0837a907fc97b394d47e59fc6d002d99abdd30bd..90e26f49b716284c5623c2bef6cd7c465f81fc89 100644 --- a/src/Gargantext/Components/Lang/Data/Lang.purs +++ b/src/Gargantext/Components/Lang/Data/Lang.purs @@ -1,4 +1,3 @@ -module Gargantext.Data.Lang - where +module Gargantext.Components.Data.Lang where data Lang = EN | FR diff --git a/src/Gargantext/Components/Lang/Landing/EnUS.purs b/src/Gargantext/Components/Lang/Landing/EnUS.purs index 151c653854d9550c12e168380ffc8edbc28d1e44..714d6f45acf7ff3b61a4bdfdccd5b734bceafbd8 100644 --- a/src/Gargantext/Components/Lang/Landing/EnUS.purs +++ b/src/Gargantext/Components/Lang/Landing/EnUS.purs @@ -1,7 +1,6 @@ -module Gargantext.Lang.Landing.EnUS - where +module Gargantext.Components.Lang.Landing.EnUS where -import Gargantext.Data.Landing +import Gargantext.Components.Data.Landing landingData :: LandingData landingData = LandingData { name : "Gargantext" @@ -18,7 +17,7 @@ blockTexts = [ BlockText { title : "Random sentences in Gargantua's Books chapte , icon : "fas fa-random" , titleText : "Historic" , text : "Chapter 1.XV. How Gargantua was put under other schoolmasters. Chapter 2.XXII. How Panurge served a Parisian lady a trick that pleased her not very well. Chapter 3.XXXVII. How Pantagruel persuaded Panurge to take counsel of a fool. Chapter 4.LXI. How Gaster invented means to get and preserve corn. Chapter 5.XXXVIII. Of the temple's admirable pavement." - , docButton : Button { title : "Your first map in less than 5 minutes" + , docButton : Button { title : "Your first map in less than 5 minutes" , text : " Documentation" , href : "https://iscpif.fr/gargantext/your-first-map/" } @@ -28,7 +27,7 @@ blockTexts = [ BlockText { title : "Random sentences in Gargantua's Books chapte , icon : "fas fa-random" , titleText : "Presentation" , text : "Autem nascetur iaculis, sedfusce enimsed cursus posuere consectetuer eu justo aliquammauris. Phasellus vero nisi porttitor elit quod, leo feliscras ultricies non tempor sagittis. Liberoduis facilisinam erat dapibusnam, lacus dui duis tristique volutpatut quis vestibulum magna. Nobis faucibusvestibulum dolores minim. Bibendumin malesuada adipiscing ante, mattis fames nequeetiam lorem. No diam id. Litora quisaenean commodo lobortisetiam neque, libero mollis scelerisque inceptos ullamcorper sea congue delenit possim." - , docButton : Button { title : "Your first map in less than 5 minutes" + , docButton : Button { title : "Your first map in less than 5 minutes" , text : " Documentation" , href : "https://iscpif.fr/gargantext/your-first-map/" } @@ -38,11 +37,9 @@ blockTexts = [ BlockText { title : "Random sentences in Gargantua's Books chapte , icon : "fas fa-random" , titleText : "Tutoreil" , text : "Il paraît que l'rdore des lettres dans un mot n'a pas d'imtraopnce. La première et la dernière lettre doeivnt être à la bonne place. Le reste peut être dans un désordre total et on peut touojurs lire sans prolèbme. On ne lit donc pas chaque lettre en ellêem-me, mais le mot comme un tout. Un chaegmnent de référentiel et nous tranpossons ce résultat au texte luimê-me: l'rdore des mots est failbement important copamré au contexte du texte qui, lui, est copmté: comptexter avec Gargantext." - , docButton : Button { title : "Your first map in less than 5 minutes" + , docButton : Button { title : "Your first map in less than 5 minutes" , text : " Documentation" , href : "https://iscpif.fr/gargantext/your-first-map/" } } ] - - diff --git a/src/Gargantext/Components/Lang/Landing/FrFR.purs b/src/Gargantext/Components/Lang/Landing/FrFR.purs index bfb36986262948c996ad3c74069eee3affa95971..544dd8b9092352184a26fbf15ec8dfea069988a9 100644 --- a/src/Gargantext/Components/Lang/Landing/FrFR.purs +++ b/src/Gargantext/Components/Lang/Landing/FrFR.purs @@ -1,7 +1,6 @@ -module Gargantext.Lang.Landing.FrFR - where +module Gargantext.Components.Lang.Landing.FrFR where -import Gargantext.Data.Landing +import Gargantext.Components.Data.Landing landingData :: LandingData landingData = LandingData { name : "Gargantext" @@ -18,7 +17,7 @@ blockTexts = [ BlockText { title : "Phrases aléatoires issues de l'oeuvre de Fr , icon : "fas fa-random" , titleText : "Historique" , text : "Chapitre 1" - , docButton : Button { title : "Your first map in less than 5 minutes" + , docButton : Button { title : "Your first map in less than 5 minutes" , text : " Documentation" , href : "https://iscpif.fr/gargantext/your-first-map/" } @@ -28,7 +27,7 @@ blockTexts = [ BlockText { title : "Phrases aléatoires issues de l'oeuvre de Fr , icon : "fas fa-random" , titleText : "Presentation" , text : "Autem nascetur iaculis, sedfusce enimsed cursus posuere consectetuer eu justo aliquammauris. Phasellus vero nisi porttitor elit quod, leo feliscras ultricies non tempor sagittis. Liberoduis facilisinam erat dapibusnam, lacus dui duis tristique volutpatut quis vestibulum magna. Nobis faucibusvestibulum dolores minim. Bibendumin malesuada adipiscing ante, mattis fames nequeetiam lorem. No diam id. Litora quisaenean commodo lobortisetiam neque, libero mollis scelerisque inceptos ullamcorper sea congue delenit possim." - , docButton : Button { title : "Your first map in less than 5 minutes" + , docButton : Button { title : "Your first map in less than 5 minutes" , text : " Documentation" , href : "https://iscpif.fr/gargantext/your-first-map/" } @@ -38,11 +37,9 @@ blockTexts = [ BlockText { title : "Phrases aléatoires issues de l'oeuvre de Fr , icon : "fas fa-random" , titleText : "Tutoreil" , text : "Il paraît que l'rdore des lettres dans un mot n'a pas d'imtraopnce. La première et la dernière lettre doeivnt être à la bonne place. Le reste peut être dans un désordre total et on peut touojurs lire sans prolèbme. On ne lit donc pas chaque lettre en ellêem-me, mais le mot comme un tout. Un chaegmnent de référentiel et nous tranpossons ce résultat au texte luimê-me: l'rdore des mots est failbement important copamré au contexte du texte qui, lui, est copmté: comptexter avec Gargantext." - , docButton : Button { title : "Your first map in less than 5 minutes" + , docButton : Button { title : "Your first map in less than 5 minutes" , text : " Documentation" , href : "https://iscpif.fr/gargantext/your-first-map/" } } ] - - diff --git a/src/Gargantext/Components/Login.purs b/src/Gargantext/Components/Login.purs index c6622f7995951e03edbdce1ee6b73b40f0f02958..b6856ce77f65e51532cafac211979f64fb279453 100644 --- a/src/Gargantext/Components/Login.purs +++ b/src/Gargantext/Components/Login.purs @@ -1,11 +1,10 @@ -module Login where +module Gargantext.Components.Login where import Prelude hiding (div) import Control.Monad.Aff (Aff, attempt) import Control.Monad.Aff.Class (liftAff) import Control.Monad.Aff.Console (log) -import Control.Monad.Cont.Trans (lift) import Control.Monad.Eff (Eff) import Control.Monad.Eff.Class (liftEff) import Control.Monad.Eff.Console (CONSOLE) @@ -19,19 +18,17 @@ import Data.HTTP.Method (Method(..)) import Data.Lens (over) import Data.Maybe (Maybe(..)) import Data.MediaType.Common (applicationJSON) -import Modal (modalHide) +import Gargantext.Components.Modals.Modal (modalHide) import Network.HTTP.Affjax (AJAX, affjax, defaultRequest) import Network.HTTP.RequestHeader (RequestHeader(..)) import React.DOM (a, button, div, h2, h4, h5, i, input, label, p, span, text) import React.DOM.Props (_data, _id, _type, aria, className, href, maxLength, name, onClick, onInput, placeholder, role, target, value) -import Routing.Hash.Aff (setHash) import Thermite (PerformAction, Render, Spec, _render, modifyState, simpleSpec) import Unsafe.Coerce (unsafeCoerce) -- TODO: ask for login (modal) or account creation after 15 mn when user is not logged and has made one search at least - newtype State = State { username :: String , password :: String diff --git a/src/Gargantext/Components/Modals/Modal.purs b/src/Gargantext/Components/Modals/Modal.purs index fc5fc520a6d21330b996561ab597ee497d5a07d2..365df0757046f449babdb46a03d36b12284dc887 100644 --- a/src/Gargantext/Components/Modals/Modal.purs +++ b/src/Gargantext/Components/Modals/Modal.purs @@ -1,4 +1,4 @@ -module Modal where +module Gargantext.Components.Modals.Modal where import Control.Monad.Eff (Eff) import Prelude (Unit) diff --git a/src/Gargantext/Components/RandomText.purs b/src/Gargantext/Components/RandomText.purs index 32c0ebeec67bd85a71bc4190d6d85a0631a1f87c..8e53b9e9b73b9adda80b226a54838776fe17ecfc 100644 --- a/src/Gargantext/Components/RandomText.purs +++ b/src/Gargantext/Components/RandomText.purs @@ -17,27 +17,18 @@ randomChars : randomizes chars in a word. TODO: add some tests as examples. -} -module Gargantext.RandomText where +module Gargantext.Components.RandomText where import Prelude -import Control.Monad.Eff (Eff(..)) -import Control.Monad.Eff.Random (RANDOM(..), randomInt) - +import Control.Monad.Eff (Eff) +import Control.Monad.Eff.Random (RANDOM, randomInt) +import Data.Array (drop, dropEnd, filter, foldl, head, length, tail, take, takeEnd, (!!)) import Data.Maybe (Maybe(Nothing, Just), fromJust) -import Data.Array ( length, (!!), filter, foldl - , head, tail - , take, takeEnd - , drop, dropEnd - ) -import Data.String ( toCharArray, fromCharArray - , split, Pattern(..) - ) -import Data.Tuple.Nested ((/\)) - +import Data.String (Pattern(..), fromCharArray, split, toCharArray) import Partial (crash) import Partial.Unsafe (unsafePartial) -import Unsafe.Coerce (unsafeCoerce) + ------------------------------------------------------------------- randomSentences :: forall a. String -> Eff ( random :: RANDOM | a ) String @@ -81,11 +72,11 @@ randomPart array = randomArrayPoly middle >>= \(middle') -> pure ( start <> midd randomArrayPoly :: forall a b. Array a -> Eff ( random :: RANDOM | b ) (Array a) randomArrayPoly wheel = case head wheel of Nothing -> pure [] - Just wheel' -> randomWheel (RandomWheel { before:wheel, during:wheel', after:[]}) + Just wheel' -> randomWheel (RandomWheel { before:wheel, during:wheel', after:[]}) >>= \(RandomWheel rand) -> (pure rand.after) randomWheel :: forall a b. RandomWheel b -> Eff ( random :: RANDOM | a ) (RandomWheel b) -randomWheel (RandomWheel {before:[], during:d, after:a}) = +randomWheel (RandomWheel {before:[], during:d, after:a}) = pure (RandomWheel {before:[], during:d, after:a}) randomWheel (RandomWheel {before:b, during:d, after:a}) = do @@ -93,7 +84,7 @@ randomWheel (RandomWheel {before:b, during:d, after:a}) = do randomWheel $ RandomWheel {before:b', during:d', after:(a <> [d'])} -randomArray :: forall a b. Array b -> Eff ( random :: RANDOM | a ) (RandomWheel b) +randomArray :: forall a b. Array b -> Eff ( random :: RANDOM | a ) (RandomWheel b) randomArray array = unsafePartial $ do n <- randomInt 0 (length array - 1) diff --git a/src/Gargantext/Components/Tab.purs b/src/Gargantext/Components/Tab.purs index addf2287c763281498d78c1f82cc4705eb0bf820..a314e68aa26c8a6c9b9d5fc014be46dfba23aaa2 100644 --- a/src/Gargantext/Components/Tab.purs +++ b/src/Gargantext/Components/Tab.purs @@ -1,4 +1,4 @@ -module Tab where +module Gargantext.Components.Tab where import Data.Array (fold) import Data.Lens (Lens', Prism', over, view) diff --git a/src/Gargantext/Components/Tree.purs b/src/Gargantext/Components/Tree.purs index 2576e6b025ef5a7cb5ed368dcb7f21ce7b6ac219..ca0110eabde8240f969611d74a0cd4fb738e91f4 100644 --- a/src/Gargantext/Components/Tree.purs +++ b/src/Gargantext/Components/Tree.purs @@ -1,4 +1,4 @@ -module NTree where +module Gargantext.Components.Tree where import Prelude hiding (div) diff --git a/src/Gargantext/Config/REST.purs b/src/Gargantext/Config/REST.purs index 7589699bf7a364b64eb10a45cf4f63b918430659..1c96fb4a2ef100f07cbe64088b03690ac9910017 100644 --- a/src/Gargantext/Config/REST.purs +++ b/src/Gargantext/Config/REST.purs @@ -1,4 +1,4 @@ -module Gargantext.REST where +module Gargantext.Config.REST where import Data.Argonaut import Data.HTTP.Method (Method(..)) diff --git a/src/Gargantext/Navigation.purs b/src/Gargantext/Navigation.purs index 7a7b70043d4e7739faf1c9a1140afc7b5f4801a6..335d282c53d714afda71a74d7d69eb48e1d22f7c 100644 --- a/src/Gargantext/Navigation.purs +++ b/src/Gargantext/Navigation.purs @@ -1,46 +1,38 @@ -module Navigation where +module Gargantext.Navigation where -import DOM -import Gargantext.Data.Lang import Prelude hiding (div) - import AddCorpusview as AC -import DocAnnotation as D import Control.Monad.Cont.Trans (lift) -import Control.Monad.Eff (Eff) import Control.Monad.Eff.Class (liftEff) import Control.Monad.Eff.Console (CONSOLE, log) import CorpusAnalysis as CA -import Data.Array (concat, head, length) +import DOM (DOM) +import Data.Array (length) import Data.Either (Either(..)) import Data.Foldable (fold, intercalate) import Data.Lens (Lens', Prism', lens, over, prism) -import Data.Maybe (Maybe(Nothing, Just), fromJust) -import Data.Tuple (Tuple(..)) +import Data.Maybe (Maybe(Nothing, Just)) +import DocAnnotation as D import DocView as DV +import Gargantext.Components.Tree as Tree +import Gargantext.Dashboard as Dsh +import Gargantext.Components.Data.Lang (Lang(..)) +import Gargantext.Router (Routes(..)) +import Gargantext.Users as U +import Graph as GE import Landing as L -import Login as LN -import Modal (modalShow) -import NTree (fnTransform, loadDefaultNode) -import NTree as NT +import Gargantext.Components.Login as LN +import Gargantext.Components.Modals.Modal (modalShow) import Network.HTTP.Affjax (AJAX) -import PageRouter (Routes(..)) -import Partial.Unsafe (unsafePartial) +import NgramsTable as NG import React (ReactElement) -import React.DOM (a, button, div, footer, form, hr, i, img, input, li, p, span, text, ul) -import React.DOM.Props (Props, _data, _id, _type, aria, className, href, name, onChange, onClick, placeholder, role, src, style, tabIndex, target, title) -import React.DOM.Props as RP -import Routing.Hash.Aff (setHash) +import React.DOM (a, button, div, footer, hr, img, input, li, p, span, text, ul) +import React.DOM.Props (_data, _id, _type, aria, className, href, onChange, onClick, placeholder, role, src, style, tabIndex, target, title) import SearchForm as S import Tabview as TV -import Thermite (PerformAction, Render, Spec, _render, cotransform, defaultPerformAction, defaultRender, focus, modifyState, simpleSpec, withState) +import Thermite (PerformAction, Render, Spec, _render, defaultPerformAction, defaultRender, focus, modifyState, simpleSpec, withState) import Unsafe.Coerce (unsafeCoerce) -import Gargantext.Users as U -import NgramsTable as NG -import Gargantext.Dashboard as Dsh -import Graph as GE - type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e) @@ -53,7 +45,7 @@ type AppState = , searchState :: S.State , userPage :: U.State , docAnnotationView :: D.State - , ntreeView :: NT.State + , ntreeView :: Tree.State , tabview :: TV.State , search :: String , corpusAnalysis :: CA.State @@ -75,7 +67,7 @@ initAppState = , searchState : S.initialState , userPage : U.initialState , docAnnotationView : D.initialState - , ntreeView : NT.exampleTree + , ntreeView : Tree.exampleTree , tabview : TV.initialState , search : "" , corpusAnalysis : CA.initialState @@ -97,7 +89,7 @@ data Action | SearchA S.Action | UserPageA U.Action | DocAnnotationViewA D.Action - | TreeViewA NT.Action + | TreeViewA Tree.Action | TabViewA TV.Action | GraphExplorerA GE.Action | DashboardA Dsh.Action @@ -123,12 +115,10 @@ performAction (ShowLogin) _ _ = void do liftEff $ modalShow "loginModal" modifyState $ _ {showLogin = true} - performAction (ShowAddcorpus) _ _ = void do liftEff $ modalShow "addCorpus" modifyState $ _ {showCorpus = true} - performAction Go _ _ = void do liftEff $ modalShow "addCorpus" modifyState $ _ {showCorpus = true} @@ -140,8 +130,8 @@ performAction Initialize _ state = void do case state.initialized of false -> do - lnodes <- lift $ loadDefaultNode - + lnodes <- lift $ Tree.loadDefaultNode + case lnodes of Left err -> do modifyState id @@ -153,19 +143,15 @@ performAction Initialize _ state = void do Right docs -> do modifyState $ _ { initialized = true , ntreeView = if length d > 0 - then NT.exampleTree - --then fnTransform $ unsafePartial $ fromJust $ head d - else NT.initialState + then Tree.exampleTree + --then fnTransform $ unsafePartial $ fromJust $ head d + else Tree.initialState , docViewState = docs } _ -> do modifyState id -performAction Go _ _ = void do - _ <- lift $ setHash "/addCorpus" - modifyState id - performAction _ _ _ = void do modifyState id @@ -179,55 +165,45 @@ _landingAction = prism LandingA \action -> LandingA caction -> Right caction _-> Left action - _loginState :: Lens' AppState LN.State _loginState = lens (\s -> s.loginState) (\s ss -> s{loginState = ss}) - _loginAction :: Prism' Action LN.Action _loginAction = prism LoginA \action -> case action of LoginA caction -> Right caction _-> Left action - _addCorpusState :: Lens' AppState AC.State _addCorpusState = lens (\s -> s.addCorpusState) (\s ss -> s{addCorpusState = ss}) - _addCorpusAction :: Prism' Action AC.Action _addCorpusAction = prism AddCorpusA \action -> case action of AddCorpusA caction -> Right caction _-> Left action - _docViewState :: Lens' AppState DV.State _docViewState = lens (\s -> s.docViewState) (\s ss -> s{docViewState = ss}) - _docViewAction :: Prism' Action DV.Action _docViewAction = prism DocViewA \action -> case action of DocViewA caction -> Right caction _-> Left action - _searchState :: Lens' AppState S.State _searchState = lens (\s -> s.searchState) (\s ss -> s{searchState = ss}) - _searchAction :: Prism' Action S.Action _searchAction = prism SearchA \action -> case action of SearchA caction -> Right caction _-> Left action - _userPageState :: Lens' AppState U.State _userPageState = lens (\s -> s.userPage) (\s ss -> s{userPage = ss}) - _userPageAction :: Prism' Action U.Action _userPageAction = prism UserPageA \action -> case action of @@ -243,29 +219,24 @@ _dashBoardAction = prism DashboardA \action -> _docAnnotationViewState :: Lens' AppState D.State _docAnnotationViewState = lens (\s -> s.docAnnotationView) (\s ss -> s{docAnnotationView = ss}) - _docAnnotationViewAction :: Prism' Action D.Action _docAnnotationViewAction = prism DocAnnotationViewA \action -> case action of DocAnnotationViewA caction -> Right caction _-> Left action - -_treeState :: Lens' AppState NT.State +_treeState :: Lens' AppState Tree.State _treeState = lens (\s -> s.ntreeView) (\s ss -> s {ntreeView = ss}) - -_treeAction :: Prism' Action NT.Action +_treeAction :: Prism' Action Tree.Action _treeAction = prism TreeViewA \action -> case action of TreeViewA caction -> Right caction _-> Left action - _tabviewState :: Lens' AppState TV.State _tabviewState = lens (\s -> s.tabview) (\s ss -> s {tabview = ss}) - _tabviewAction :: Prism' Action TV.Action _tabviewAction = prism TabViewA \action -> case action of @@ -293,8 +264,6 @@ _graphExplorerAction = prism GraphExplorerA \action -> GraphExplorerA caction -> Right caction _-> Left action - - _ngState :: Lens' AppState NG.State _ngState = lens (\s -> s.ngState) (\s ss -> s{ngState = ss}) @@ -304,7 +273,6 @@ _ngAction = prism NgramsA \action -> NgramsA caction -> Right caction _-> Left action - pagesComponent :: forall props eff. AppState -> Spec (E eff) AppState props Action pagesComponent s = case s.currentRoute of @@ -337,7 +305,6 @@ pagesComponent s = routingSpec :: forall props eff. Spec (ajax :: AJAX, console :: CONSOLE, dom :: DOM |eff) AppState props Action routingSpec = simpleSpec performAction defaultRender - layout0 :: forall eff props. Spec (E eff) AppState props Action -> Spec (E eff) AppState props Action layout0 layout = @@ -362,7 +329,7 @@ layout0 layout = cont = over _render \render d p s c -> [ div [ className "row" ] (render d p s c) ] - as = focus _treeState _treeAction NT.treeview + as = focus _treeState _treeAction Tree.treeview bs = innerLayout $ layout @@ -394,7 +361,6 @@ layoutSidebar = over _render \render d p s c -> ] - divLogo :: ReactElement divLogo = a [ className "navbar-brand logoSmall" , href "#/" @@ -403,7 +369,6 @@ divLogo = a [ className "navbar-brand logoSmall" ] [] ] - divDropdownLeft :: ReactElement divDropdownLeft = divDropdownLeft' (LiNav { title : "About Gargantext" , href : "#" @@ -412,7 +377,6 @@ divDropdownLeft = divDropdownLeft' (LiNav { title : "About Gargantext" } ) - divDropdownLeft' :: LiNav -> ReactElement divDropdownLeft' mb = ul [className "nav navbar-nav"] [ ul [className "nav navbar-nav pull-left"] @@ -423,7 +387,6 @@ divDropdownLeft' mb = ul [className "nav navbar-nav"] ] ] - menuButton :: LiNav -> ReactElement menuButton (LiNav { title : title' , href : href' @@ -439,7 +402,6 @@ menuButton (LiNav { title : title' , text (" " <> text') ] - menuElements' :: ReactElement menuElements' = menuElements-- title, icon, text [ -- =========================================================== @@ -493,7 +455,6 @@ menuElements ns = dropDown $ intercalate divider $ map (map liNav) ns -- , target :: String -- } - data LiNav = LiNav { title :: String , href :: String , icon :: String @@ -515,8 +476,6 @@ liNav (LiNav { title : title' ] ] - - -- TODO put the search form in the center of the navBar divSearchBar :: forall props eff. Spec (ajax :: AJAX, console :: CONSOLE, dom :: DOM |eff) AppState props Action divSearchBar = simpleSpec performAction render @@ -562,8 +521,6 @@ divDropdownRight d = ] ] - - layoutFooter :: forall props eff. Spec (ajax :: AJAX, console :: CONSOLE, dom :: DOM |eff) AppState props Action layoutFooter = simpleSpec performAction render where @@ -590,7 +547,6 @@ layoutFooter = simpleSpec performAction render ] ] - layoutSpec :: forall eff props. Spec (E eff) AppState props Action layoutSpec = fold diff --git a/src/Gargantext/Pages/Corpus.purs b/src/Gargantext/Pages/Corpus.purs index 3989209752089769a9bb45e811a53f8d93ce873a..afa79f13d0f5e9e3ebb0d3e361b9bdcaade57777 100644 --- a/src/Gargantext/Pages/Corpus.purs +++ b/src/Gargantext/Pages/Corpus.purs @@ -21,7 +21,7 @@ import Data.Maybe (Maybe(..), fromMaybe) import Data.MediaType.Common (applicationJSON) import Data.Tuple (Tuple(..)) import Landing as L -import Modal (modalHide) +import Gargantext.Components.Modals.Modal (modalHide) import Network.HTTP.Affjax (AJAX, affjax, defaultRequest) import Network.HTTP.RequestHeader (RequestHeader(..)) import Prelude hiding (div) diff --git a/src/Gargantext/Pages/Corpus/Doc/Document.purs b/src/Gargantext/Pages/Corpus/Doc/Document.purs index 8b10dab8f6adc3dddc7cb2deb8ff074d74638dac..78026f574ff2554ecce1905d9365f8082dfde175 100644 --- a/src/Gargantext/Pages/Corpus/Doc/Document.purs +++ b/src/Gargantext/Pages/Corpus/Doc/Document.purs @@ -1,17 +1,12 @@ module DocView where -import Data.Argonaut -import Data.Generic (class Generic, gShow) +import Prelude -import Gargantext.Charts.ECharts -import Gargantext.Chart (p'') -import Gargantext.Dashboard (globalPublis) - -import Control.Monad.Eff.Class (liftEff) import Control.Monad.Aff (Aff, attempt) import Control.Monad.Aff.Class (liftAff) import Control.Monad.Cont.Trans (lift) import Control.Monad.Eff (Eff) +import Control.Monad.Eff.Class (liftEff) import Control.Monad.Eff.Console (CONSOLE, log) import DOM (DOM) import DOM.HTML (window) as DOM @@ -19,16 +14,21 @@ import DOM.HTML.Types (htmlDocumentToParentNode) as DOM import DOM.HTML.Window (document) as DOM import DOM.Node.ParentNode (QuerySelector(..)) import DOM.Node.ParentNode (querySelector) as DOM +import Data.Argonaut import Data.Array (filter, replicate) import Data.Either (Either(..)) +import Data.Generic (class Generic, gShow) import Data.HTTP.Method (Method(..)) import Data.Maybe (fromJust) import Data.MediaType.Common (applicationJSON) import Data.Tuple (Tuple(..)) +import Gargantext.Chart (p'') +import Gargantext.Charts.ECharts +import Gargantext.Dashboard (globalPublis) +import Gargantext.Config.REST (get) import Network.HTTP.Affjax (AJAX, affjax, defaultRequest) import Network.HTTP.RequestHeader (RequestHeader(..)) import Partial.Unsafe (unsafePartial) -import Prelude (class Eq, class Ord, class Show, Unit, bind, map, not, pure, show, void, ($), (*), (+), (-), (/), (<), (<$>), (<>), (==), (>), (>=), (>>=)) import React (ReactElement) import React as R import React.DOM (a, b, b', br', div, h3, i, input, li, option, select, span, table, tbody, td, text, thead, th, tr, ul, nav) @@ -37,8 +37,6 @@ import ReactDOM as RDOM import Thermite (PerformAction, Render, Spec, cotransform, createReactSpec, defaultPerformAction, modifyState, simpleSpec) import Unsafe.Coerce (unsafeCoerce) -import Gargantext.REST (get) - --main :: forall e. Eff (dom:: DOM, console :: CONSOLE, ajax :: AJAX | e) Unit --main = do diff --git a/src/Gargantext/Pages/Corpus/Doc/Facets.purs b/src/Gargantext/Pages/Corpus/Doc/Facets.purs index 1d569b13284140b94cc6a9a686d1f9c55ea5f50d..35f9a26b97e30486d8748fc501a231be2fe62ee9 100644 --- a/src/Gargantext/Pages/Corpus/Doc/Facets.purs +++ b/src/Gargantext/Pages/Corpus/Doc/Facets.purs @@ -1,23 +1,20 @@ module Tabview where +import Prelude hiding (div) + import Authorview as AV import Control.Monad.Eff.Console (CONSOLE) import DOM (DOM) -import Data.Array (fold) import Data.Either (Either(..)) -import Data.Lens (Lens', Prism', lens, over, prism, view) -import Data.List (List, fromFoldable) +import Data.Lens (Lens', Prism', lens, prism) +import Data.List (fromFoldable) import Data.Tuple (Tuple(..)) import DocView as DV +import Gargantext.Components.Tab as Tab import Network.HTTP.Affjax (AJAX) -import Prelude hiding (div) -import React.DOM (a, div, li, text, ul) -import React.DOM.Props (_data, _id, aria, className, href, role) import Sourceview as SV -import Tab (tabs) -import Tab as Tab import Termsview as TV -import Thermite (Render, Spec, _performAction, _render, defaultPerformAction, defaultRender, focus, focusState, simpleSpec, withState) +import Thermite (Spec, focus) data Action = DocviewA DV.Action @@ -117,7 +114,7 @@ _tabAction = prism TabViewA \ action -> tab1 :: forall eff props. Spec ( dom :: DOM, console :: CONSOLE, ajax :: AJAX| eff) State props Action -tab1 = tabs _tablens _tabAction $ fromFoldable [ Tuple "Doc View" docPageSpec +tab1 = Tab.tabs _tablens _tabAction $ fromFoldable [ Tuple "Doc View" docPageSpec , Tuple "Author View" authorPageSpec , Tuple "Source View" sourcePageSpec , Tuple "Terms View" termsPageSpec diff --git a/src/Gargantext/Pages/Corpus/Doc/Facets/5_Terms/NgramsItem.purs b/src/Gargantext/Pages/Corpus/Doc/Facets/5_Terms/NgramsItem.purs index 7960b05281f12d9b8365fb6027cc610239ba2115..efd0d17d47ee4edb5d81f44faa80498905390508 100644 --- a/src/Gargantext/Pages/Corpus/Doc/Facets/5_Terms/NgramsItem.purs +++ b/src/Gargantext/Pages/Corpus/Doc/Facets/5_Terms/NgramsItem.purs @@ -8,9 +8,9 @@ import Data.Newtype (class Newtype) import Network.HTTP.Affjax (AJAX) import React (ReactElement) import React.DOM (input, span, td, text, tr) -import React.DOM.Props (_type, checked, className, color, onChange, style, title) +import React.DOM.Props (_type, checked, className, onChange, style, title) import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec) -import Utils (getter, setter) +import Gargantext.Utils (getter, setter) newtype State = State { term :: Term diff --git a/src/Gargantext/Pages/Corpus/Doc/Facets/6_Graph.purs b/src/Gargantext/Pages/Corpus/Doc/Facets/6_Graph.purs index b1f2645628f412486d5400133717147d8851c040..062fe6754beacc3e49ca157bdc2acb583fe3b8cb 100644 --- a/src/Gargantext/Pages/Corpus/Doc/Facets/6_Graph.purs +++ b/src/Gargantext/Pages/Corpus/Doc/Facets/6_Graph.purs @@ -10,26 +10,25 @@ import Control.Monad.Eff.Console (CONSOLE, log) import Control.Monad.Eff.Unsafe (unsafePerformEff) import DOM (DOM) import Data.Argonaut (decodeJson) -import Data.Array (length, mapWithIndex, take, (!!)) +import Data.Array (length, mapWithIndex, (!!)) import Data.Either (Either(..)) import Data.HTTP.Method (Method(..)) import Data.Int (toNumber) import Data.Maybe (Maybe(..), fromJust) import Data.MediaType.Common (applicationJSON) import Data.Newtype (class Newtype) +import Gargantext.Components.GraphExplorer.Types (Cluster(..), Edge(..), GraphData(..), Legend(..), Node(..), getLegendData) +import Gargantext.Utils (getter) import GraphExplorer.Sigmajs (Color(Color), SigmaEasing, SigmaGraphData(SigmaGraphData), SigmaNode, SigmaSettings, canvas, edgeShape, edgeShapes, forceAtlas2, sStyle, sigma, sigmaEasing, sigmaEdge, sigmaEnableWebGL, sigmaNode, sigmaSettings) -import GraphExplorer.Types (Cluster(..), Edge(..), GraphData(..), Legend(..), Node(..), getLegendData) import Math (cos, sin) import Network.HTTP.Affjax (AJAX, affjax, defaultRequest) import Network.HTTP.RequestHeader (RequestHeader(..)) import Partial.Unsafe (unsafePartial) -import Prelude (map) -import React (ReactElement, createElement) +import React (ReactElement) import React.DOM (a, br', button, div, form', input, li, li', menu, option, p, select, span, text, ul, ul') -import React.DOM.Props (_data, _id, _type, aria, checked, className, href, name, onChange, placeholder, role, style, title, value) +import React.DOM.Props (_id, _type, checked, className, href, name, onChange, placeholder, style, title, value) import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec) import Unsafe.Coerce (unsafeCoerce) -import Utils (getter) data Action = NoOp | LoadGraph String @@ -501,7 +500,7 @@ specOld = simpleSpec performAction render Nothing -> span [] [] Just selectedNode -> p [] [text $ "BOUKLI HACENE Ghouthi, GRIPON Vincent, FARRUGIA Nicolas, ARZEL Matthieu, ", a [href "http://localhost:2015/#/userPage/1"][text "JEZEQUEL Michel. "], text "Finding All Matches in a Database using Binary Neural Networks. COGNITIVE 2017 : The Ninth International Conference on Advanced Cognitive Technologies and Applications, 19-23 february 2017, Athènes, Greece, 2017, pp. 59-64"] , p [] - [ + [ ] ] ] diff --git a/src/Gargantext/Pages/Corpus/User/Users/API.purs b/src/Gargantext/Pages/Corpus/User/Users/API.purs index 7ab40e260c0c6aebb4d265838a043e17fc8b0f5a..5c5357408a762fc9536f9e65ee517e881b67caf7 100644 --- a/src/Gargantext/Pages/Corpus/User/Users/API.purs +++ b/src/Gargantext/Pages/Corpus/User/Users/API.purs @@ -1,8 +1,8 @@ -module Gargantext.Users.API - where +module Gargantext.Users.API where -import Gargantext.Users.Types +import Prelude +import Gargantext.Users.Types (Action(..), State, User, _user) import Control.Monad.Aff (Aff) import Control.Monad.Aff.Console (CONSOLE, log) import Control.Monad.Trans.Class (lift) @@ -10,9 +10,8 @@ import DOM (DOM) import Data.Either (Either(..)) import Data.Lens (set) import Data.Maybe (Maybe(..)) -import Gargantext.REST (get) +import Gargantext.Config.REST (get) import Network.HTTP.Affjax (AJAX) -import Prelude (bind, id, show, void, ($), (<<<), (<>)) import Thermite (PerformAction, modifyState) getUser :: forall eff. Int -> Aff diff --git a/src/Gargantext/Pages/Corpus/User/Users/Types.purs b/src/Gargantext/Pages/Corpus/User/Users/Types.purs index dd5cdeecffb4eef973cd8a10d0db8b4536507e4f..d8c198035dfbe6b6de162bfac2af57f57aedd468 100644 --- a/src/Gargantext/Pages/Corpus/User/Users/Types.purs +++ b/src/Gargantext/Pages/Corpus/User/Users/Types.purs @@ -8,19 +8,19 @@ module Gargantext.Users.Types ) where +import Prelude (($)) + import Gargantext.Users.Types.Lens import Gargantext.Users.Types.Types import Gargantext.Users.Types.States - import Brevets as B import Control.Monad.Aff.Console (CONSOLE) import DOM (DOM) import Data.List (fromFoldable) import Data.Tuple (Tuple(..)) import Network.HTTP.Affjax (AJAX) -import Prelude (($)) import Projects as PS -import Tab (tabs) +import Gargantext.Components.Tab (tabs) import Thermite (Spec, focus) brevetSpec :: forall eff props. Spec (dom :: DOM, console::CONSOLE, ajax :: AJAX | eff) State props Action diff --git a/src/Gargantext/Pages/Corpus/User/Users/Types/Lens.purs b/src/Gargantext/Pages/Corpus/User/Users/Types/Lens.purs index e8f3be697c41f130eef8d46348e38f6646d34f7c..9540e7d058b88b2ecd3e46bea6274d0a85e57efd 100644 --- a/src/Gargantext/Pages/Corpus/User/Users/Types/Lens.purs +++ b/src/Gargantext/Pages/Corpus/User/Users/Types/Lens.purs @@ -11,7 +11,7 @@ import Gargantext.Users.Types.Types (User) import Network.HTTP.Affjax (AJAX) import Projects as PS import Publications as P -import Tab as Tab +import Gargantext.Components.Tab as Tab import Thermite (Spec, focus) _user :: Lens' State (Maybe User) diff --git a/src/Gargantext/Pages/Corpus/User/Users/Types/States.purs b/src/Gargantext/Pages/Corpus/User/Users/Types/States.purs index a8988d41cc47eb7bf11fc089c1a0afbabb318427..03ed4db383196c8a5dd8f83791335e92290996ea 100644 --- a/src/Gargantext/Pages/Corpus/User/Users/Types/States.purs +++ b/src/Gargantext/Pages/Corpus/User/Users/Types/States.purs @@ -6,7 +6,7 @@ import Data.Maybe (Maybe(..)) import Gargantext.Users.Types.Types (User) import Projects as PS import Publications as P -import Tab as Tab +import Gargantext.Components.Tab as Tab data Action = NoOp @@ -32,4 +32,3 @@ initialState = , projects : PS.initialState , user: Nothing } - diff --git a/src/Gargantext/Pages/Corpus/User/Users/Types/Types.purs b/src/Gargantext/Pages/Corpus/User/Users/Types/Types.purs index 3813aa90a0dbaafe54dffe1c9fc681ba3b472896..4115988065c88fd87b1d3b0d637cf8bcf43e40bc 100644 --- a/src/Gargantext/Pages/Corpus/User/Users/Types/Types.purs +++ b/src/Gargantext/Pages/Corpus/User/Users/Types/Types.purs @@ -1,9 +1,10 @@ module Gargantext.Users.Types.Types where + +import Prelude + import Data.Argonaut (class DecodeJson, decodeJson, (.?)) -import Data.Generic (class Generic) import Data.Maybe (Maybe) -import Prelude (bind, pure, ($)) -import DecodeMaybe +import Gargantext.Utils.DecodeMaybe ((.?|)) newtype User = User { diff --git a/src/Gargantext/Pages/Home.purs b/src/Gargantext/Pages/Home.purs index 79b203bdbd7df37154e7aa1e8f56c601bd439f5b..94fea1140dc8eea6bb5664ae9fb5f78b4e85e877 100644 --- a/src/Gargantext/Pages/Home.purs +++ b/src/Gargantext/Pages/Home.purs @@ -1,21 +1,20 @@ module Landing where -import Gargantext.Data.Landing -import Gargantext.Data.Lang import Prelude hiding (div) import Control.Monad.Cont.Trans (lift) import Control.Monad.Eff.Console (CONSOLE) import DOM (DOM) -import Gargantext.Lang.Landing.EnUS as En -import Gargantext.Lang.Landing.FrFR as Fr +import Gargantext.Components.Lang.Landing.EnUS as En +import Gargantext.Components.Lang.Landing.FrFR as Fr +import Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..)) +import Gargantext.Components.Data.Lang (Lang(..)) import Network.HTTP.Affjax (AJAX) import React (ReactElement) -import React.DOM (a, button, div, footer, h1, h3, hr, i, img, li, p, span, text, ul) -import React.DOM.Props (Props, _data, _id, aria, className, href, onClick, role, src, style, tabIndex, target, title) +import React.DOM (a, div, h3, i, img, p, span, text) +import React.DOM.Props (Props, _id, aria, className, href, src, target, title) import Routing.Hash.Aff (setHash) -import Thermite (PerformAction, Render, Spec, simpleSpec) -import Thermite as T +import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec) newtype State = State { userName :: String @@ -43,21 +42,21 @@ performAction :: forall eff props. PerformAction ( console :: CONSOLE | eff ) State props Action performAction NoOp _ _ = void do - T.modifyState \state -> state + modifyState \state -> state performAction Documentation _ _ = void do - T.modifyState \state -> state + modifyState \state -> state performAction Enter _ _ = void do lift $ setHash "/search" - T.modifyState \state -> state + modifyState \state -> state performAction Login _ _ = void do lift $ setHash "/login" - T.modifyState \state -> state + modifyState \state -> state performAction SignUp _ _ = void do - T.modifyState \state -> state + modifyState \state -> state -- Layout | diff --git a/src/Gargantext/Router.purs b/src/Gargantext/Router.purs index 1563bc3139bc33d1f09c978392a7e8c0b8ffe0d3..6ade0b315cdb2c872443795f37736ba17b0bfcdd 100644 --- a/src/Gargantext/Router.purs +++ b/src/Gargantext/Router.purs @@ -1,4 +1,4 @@ -module PageRouter where +module Gargantext.Router where import Prelude diff --git a/src/Gargantext/Utils.purs b/src/Gargantext/Utils.purs index 7ea0e0547934b6bb6ee79aeb1828920a9ee4f49e..7af75a7ebe718e012843a754acd667ea8732c338 100644 --- a/src/Gargantext/Utils.purs +++ b/src/Gargantext/Utils.purs @@ -1,4 +1,4 @@ -module Utils where +module Gargantext.Utils where import Prelude diff --git a/src/Gargantext/Utils/DecodeMaybe.purs b/src/Gargantext/Utils/DecodeMaybe.purs index afc5fb28166ae1679430948d9886e4c765e185af..c5fb1c793922973d30eba05072ec2ac38fcb15b7 100644 --- a/src/Gargantext/Utils/DecodeMaybe.purs +++ b/src/Gargantext/Utils/DecodeMaybe.purs @@ -1,4 +1,4 @@ -module DecodeMaybe where +module Gargantext.Utils.DecodeMaybe where import Prelude diff --git a/src/Main.purs b/src/Main.purs index eaafce274451fd56fc3fb4742b849a2dc5fc942e..6bf5b44c449ef7075b4f2df3e0cf9fea788f805a 100644 --- a/src/Main.purs +++ b/src/Main.purs @@ -11,9 +11,9 @@ import DOM.HTML.Window (document) as DOM import DOM.Node.ParentNode (QuerySelector(..)) import DOM.Node.ParentNode (querySelector) as DOM import Data.Maybe (fromJust) -import Navigation (dispatchAction, initAppState, layoutSpec) +import Gargantext.Navigation (dispatchAction, initAppState, layoutSpec) +import Gargantext.Router (routeHandler, routing) import Network.HTTP.Affjax (AJAX) -import PageRouter (routeHandler, routing) import Partial.Unsafe (unsafePartial) import React as R import ReactDOM as RDOM