Commit f85898a2 authored by arturo's avatar arturo

>>> BEGIN

parent f94c4685
Pipeline #2976 failed with stage
in 0 seconds
......@@ -8748,7 +8748,7 @@ a:focus, a:hover {
}
.table tr td {
color: #005a9aff;
height: 48px;
}
.table tr td .active {
font-weight: bold;
......@@ -8763,6 +8763,18 @@ a:focus, a:hover {
.table tr td .trash {
text-decoration: line-through;
}
.table tr td .doc-chooser {
padding-top: 3px;
text-align: center;
}
.table tr td .rating-group {
display: flex;
padding-top: 3px;
}
.table tr td .rating-group__action {
width: 14px;
margin-right: 8px;
}
.action-search {
margin: 10px;
......
......@@ -8701,7 +8701,7 @@ a:focus, a:hover {
}
.table tr td {
color: #005a9aff;
height: 48px;
}
.table tr td .active {
font-weight: bold;
......@@ -8716,6 +8716,18 @@ a:focus, a:hover {
.table tr td .trash {
text-decoration: line-through;
}
.table tr td .doc-chooser {
padding-top: 3px;
text-align: center;
}
.table tr td .rating-group {
display: flex;
padding-top: 3px;
}
.table tr td .rating-group__action {
width: 14px;
margin-right: 8px;
}
.action-search {
margin: 10px;
......
......@@ -8457,7 +8457,7 @@ a:focus, a:hover {
}
.table tr td {
color: #005a9aff;
height: 48px;
}
.table tr td .active {
font-weight: bold;
......@@ -8472,6 +8472,18 @@ a:focus, a:hover {
.table tr td .trash {
text-decoration: line-through;
}
.table tr td .doc-chooser {
padding-top: 3px;
text-align: center;
}
.table tr td .rating-group {
display: flex;
padding-top: 3px;
}
.table tr td .rating-group__action {
width: 14px;
margin-right: 8px;
}
.action-search {
margin: 10px;
......
......@@ -8705,7 +8705,7 @@ a:focus, a:hover {
}
.table tr td {
color: #005a9aff;
height: 48px;
}
.table tr td .active {
font-weight: bold;
......@@ -8720,6 +8720,18 @@ a:focus, a:hover {
.table tr td .trash {
text-decoration: line-through;
}
.table tr td .doc-chooser {
padding-top: 3px;
text-align: center;
}
.table tr td .rating-group {
display: flex;
padding-top: 3px;
}
.table tr td .rating-group__action {
width: 14px;
margin-right: 8px;
}
.action-search {
margin: 10px;
......
......@@ -8706,7 +8706,7 @@ a:focus, a:hover {
}
.table tr td {
color: #005a9aff;
height: 48px;
}
.table tr td .active {
font-weight: bold;
......@@ -8721,6 +8721,18 @@ a:focus, a:hover {
.table tr td .trash {
text-decoration: line-through;
}
.table tr td .doc-chooser {
padding-top: 3px;
text-align: center;
}
.table tr td .rating-group {
display: flex;
padding-top: 3px;
}
.table tr td .rating-group__action {
width: 14px;
margin-right: 8px;
}
.action-search {
margin: 10px;
......
......@@ -9,12 +9,15 @@ import Data.Map as Map
import Data.Maybe (Maybe(..))
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (Variant(..))
import Gargantext.Components.Category.Types (Category(..), Star(..), cat2score, categories, clickAgain, star2score, stars)
import Gargantext.Components.DocsTable.Types (DocumentsView(..), LocalCategories, LocalUserScore)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, put)
import Gargantext.Types (NodeID, NodeType(..))
import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
......@@ -42,23 +45,53 @@ ratingCpt = here.component "rating" cpt where
, row: DocumentsView r
, score
, session
, setLocalCategories } _ =
pure $ H.div { className:"flex" } divs where
divs = map (\s -> H.div { className : icon' score s
, on: { click: onClick s } } []) stars
icon' Star_0 Star_0 = "fa fa-times-circle"
icon' _ Star_0 = "fa fa-times"
icon' c s = if star2score c < star2score s then "fa fa-star-o" else "fa fa-star"
, setLocalCategories
} _ = do
-- | Computed
-- |
let
icon' Star_0 Star_0 = "times-circle"
icon' _ Star_0 = "times"
icon' c s = star2score c < star2score s ? "star-o" $ "star"
variant' Star_0 Star_0 = Dark
variant' _ Star_0 = Dark
variant' _ _ = Secondary
className' Star_0 Star_0 = "rating-group__action"
className' _ Star_0 = "rating-group__action"
className' _ _ = "rating-group__star"
-- | Behaviors
-- |
let
onClick c _ = do
let c' = if score == c
then clickAgain c
else c
let c' = score == c ? clickAgain c $ c
setLocalCategories $ Map.insert r._id c'
launchAff_ $ do
_ <- putRating session nodeId $ RatingQuery { nodeIds: [r._id], rating: c' }
launchAff_ do
_ <- putRating session nodeId $ RatingQuery
{ nodeIds: [r._id]
, rating: c'
}
liftEffect $ T2.reload chartReload
-- | Render
-- |
pure $
H.div
{ className: "rating-group" } $
stars <#> \s ->
B.iconButton
{ name: icon' score s
, callback: onClick s
, overlay: false
, variant: variant' score s
, className: className' score s
}
newtype RatingQuery =
RatingQuery { nodeIds :: Array Int
, rating :: Star
......
......@@ -27,7 +27,7 @@ import Effect.Class (liftEffect)
import Effect.Timer (setTimeout)
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..))
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), Variant(..))
import Gargantext.Components.Category (rating)
import Gargantext.Components.Category.Types (Star(..))
import Gargantext.Components.DocsTable.DocumentFormCreation as DFC
......@@ -582,10 +582,17 @@ pagePaintRawCpt = here.component "pagePaintRaw" cpt where
--, H.input { type: "checkbox", defaultValue: checked, on: {click: click Trash} }
-- TODO show date: Year-Month-Day only
, H.div { className: tClassName } [ R2.showText r.date ]
, H.div { className: tClassName }
[ H.a { href: url frontends $ corpusDocument r._id, target: "_blank" }
[ H.text r.title ]
]
,
H.div
{ className: tClassName }
[
H.a
{ href: url frontends $ corpusDocument r._id
, target: "_blank"
, className: "text-primary"
}
[ H.text r.title ]
]
, H.div { className: tClassName } [ H.text $ showSource r.source ]
, H.div {} [ H.text $ maybe "-" show r.ngramCount ]
]
......@@ -623,11 +630,19 @@ docChooserCpt = here.component "docChooser" cpt
mCurrentDocId' <- T.useLive T.unequal mCurrentDocId
let selected = mCurrentDocId' == Just nodeId
eyeClass = if selected then "fa-eye" else "fa-eye-slash"
eyeClass = selected ? "eye" $ "eye-slash"
variant = selected ? Info $ Dark
pure $ H.div { className: "btn" } [
H.span { className: "fa " <> eyeClass
, on: { click: onClick selected } } []
pure $
H.div
{ className: "doc-chooser" }
[
B.iconButton
{ name: eyeClass
, overlay: false
, variant
, callback: onClick selected
}
]
where
onClick selected _ = do
......
module Gargantext.Components.NgramsTable.Tree where
import DOM.Simple as DOM
import Data.Array as A
import Data.Either (Either(..))
import Data.Lens ((^..), (^.), view)
......@@ -14,14 +15,15 @@ import Data.Maybe (Maybe(..), maybe, isJust)
import Data.Nullable (Nullable, null, toMaybe)
import Data.Set (Set)
import Data.Set as Set
import DOM.Simple as DOM
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import Gargantext.Core.NgramsTable.Functions (applyNgramsPatches, setTermListA, tablePatchHasNgrams)
import Gargantext.Core.NgramsTable.Types (Action(..), NgramsClick, NgramsDepth, NgramsElement, NgramsTable, NgramsTablePatch(..), NgramsTerm, _NgramsElement, _NgramsRepoElement, _PatchMap, _children, _list, _ngrams, _occurrences, ngramsTermText, replace)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (Variant(..))
import Gargantext.Components.Table as Tbl
import Gargantext.Config.REST (logRESTError)
import Gargantext.Core.NgramsTable.Functions (applyNgramsPatches, setTermListA, tablePatchHasNgrams)
import Gargantext.Core.NgramsTable.Types (Action(..), NgramsClick, NgramsDepth, NgramsElement, NgramsTable, NgramsTablePatch(..), NgramsTerm, _NgramsElement, _NgramsRepoElement, _PatchMap, _children, _list, _ngrams, _occurrences, ngramsTermText, replace)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (Unit, bind, const, discard, map, mempty, not, otherwise, pure, show, unit, ($), (+), (/=), (<<<), (<>), (==), (>), (||))
import Gargantext.Types as GT
......@@ -133,10 +135,16 @@ treeLoadedCpt = here.component "treeLoaded" cpt where
a (ngramsStyle <> [DOM.onClick $ const effect])
Nothing ->
span ngramsStyle
edit effect = [ H.text " "
, H.i { className: "fa fa-pencil"
, on: { click: const effect } } []
]
edit effect =
[
B.iconButton
{ name: "pencil"
, className: "ml-1"
, variant: Secondary
, callback: const effect
, overlay: false
}
]
leaf = L.null ngramsChildren
className = "fa fa-chevron-" <> if open then "down" else "right"
style = if leaf then {color: "#adb5bd"} else {color: ""}
......@@ -177,7 +185,7 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
, ngramsTable
} _ = do
isEditing' <- T.useLive T.unequal isEditing
pure $ Tbl.makeRow
[ H.div { className: "ngrams-selector" }
[ H.span { className: "ngrams-chooser fa fa-eye-slash"
......@@ -188,16 +196,30 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
, checkbox GT.StopTerm
, H.div {}
( if isEditing'
then [ H.a { on: { click: const $ dispatch $ ToggleChild true ngrams } }
[ H.i { className: "fa fa-plus" } [] ]
, R2.buff $ tag [ text $ " " <> ngramsTermText ngramsDepth.ngrams ]
]
else [ renderNgramsTree { getNgramsChildren: getNgramsChildren'
, ngramsClick
, ngramsDepth
, ngramsEdit
, ngramsStyle
, key: "" } ]
then
[
B.iconButton
{ name: "plus"
, className: "mr-1 align-bottom"
, overlay: false
, variant: Primary
, callback: const $ dispatch $ ToggleChild true ngrams
}
,
R2.buff $
tag [ text $ " " <> ngramsTermText ngramsDepth.ngrams ]
]
else
[
renderNgramsTree
{ getNgramsChildren: getNgramsChildren'
, ngramsClick
, ngramsDepth
, ngramsEdit
, ngramsStyle
, key: ""
}
]
)
, H.text $ show (ngramsElement ^. _NgramsElement <<< _occurrences)
]
......
......@@ -64,9 +64,11 @@
top: 50%
.table
$row-min-height: 48px
tr
td
color: #005a9aff
height: $row-min-height
.active
font-weight: bold
text-decoration: underline
......@@ -77,6 +79,23 @@
.trash
text-decoration: line-through
.doc-chooser
$offset-top: 3px // flex alignment won't work, hence empirical value
padding-top: $offset-top
text-align: center
.rating-group
$offset-top: 3px // flex alignment won't work, hence empirical value
display: flex
padding-top: $offset-top
&__action
// @XXX Glyphicon icons lack of homogeneous width
width: 14px
margin-right: space-x(1)
.action-search
margin: 10px
......
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