Commit 12404dee authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'dev' into dev-tree-node-name-length

parents 6cf4237a c1cca339
......@@ -13,6 +13,15 @@
.tree .node-actions .update-button.disabled {
cursor: wait;
}
.tree .lefthanded ul {
margin-right: 19px;
}
.tree .lefthanded li .leaf {
justify-content: flex-end;
}
.tree .righthanded li .leaf {
justify-content: flex-start;
}
.progress-pie {
background: rgba(51, 122, 183, 0.1);
......
......@@ -9,6 +9,18 @@
cursor: pointer
&.disabled
cursor: wait
.lefthanded
ul
margin-right : 19px
li
.leaf
justify-content : flex-end
.righthanded
li
.leaf
justify-content : flex-start
// based on https://codeburst.io/how-to-pure-css-pie-charts-w-css-variables-38287aea161e
.progress-pie
......
......@@ -15,7 +15,7 @@ import Gargantext.Components.Forest.Tree (treeView)
import Gargantext.Ends (Frontends)
import Gargantext.Routes (AppRoute)
import Gargantext.Sessions (Session(..), Sessions, OpenNodes, unSessions)
import Gargantext.Types (Reload, Handed)
import Gargantext.Types (Reload, Handed(..))
import Gargantext.Utils.Reactix as R2
type Props =
......@@ -49,7 +49,8 @@ forestCpt = R.hooksComponent "G.C.Forest.forest" cpt where
)
(cpt' openNodes asyncTasks reload showLogin)
cpt' openNodes asyncTasks reload showLogin (frontends /\ route /\ sessions /\ _ /\ _ /\ _ /\ _ /\ handed) = do
pure $ R.fragment $ A.cons (plus showLogin) trees
--pure $ R.fragment $ A.cons (plus showLogin) trees
pure $ R2.row $ [plus handed showLogin] <> trees
where
trees = tree <$> unSessions sessions
tree s@(Session {treeId}) =
......@@ -63,8 +64,11 @@ forestCpt = R.hooksComponent "G.C.Forest.forest" cpt where
, session: s
}
plus :: R2.Setter Boolean -> R.Element
plus showLogin =
plus :: Handed -> R2.Setter Boolean -> R.Element
plus handed showLogin = H.div {className: if handed == RightHanded
then "flex-start" -- TODO we should use lefthanded SASS class here
else "flex-end"
} [
H.button { on: {click}
, className: "btn btn-default"
}
......@@ -75,6 +79,7 @@ plus showLogin =
--, H.div { "type": "", className: "fa fa-plus-circle fa-lg"} []
--, H.div { "type": "", className: "fa fa-minus-circle fa-lg"} []
]
]
-- TODO same as the one in the Login Modal (same CSS)
-- [ H.i { className: "material-icons md-36"} [] ]
where
......
......@@ -133,20 +133,23 @@ loadedTreeView p = R.createElement loadedTreeViewCpt p []
, session
, tasks
, tree
} _ = pure $ H.ul { className: "tree " <> if handed == GT.RightHanded
then "flex-start"
else "flex-end"
}
[ toHtml { asyncTasks
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, session
, tasks
, tree
}
} _ = pure $ H.ul { className: "tree"
}
[ H.div { className: if handed == GT.RightHanded
then "righthanded"
else "lefthanded"
}
[ toHtml { asyncTasks
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, session
, tasks
, tree
}
]
]
------------------------------------------------------------------------
......
......@@ -68,44 +68,46 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, handed, session } = R.createEl
pure $ H.span (dropProps droppedFile isDragOver)
$ ordering
[ chevronIcon nodeType folderOpen
, folderIcon nodeType folderOpen
, if showBox then
Popover.popover { arrow: false
, open: false
, onClose: \_ -> pure unit
, onOpen: \_ -> pure unit
, ref: popoverRef } [
popOverIcon
, mNodePopupView props (onPopoverClose popoverRef)
]
else H.div {} []
, nodeLink { frontends
, id
, isSelected: mCurrentRoute == Routes.nodeTypeAppRoute nodeType (sessionId session) id
, name: name' props
, nodeType
, session }
, nodeActions { id
, nodeType
, refreshTree: const $ dispatch RefreshTree
, session }
, fileTypeView { dispatch, droppedFile, id, isDragOver, nodeType }
, H.div {} (map (\t -> asyncProgressBar { asyncTask: t
, barType: Pie
, corpusId: id
, onFinish: const $ onTaskFinish t
, session
}
) tasks
)
, if nodeType == GT.NodeUser
then GV.versionView {session}
else H.div {} []
]
where
SettingsBox {show: showBox} = settingsBox nodeType
onPopoverClose popoverRef _ = Popover.setOpen popoverRef false
[ chevronIcon nodeType folderOpen
, folderIcon nodeType folderOpen
, if showBox then
Popover.popover { arrow: false
, open: false
, onClose: \_ -> pure unit
, onOpen: \_ -> pure unit
, ref: popoverRef } [
popOverIcon
, mNodePopupView props (onPopoverClose popoverRef)
]
else H.div {} []
, nodeLink { frontends
, id
, isSelected: mCurrentRoute == Routes.nodeTypeAppRoute nodeType (sessionId session) id
, name: name' props
, nodeType
, session }
, nodeActions { id
, nodeType
, refreshTree: const $ dispatch RefreshTree
, session
}
, fileTypeView { dispatch, droppedFile, id, isDragOver, nodeType }
, H.div {} (map (\t -> asyncProgressBar { asyncTask: t
, barType: Pie
, corpusId: id
, onFinish: const $ onTaskFinish t
, session
}
) tasks
)
, if nodeType == GT.NodeUser
then GV.versionView {session}
else H.div {} []
]
where
SettingsBox {show: showBox} = settingsBox nodeType
onPopoverClose popoverRef _ = Popover.setOpen popoverRef false
name' {name, nodeType} = if nodeType == GT.NodeUser
then show session
......@@ -143,7 +145,8 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, handed, session } = R.createEl
{ className: "leaf " <> (dropClass droppedFile isDragOver)
, on: { drop: dropHandler droppedFile
, dragOver: onDragOverHandler isDragOver
, dragLeave: onDragLeave isDragOver } }
, dragLeave: onDragLeave isDragOver }
}
where
dropClass (Just _ /\ _) _ = "file-dropped"
dropClass _ (true /\ _) = "file-dropped"
......
......@@ -3,12 +3,12 @@ module Gargantext.Components.Nodes.File where
import Data.Argonaut (class DecodeJson, decodeJson, (.:))
import Data.Maybe (Maybe(..))
import DOM.Simple.Console (log2)
import Effect.Aff (Aff, launchAff_)
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Ends (toUrl)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
......@@ -101,7 +101,7 @@ fileLayoutLoadedCpt = R.hooksComponent "G.C.N.F.fileLayoutLoaded" cpt
]
, H.div { className: "row" } [
H.div { className: "btn btn-default" } [
H.a { href: "/api/v1.0/node/" <> show nodeId <> "/file/download"
H.a { href: toUrl session ("node/" <> show nodeId <> "/file/download")
, target: "_blank"
} [ H.text "Download" ]
]
......
......@@ -126,7 +126,7 @@ instance optionalInstance :: Union r t s => Optional r s
showTabType' :: TabType -> String
showTabType' (TabCorpus t) = show t
showTabType' (TabDocument t) = show t
showTabType' (TabPairing t) = show t
showTabType' (TabPairing t) = show t
data TabPostQuery = TabPostQuery {
offset :: Int
......
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