Commit c32921b0 authored by Fabien Maniere's avatar Fabien Maniere

change term column co-occurrence + document content changes + call a new package url-validator

parent e97e7b30
...@@ -10,3 +10,6 @@ ...@@ -10,3 +10,6 @@
# nix-shell --show-trace --option build-fallback true --run build # nix-shell --show-trace --option build-fallback true --run build
#nix run .#install #nix run .#install
nix run .#build nix run .#build
nix-shell --run "npm run css-default-theme"
nix-shell --run "npm run css-dark-theme"
nix-shell --run "npm run css-herbie-theme"
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -82,6 +82,7 @@ workspace: ...@@ -82,6 +82,7 @@ workspace:
- unordered-collections: ">=3.1.0 <4.0.0" - unordered-collections: ">=3.1.0 <4.0.0"
- unsafe-coerce: ">=6.0.0 <7.0.0" - unsafe-coerce: ">=6.0.0 <7.0.0"
- uri: ">=9.0.0 <10.0.0" - uri: ">=9.0.0 <10.0.0"
- url-validator
- uuid: ">=9.0.0 <10.0.0" - uuid: ">=9.0.0 <10.0.0"
- validation: ">=6.0.0 <7.0.0" - validation: ">=6.0.0 <7.0.0"
- var - var
...@@ -228,6 +229,7 @@ workspace: ...@@ -228,6 +229,7 @@ workspace:
- unsafe-coerce - unsafe-coerce
- unsafe-reference - unsafe-reference
- uri - uri
- url-validator
- uuid - uuid
- validation - validation
- var - var
...@@ -768,6 +770,9 @@ workspace: ...@@ -768,6 +770,9 @@ workspace:
tuples-native: tuples-native:
git: https://github.com/garganscript/purescript-tuples-native.git git: https://github.com/garganscript/purescript-tuples-native.git
ref: v2.3.0-spago-next ref: v2.3.0-spago-next
url-validator:
git: https://github.com/bbarker/purescript-url-validator
ref: master
var: var:
git: https://github.com/garganscript/purescript-var git: https://github.com/garganscript/purescript-var
ref: v3.0.1-spago-next ref: v3.0.1-spago-next
...@@ -2295,6 +2300,15 @@ packages: ...@@ -2295,6 +2300,15 @@ packages:
- these - these
- transformers - transformers
- unfoldable - unfoldable
url-validator:
type: git
url: https://github.com/bbarker/purescript-url-validator
rev: 3514fc80cc277c44dc5b5bd30898f4a866bf6795
dependencies:
- either
- maybe
- prelude
- strings
uuid: uuid:
type: registry type: registry
version: 9.0.0 version: 9.0.0
......
...@@ -37,6 +37,11 @@ workspace: ...@@ -37,6 +37,11 @@ workspace:
git: https://github.com/garganscript/purescript-websocket-simple git: https://github.com/garganscript/purescript-websocket-simple
ref: v3.0.2-spago-next ref: v3.0.2-spago-next
# other external packages
url-validator:
git: https://github.com/bbarker/purescript-url-validator
ref: master
# for tests # for tests
spec-discovery: spec-discovery:
git: https://github.com/purescript-spec/purescript-spec-discovery.git git: https://github.com/purescript-spec/purescript-spec-discovery.git
...@@ -125,6 +130,7 @@ package: ...@@ -125,6 +130,7 @@ package:
- unordered-collections: ">=3.1.0 <4.0.0" - unordered-collections: ">=3.1.0 <4.0.0"
- unsafe-coerce: ">=6.0.0 <7.0.0" - unsafe-coerce: ">=6.0.0 <7.0.0"
- uri: ">=9.0.0 <10.0.0" - uri: ">=9.0.0 <10.0.0"
- url-validator
- uuid: ">=9.0.0 <10.0.0" - uuid: ">=9.0.0 <10.0.0"
- validation: ">=6.0.0 <7.0.0" - validation: ">=6.0.0 <7.0.0"
- var - var
......
...@@ -22,6 +22,7 @@ import Gargantext.Components.NgramsTable.AutoSync (useAutoSync) ...@@ -22,6 +22,7 @@ import Gargantext.Components.NgramsTable.AutoSync (useAutoSync)
import Gargantext.Components.Node (NodePoly(..)) import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Core.NgramsTable.Functions (addNewNgramA, applyNgramsPatches, coreDispatch, findNgramRoot, setTermListA, computeCache) import Gargantext.Core.NgramsTable.Functions (addNewNgramA, applyNgramsPatches, coreDispatch, findNgramRoot, setTermListA, computeCache)
import Gargantext.Core.NgramsTable.Types (CoreAction(..), NgramsTerm, Versioned(..), replace) import Gargantext.Core.NgramsTable.Types (CoreAction(..), NgramsTerm, Versioned(..), replace)
import Gargantext.Hooks.LinkHandler (useLinkHandler)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Utils as U import Gargantext.Utils as U
...@@ -29,6 +30,7 @@ import Gargantext.Utils.Reactix as R2 ...@@ -29,6 +30,7 @@ import Gargantext.Utils.Reactix as R2
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Record as Record import Record as Record
import Text.URL.Validate as TUV
import Toestand as T import Toestand as T
------------------------------------------------------------------------- -------------------------------------------------------------------------
...@@ -91,6 +93,8 @@ layoutWithContextNgramsCpt = here.component "layoutWithContextNgrams" cpt where ...@@ -91,6 +93,8 @@ layoutWithContextNgramsCpt = here.component "layoutWithContextNgrams" cpt where
-- | States -- | States
-- | -- |
{ goToURLInNewTab } <- useLinkHandler
contextNgramsS <- T.useBox contextNgrams contextNgramsS <- T.useBox contextNgrams
contextNgrams' <- T.useLive T.unequal contextNgramsS contextNgrams' <- T.useLive T.unequal contextNgramsS
...@@ -282,83 +286,127 @@ layoutWithContextNgramsCpt = here.component "layoutWithContextNgrams" cpt where ...@@ -282,83 +286,127 @@ layoutWithContextNgramsCpt = here.component "layoutWithContextNgrams" cpt where
[ [
annotate doc.title annotate doc.title
] ]
-- ,
-- btnSeeMore "title"
] ]
,
H.hr {}
, ,
R2.fromMaybe doc.authors \authors -> R2.fromMaybe doc.authors \authors ->
H.div H.div
{ className: "document-layout__authors justify-content-space-between" } { className: "document-layout__hdata justify-content-space-between" }
[ [
B.div' B.div'
{ className: "document-layout__authors__label" } { className: "document-layout__hdata__label" }
"Authors" "Authors"
, ,
H.div B.div'
{ className: "document-layout__authors__content w-100" -- <> collapsibleClasses { className: "document-layout__hdata__content w-100"
, id: getIdName "authors" } , id: getIdName "authors" }
[ authors
-- @NOTE #386: annotate for "Authors" ngrams list
annotate (Just authors)
]
-- ,
-- btnSeeMore "authors"
] ]
, ,
R2.fromMaybe doc.source \source -> R2.fromMaybe doc.source \source ->
H.div H.div
{ className: "document-layout__source justify-content-space-between" } { className: "document-layout__hdata justify-content-space-between" }
[ [
B.div' B.div'
{ className: "document-layout__source__label" } { className: "document-layout__hdata__label" }
"Source" "Source"
, ,
B.div' B.div'
{ className: "document-layout__source__content w-100" -- <> collapsibleClasses { className: "document-layout__hdata__content w-100"
, id: getIdName "sources" } , id: getIdName "sources" }
source source
-- ,
-- btnSeeMore "sources"
] ]
, ,
H.div H.div
{ className: "document-layout__date" } { className: "document-layout__hdata" }
[ [
B.div' B.div'
{ className: "document-layout__date__label" } { className: "document-layout__hdata__label" }
"Date" "Date"
, ,
B.div' B.div'
{ className: "document-layout__date__content" } { className: "document-layout__hdata__content" }
(publicationDate $ Document doc) (publicationDate $ Document doc)
] ]
,
, R2.fromMaybe doc.institutes \institutes -> R2.fromMaybe doc.institutes \institutes ->
H.div H.div
{ className: "document-layout__institutes justify-content-space-between" } { className: "document-layout__hdata justify-content-space-between" }
[ [
B.div' B.div'
{ className: "document-layout__institutes__label" } { className: "document-layout__hdata__label" }
"Institutes" "Institutes"
, ,
H.div B.div'
{ className: "document-layout__institutes__content w-100" -- <> collapsibleClasses { className: "document-layout__hdata__content w-100"
, id: getIdName "institutes" } , id: getIdName "institutes" }
[ institutes
annotate (Just institutes)
]
-- , -- ,
-- btnSeeMore "institutes" -- btnSeeMore "institutes"
] ]
,
R2.fromMaybe doc.doi \doi ->
, case path.mCorpusId of H.div
{ className: "document-layout__hdata justify-content-space-between" }
[
H.div
{ className: "document-layout__hdata__label" }
[
R2.acronym { title: "Digital object identifier" } [ H.text "DOI" ]
]
,
H.div
{ className: "document-layout__hdata__content w-100"
, id: getIdName "doi" }
[
if (TUV.validateURL doi) then
H.a {classname: "", on: { click: goToURLInNewTab $ doi }} [ H.text doi ]
else
H.text doi
]
]
,
R2.fromMaybe doc.bdd \bdd ->
H.div
{ className: "document-layout__hdata justify-content-space-between" }
[
B.div'
{ className: "document-layout__hdata__label" }
"Data source"
,
B.div'
{ className: "document-layout__hdata__content w-100"
, id: getIdName "bdd" }
bdd
]
,
H.div
{ className: "document-layout__hdata" }
[
B.div'
{ className: "document-layout__hdata__label" }
"Tag"
,
case path.mCorpusId of
Nothing -> H.div {} [] Nothing -> H.div {} []
Just corpusId -> ratingSimpleLoader { docId: path.nodeId Just corpusId -> ratingSimpleLoader { docId: path.nodeId
, corpusId , corpusId
, session: path.session } [] , session: path.session } []
]
-- , case path.mCorpusId of
-- Nothing -> H.div {} []
-- Just corpusId -> ratingSimpleLoader { docId: path.nodeId
-- , corpusId
-- , session: path.session } []
,
H.hr {}
, ,
R2.when hasAbstract $ R2.when hasAbstract $
...@@ -390,19 +438,5 @@ publicationDate (Document {publication_year: Just py, publication_month: Nothing ...@@ -390,19 +438,5 @@ publicationDate (Document {publication_year: Just py, publication_month: Nothing
publicationDate (Document {publication_year: Just py, publication_month: Just pm, publication_day: Nothing}) = (U.zeroPad 2 py) <> "-" <> (U.zeroPad 2 pm) publicationDate (Document {publication_year: Just py, publication_month: Just pm, publication_day: Nothing}) = (U.zeroPad 2 py) <> "-" <> (U.zeroPad 2 pm)
publicationDate (Document {publication_year: Just py, publication_month: Just pm, publication_day: Just pd}) = (U.zeroPad 2 py) <> "-" <> (U.zeroPad 2 pm) <> "-" <> (U.zeroPad 2 pd) publicationDate (Document {publication_year: Just py, publication_month: Just pm, publication_day: Just pd}) = (U.zeroPad 2 py) <> "-" <> (U.zeroPad 2 pm) <> "-" <> (U.zeroPad 2 pd)
-- btnSeeMore :: String -> R.Element
-- btnSeeMore idStr =
-- H.a { role: "button"
-- , className: "collapsed btn-seemore text-primary"
-- , data: { toggle: "collapse" }
-- , aria: { expanded: false, controls: getIdName idStr }
-- , href: "#" <> getIdName idStr
-- }
-- [ H.text "" ]
getIdName :: String -> String getIdName :: String -> String
getIdName str = "annotated-field-expand__" <> str getIdName str = "annotated-field-expand__" <> str
-- collapsibleClasses :: String
-- collapsibleClasses = " annotated-field-expand collapse"
...@@ -664,7 +664,7 @@ ngramsTableOrderWith orderBy = ...@@ -664,7 +664,7 @@ ngramsTableOrderWith orderBy =
-- This is used to *decorate* the Select header with the checkbox. -- This is used to *decorate* the Select header with the checkbox.
wrapColElts scProps _ (TT.ColumnName "Select") = const [NTSC.selectionCheckbox scProps] wrapColElts scProps _ (TT.ColumnName "Select") = const [NTSC.selectionCheckbox scProps]
wrapColElts _ scoreType (TT.ColumnName "Score") = (_ <> [H.text (" (" <> show scoreType <> ")")]) wrapColElts _ scoreType (TT.ColumnName "Score") = (_ <> [H.text (" (co-occurrences)")])
wrapColElts _ _ _ = identity wrapColElts _ _ _ = identity
type MkDispatchProps = type MkDispatchProps =
......
...@@ -761,8 +761,8 @@ tableCpt = here.component "table" cpt ...@@ -761,8 +761,8 @@ tableCpt = here.component "table" cpt
cs = cs =
wrapColElts c $ wrapColElts c $
case state.orderBy of case state.orderBy of
Just (ASC d) | c == d -> [lnk (Just (DESC c)) "ASC " , lnk Nothing (columnName c)] Just (ASC d) | c == d -> [lnk (Just (DESC c)) ("ASC " <> (columnName c))]
Just (DESC d) | c == d -> [lnk (Just (ASC c)) "DESC ", lnk Nothing (columnName c)] Just (DESC d) | c == d -> [lnk (Just (ASC c)) ("DESC " <> (columnName c))]
_ -> [lnk (Just (ASC c)) (columnName c)] _ -> [lnk (Just (ASC c)) (columnName c)]
pure $ container pure $ container
{ pageSizeControl: sizeDD { params } { pageSizeControl: sizeDD { params }
......
...@@ -229,6 +229,9 @@ named = flip $ defineProperty "name" ...@@ -229,6 +229,9 @@ named = flip $ defineProperty "name"
overState :: forall t. (t -> t) -> R.State t -> Effect Unit overState :: forall t. (t -> t) -> R.State t -> Effect Unit
overState f (_state /\ setState) = setState f overState f (_state /\ setState) = setState f
acronym :: ElemFactory
acronym = createDOM "acronym"
small :: ElemFactory small :: ElemFactory
small = createDOM "small" small = createDOM "small"
......
...@@ -15,7 +15,7 @@ $document-container-width: 780px ...@@ -15,7 +15,7 @@ $document-container-width: 780px
justify-content: space-between justify-content: space-between
padding: $card-spacer-y $card-spacer-x padding: $card-spacer-y $card-spacer-x
border-bottom: 1px solid $border-color border-bottom: 1px solid $border-color
margin-bottom: $card-spacer-y // margin-bottom: $card-spacer-y
&__main-controls &__main-controls
display: flex display: flex
...@@ -57,41 +57,25 @@ $document-container-width: 780px ...@@ -57,41 +57,25 @@ $document-container-width: 780px
font-weight: bold font-weight: bold
line-height: 1.4 line-height: 1.4
word-wrap: break-word word-wrap: break-word
margin-bottom: space-x(3) // margin-bottom: space-x(3)
font-family: $headings-font-family font-family: $headings-font-family
&__authors &__hdata
display: flex display: flex
margin-bottom: space-x(0.5) margin-bottom: space-x(0.5)
line-height: 1.3em
&__label
font-weight: bold
flex-basis: $label-column-size
flex-shrink: 0
font-size: 15px font-size: 15px
&__content
line-height: 1.2
color: $gray-800
&__source,
&__institutes,
&__date
display: flex
margin-bottom: space-x(0.5)
&__label &__label
font-weight: bold font-weight: bold
flex-basis: $label-column-size flex-basis: $label-column-size
flex-shrink: 0 flex-shrink: 0
font-size: 15px
&__content &__content
font-size: 15px
color: $gray-600 color: $gray-600
&__abstract &__abstract
margin-top: space-x(4) margin-top: space-x(3)
margin-bottom: space-x(3) margin-bottom: space-x(3)
&__content &__content
......
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