Commit 13709304 authored by Mudada's avatar Mudada

Merge

parents b82e5d28 1a4314d6
...@@ -1480,7 +1480,7 @@ ...@@ -1480,7 +1480,7 @@
"precise" "precise"
], ],
"repo": "https://github.com/poorscript/purescript-markdown", "repo": "https://github.com/poorscript/purescript-markdown",
"version": "master" "version": "2020-03-04"
}, },
"markdown-smolder": { "markdown-smolder": {
"dependencies": [ "dependencies": [
...@@ -1488,7 +1488,7 @@ ...@@ -1488,7 +1488,7 @@
"smolder" "smolder"
], ],
"repo": "https://github.com/poorscript/purescript-markdown-smolder", "repo": "https://github.com/poorscript/purescript-markdown-smolder",
"version": "master" "version": "2020-03-04"
}, },
"math": { "math": {
"dependencies": [], "dependencies": [],
...@@ -2061,7 +2061,7 @@ ...@@ -2061,7 +2061,7 @@
"prelude" "prelude"
], ],
"repo": "https://github.com/purescript-contrib/purescript-precise", "repo": "https://github.com/purescript-contrib/purescript-precise",
"version": "master" "version": "v4.0.0"
}, },
"prelude": { "prelude": {
"dependencies": [], "dependencies": [],
...@@ -2370,7 +2370,7 @@ ...@@ -2370,7 +2370,7 @@
"unsafe-coerce" "unsafe-coerce"
], ],
"repo": "https://github.com/irresponsible/purescript-reactix", "repo": "https://github.com/irresponsible/purescript-reactix",
"version": "v0.4.2" "version": "v0.4.3"
}, },
"read": { "read": {
"dependencies": [ "dependencies": [
...@@ -2988,8 +2988,8 @@ ...@@ -2988,8 +2988,8 @@
"react", "react",
"react-dom" "react-dom"
], ],
"repo": "https://github.com/np/purescript-thermite.git", "repo": "https://github.com/poorscript/purescript-thermite.git",
"version": "hide" "version": "hide-2020-03-04"
}, },
"these": { "these": {
"dependencies": [ "dependencies": [
...@@ -3235,6 +3235,13 @@ ...@@ -3235,6 +3235,13 @@
"repo": "https://github.com/natefaubion/purescript-variant.git", "repo": "https://github.com/natefaubion/purescript-variant.git",
"version": "v6.0.1" "version": "v6.0.1"
}, },
"versions": {
"dependencies": [
"prelude"
],
"repo": "https://github.com/hdgarrood/purescript-versions.git",
"version": "v5.0.1"
},
"web-clipboard": { "web-clipboard": {
"dependencies": [ "dependencies": [
"web-html" "web-html"
...@@ -3336,4 +3343,4 @@ ...@@ -3336,4 +3343,4 @@
"repo": "https://github.com/paf31/purescript-yargs.git", "repo": "https://github.com/paf31/purescript-yargs.git",
"version": "v4.0.0" "version": "v4.0.0"
} }
} }
\ No newline at end of file
...@@ -88,8 +88,15 @@ Some options: ...@@ -88,8 +88,15 @@ Some options:
Once you have node and yarn installed, you may install deps with: Once you have node and yarn installed, you may install deps with:
```shell ```shell
yarn install && yarn install-ps yarn install && yarn add psc-package && yarn install-ps && yarn build
``` ```
You need to copy index.html:
```shell
cp src/index.html dist/
```
(Be careful, to update or upgrade your install, maybe you need to remove
old files in node_modules).
### Development ### Development
......
This diff is collapsed.
This diff is collapsed.
.fa{
display:inline-block;
font:normal normal normal 14px/1 ForkAwesome;
font-size:inherit;
text-rendering:auto;
-webkit-font-smoothing:antialiased;
-moz-osx-font-smoothing:grayscale}
.fa-lg{
font-size:1.33333333em;
line-height:.75em;
vertical-align:-15%}
.fa-2x{
font-size:2em}
.fa-3x{
font-size:3em}
.fa-4x{
font-size:4em}
.fa-5x{
font-size:5em}
.fa-fw{
width:1.28571429em;
text-align:center}
.fa-ul{
padding-left:0;
margin-left:2.14285714em;
list-style-type:none}
.fa-ul>li{
position:relative}
.fa-li{
position:absolute;
left:-2.14285714em;
width:2.14285714em;
top:.14285714em;
text-align:center}
.fa-li.fa-lg{
left:-1.85714286em}
.fa-border{
padding:.2em .25em .15em;
border:solid .08em #eee;
border-radius:.1em}
.fa-pull-left{
float:left}
.fa-pull-right{
float:right}
.fa.fa-pull-left{
margin-right:.3em}
.fa.fa-pull-right{
margin-left:.3em}
.pull-right{
float:right}
.pull-left{
float:left}
.fa.pull-left{
margin-right:.3em}
.fa.pull-right{
margin-left:.3em}
.fa-spin{
-webkit-animation:fa-spin 2s infinite linear;
animation:fa-spin 2s infinite linear}
.fa-pulse{
-webkit-animation:fa-spin 1s infinite steps(8);
animation:fa-spin 1s infinite steps(8)}
@-webkit-keyframes fa-spin{
0%{
-webkit-transform:rotate(0);
transform:rotate(0)}
100%{
-webkit-transform:rotate(359deg);
transform:rotate(359deg)}
}
@keyframes fa-spin{
0%{
-webkit-transform:rotate(0);
transform:rotate(0)}
100%{
-webkit-transform:rotate(359deg);
transform:rotate(359deg)}
}
.fa-rotate-90{
-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
-webkit-transform:rotate(90deg);
-ms-transform:rotate(90deg);
transform:rotate(90deg)}
.fa-rotate-180{
-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";
-webkit-transform:rotate(180deg);
-ms-transform:rotate(180deg);
transform:rotate(180deg)}
.fa-rotate-270{
-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";
-webkit-transform:rotate(270deg);
-ms-transform:rotate(270deg);
transform:rotate(270deg)}
.fa-flip-horizontal{
-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";
-webkit-transform:scale(-1,1);
-ms-transform:scale(-1,1);
transform:scale(-1,1)}
.fa-flip-vertical{
-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";
-webkit-transform:scale(1,-1);
-ms-transform:scale(1,-1);
transform:scale(1,-1)}
:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{
filter:none}
.fa-stack{
position:relative;
display:inline-block;
width:2em;
height:2em;
line-height:2em;
vertical-align:middle}
.fa-stack-1x,.fa-stack-2x{
position:absolute;
left:0;
width:100%;
text-align:center}
.fa-stack-1x{
line-height:inherit}
.fa-stack-2x{
font-size:2em}
.fa-inverse{
color:#fff}
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
.code-editor .editor .code-area { .code-editor .editor .code-area {
flex-grow: 1; flex-grow: 1;
max-height: 200px; max-height: 200px;
min-width: 25%;
overflow: auto; overflow: auto;
} }
.code-editor .editor .code-area .code-container { .code-editor .editor .code-area .code-container {
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
.code-area .code-area
flex-grow: 1 flex-grow: 1
max-height: 200px max-height: 200px
min-width: 25%
overflow: auto overflow: auto
.code-container .code-container
background-color: #fafafa background-color: #fafafa
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#graph-explorer .graph-tree { #graph-explorer .graph-tree {
position: absolute; position: absolute;
max-height: 600px; max-height: 600px;
overflow-y: scroll;
top: 170px; top: 170px;
background-color: #fff;
z-index: 1; z-index: 1;
} }
#graph-explorer #graph-view { #graph-explorer #graph-view {
...@@ -26,13 +26,11 @@ ...@@ -26,13 +26,11 @@
#graph-explorer #sp-container { #graph-explorer #sp-container {
position: absolute; position: absolute;
max-height: 600px; max-height: 600px;
overflow-y: scroll;
top: 170px; top: 170px;
z-index: 1;
border: 1px white solid; border: 1px white solid;
background-color: white; background-color: white;
left: 70%; left: 70%;
width: 30%; width: 28%;
} }
#graph-explorer #sp-container #myTab { #graph-explorer #sp-container #myTab {
marginBottom: 18px; marginBottom: 18px;
......
@mixin sidePanelCommon @mixin sidePanelCommon
position: absolute position: absolute
max-height: 600px max-height: 600px
overflow-y: scroll //overflow-y: scroll
top: 170px top: 170px
z-index: 1 //z-index: 1
#graph-explorer #graph-explorer
#toolbar #toolbar
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
.graph-tree .graph-tree
@include sidePanelCommon @include sidePanelCommon
background-color: #fff
z-index: 1
#graph-view #graph-view
height: 95% height: 95%
...@@ -31,7 +33,7 @@ ...@@ -31,7 +33,7 @@
border: 1px white solid border: 1px white solid
background-color: white background-color: white
left: 70% left: 70%
width: 30% width: 28%
#myTab #myTab
marginBottom: 18px marginBottom: 18px
......
#dafixedtop {
z-index: 999;
}
.logoSmall { .logoSmall {
line-height: 15px; line-height: 15px;
height: 10px; height: 10px;
...@@ -46,9 +50,11 @@ li#rename #rename-a { ...@@ -46,9 +50,11 @@ li#rename #rename-a {
} }
#node-popup-tooltip { #node-popup-tooltip {
position: fixed;
background-color: white; background-color: white;
z-index: 1000; border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
} }
#node-popup-tooltip:hover { #node-popup-tooltip:hover {
border: none; border: none;
...@@ -61,6 +67,7 @@ li#rename #rename-a { ...@@ -61,6 +67,7 @@ li#rename #rename-a {
#node-popup-tooltip .popup-container .panel { #node-popup-tooltip .popup-container .panel {
border: 1px solid rgba(0, 0, 0, 0.2); border: 1px solid rgba(0, 0, 0, 0.2);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
margin-bottom: 0px;
} }
#node-popup-tooltip .popup-container .panel .glyphicon-pencil { #node-popup-tooltip .popup-container .panel .glyphicon-pencil {
color: black; color: black;
...@@ -99,23 +106,24 @@ li#rename #rename-a { ...@@ -99,23 +106,24 @@ li#rename #rename-a {
min-width: 200px; min-width: 200px;
} }
li a#rename { li .leaf {
display: none; display: flex;
position: absolute; flex-direction: row;
text-decoration: none; justify-content: flex-start;
left: 26px;
} }
li a#rename-leaf { li .leaf .folder-icon {
display: none; padding: 0 2 0 2;
position: absolute;
text-decoration: none;
margin-left: 20px;
} }
li:hover a#rename { li .leaf a.settings {
cursor: pointer;
display: block; display: block;
padding: 0 2 0 2;
text-decoration: none;
visibility: hidden;
z-index: 1;
} }
li:hover a#rename-leaf { li .leaf:hover a.settings {
display: block; visibility: visible;
} }
.glyphitem { .glyphitem {
...@@ -135,17 +143,6 @@ li:hover a#rename-leaf { ...@@ -135,17 +143,6 @@ li:hover a#rename-leaf {
transform: scale(1.4); transform: scale(1.4);
} }
#arrow {
width: 0;
height: 0;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
border-right: 10px solid darkgray;
position: relative;
top: 55px;
left: -9px;
}
#sp-container { #sp-container {
-webkit-transition: width 2s; -webkit-transition: width 2s;
transition: width 2s; transition: width 2s;
...@@ -162,13 +159,6 @@ li:hover a#rename-leaf { ...@@ -162,13 +159,6 @@ li:hover a#rename-leaf {
height: auto; height: auto;
} }
.tree {
margin-top: 10px;
}
.tree .file-dropped {
background-color: #d8dfe5;
}
#graph-tree .tree { #graph-tree .tree {
margin-top: 27px; margin-top: 27px;
} }
...@@ -211,4 +201,15 @@ a:focus, a:hover { ...@@ -211,4 +201,15 @@ a:focus, a:hover {
cursor: pointer; cursor: pointer;
} }
.copy-from-corpus .tree .node {
padding-left: 10px;
}
.copy-from-corpus .tree .node .name.clickable {
color: #337ab7;
cursor: pointer;
}
.copy-from-corpus .tree .node .name.clickable:hover {
text-decoration: underline;
}
/*# sourceMappingURL=Login.css.map */ /*# sourceMappingURL=Login.css.map */
#dafixedtop
z-index: 999 // correction for the popover
.logoSmall .logoSmall
line-height: 15px line-height: 15px
height: 10px height: 10px
...@@ -45,12 +48,11 @@ li#rename ...@@ -45,12 +48,11 @@ li#rename
#node-popup-tooltip #node-popup-tooltip
//position : absolute
position: fixed
//left : 96px
//top: -64px
background-color: white background-color: white
z-index: 1000 border-bottom-left-radius: 6px
border-bottom-right-radius: 6px
border-top-left-radius: 6px
border-top-right-radius: 6px
&:hover &:hover
border: none border: none
text-decoration: none text-decoration: none
...@@ -60,6 +62,7 @@ li#rename ...@@ -60,6 +62,7 @@ li#rename
.panel .panel
border: 1px solid rgba(0,0,0,0.2) border: 1px solid rgba(0,0,0,0.2)
box-shadow: 0 2px 5px rgba(0,0,0,0.2) box-shadow: 0 2px 5px rgba(0,0,0,0.2)
margin-bottom: 0px
.glyphicon-pencil .glyphicon-pencil
color: black color: black
.panel-body .panel-body
...@@ -96,24 +99,25 @@ li#rename ...@@ -96,24 +99,25 @@ li#rename
min-width: 200px min-width: 200px
li li
a#rename .leaf
display: none display: flex
position: absolute flex-direction: row
text-decoration: none justify-content: flex-start
left: 26px
a#rename-leaf .folder-icon
display: none padding: 0 2 0 2
position: absolute
text-decoration: none
margin-left: 20px
&:hover a.settings
a#rename cursor: pointer
display: block display: block
padding: 0 2 0 2
text-decoration: none
visibility: hidden
z-index: 1
a#rename-leaf &:hover
display: block a.settings
visibility: visible
.glyphitem .glyphitem
...@@ -132,16 +136,6 @@ li ...@@ -132,16 +136,6 @@ li
opacity: 1 opacity: 1
transform: scale(1.4) transform: scale(1.4)
#arrow
width: 0
height: 0
border-top: 10px solid transparent
border-bottom: 10px solid transparent
border-right:10px solid darkgray
position : relative
top: 55px
left: -9px
#sp-container #sp-container
-webkit-transition: width 2s // For Safari 3.1 to 6.0 -webkit-transition: width 2s // For Safari 3.1 to 6.0
transition: width 2s transition: width 2s
...@@ -156,11 +150,6 @@ li ...@@ -156,11 +150,6 @@ li
overflow: visible overflow: visible
height: auto height: auto
.tree
margin-top: 10px
.file-dropped
background-color: #d8dfe5
#graph-tree #graph-tree
.tree .tree
margin-top: 27px margin-top: 27px
...@@ -197,3 +186,14 @@ li ...@@ -197,3 +186,14 @@ li
a:focus, a:hover a:focus, a:hover
cursor: pointer cursor: pointer
.copy-from-corpus
.tree
.node
padding-left: 10px
.name
&.clickable
color: #337ab7
cursor: pointer
&:hover
text-decoration: underline
.tree {
margin-top: 10px;
}
.tree .file-dropped {
background-color: #d8dfe5;
}
.tree .node-actions {
padding-left: 5px;
}
.tree .node-actions .update-button.enabled {
cursor: pointer;
}
.tree .node-actions .update-button.disabled {
cursor: wait;
}
/*# sourceMappingURL=Tree.css.map */
.tree
margin-top: 10px
.file-dropped
background-color: #d8dfe5
.node-actions
padding-left: 5px
.update-button
&.enabled
cursor: pointer
&.disabled
cursor: wait
/*
Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <sourdrums@gmail.com>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #fdf6e3;
color: #657b83;
}
.hljs-comment,
.hljs-quote {
color: #93a1a1;
}
/* Solarized Green */
.hljs-keyword,
.hljs-selector-tag,
.hljs-addition {
color: #859900;
}
/* Solarized Cyan */
.hljs-number,
.hljs-string,
.hljs-meta .hljs-meta-string,
.hljs-literal,
.hljs-doctag,
.hljs-regexp {
color: #2aa198;
}
/* Solarized Blue */
.hljs-title,
.hljs-section,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class {
color: #268bd2;
}
/* Solarized Yellow */
.hljs-attribute,
.hljs-attr,
.hljs-variable,
.hljs-template-variable,
.hljs-class .hljs-title,
.hljs-type {
color: #b58900;
}
/* Solarized Orange */
.hljs-symbol,
.hljs-bullet,
.hljs-subst,
.hljs-meta,
.hljs-meta .hljs-keyword,
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-link {
color: #cb4b16;
}
/* Solarized Red */
.hljs-built_in,
.hljs-deletion {
color: #dc322f;
}
.hljs-formula {
background: #eee8d5;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
...@@ -13,53 +13,76 @@ dockerrun(){ ...@@ -13,53 +13,76 @@ dockerrun(){
sudo docker run -u "$UID" -e PATH="$P" -v $PWD:/app -w /app "$@" sudo docker run -u "$UID" -e PATH="$P" -v $PWD:/app -w /app "$@"
} }
NODE=node:buster-garg
dockerrunnode(){
dockerrun "$NODE" "$@"
}
unalias npm yarn bower pulp repl &>/dev/null || : unalias npm yarn bower pulp repl &>/dev/null || :
unset npm yarn bower pulp repl &>/dev/null || : unset npm yarn bower pulp repl &>/dev/null || :
npm(){ npm(){
dockerrun node npm "$@" dockerrunnode npm "$@"
} }
yarn(){ yarn(){
dockerrun node yarn "$@" dockerrunnode yarn "$@"
} }
bower(){ bower(){
dockerrun node bower "$@" dockerrunnode bower "$@"
} }
dependencies(){ dependencies(){
dockerrun node psc-dependencies "$@" dockerrunnode psc-dependencies "$@"
} }
package(){ package(){
dockerrun node psc-package "$@" dockerrunnode psc-package "$@"
} }
pulp(){ pulp(){
dockerrun node pulp --psc-package "$@" dockerrunnode pulp --psc-package "$@"
} }
repl(){ repl(){
dockerrun -ti node pulp --psc-package repl "$@" dockerrun -ti "$NODE" pulp --psc-package repl "$@"
}
sass(){
dockerrunnode yarn sass
} }
check(){ check(){
pulp test "$@" pulp test "$@"
} }
pscpackagehack(){
cp $HOME/bin/psc-package node_modules/.bin
}
setup(){ setup(){
yarn install && yarn install &&
yarn rebuild-set && yarn rebuild-set &&
pscpackagehack &&
yarn install-ps yarn install-ps
} }
build(){ build(){
pulp browserify --to dist/bundle.js echo prefer: compile
yarn build
#pulp browserify --to dist/bundle.js
}
compile(){
yarn compile
} }
serve(){ serve(){
dockerrun node http-server -p 2015 --cors dist #yarn dev
#dockerrunnode http-server -p 2015 --cors dist
dockerrunnode webpack-dev-server --env dev --mode development
} }
dev(){ dev(){
......
{ {
"name": "Gargantext",
"version": "0.0.1.3.2",
"scripts": { "scripts": {
"rebase-set": "spago package-set-upgrade && spago psc-package-insdhall", "rebase-set": "spago package-set-upgrade && spago psc-package-insdhall",
"rebuild-set": "spago psc-package-insdhall", "rebuild-set": "spago psc-package-insdhall",
...@@ -25,6 +27,7 @@ ...@@ -25,6 +27,7 @@
"highlightjs": "^9.16.2", "highlightjs": "^9.16.2",
"prop-types": "15.6.2", "prop-types": "15.6.2",
"react": "^16.10", "react": "^16.10",
"react-awesome-popover": "^6.1.1",
"react-dom": "^16.10", "react-dom": "^16.10",
"sigma": "git://github.com/poorscript/sigma.js#garg" "sigma": "git://github.com/poorscript/sigma.js#garg"
}, },
...@@ -50,7 +53,7 @@ ...@@ -50,7 +53,7 @@
"imports-loader": "^0.8.0", "imports-loader": "^0.8.0",
"mini-css-extract-plugin": "^0.5.0", "mini-css-extract-plugin": "^0.5.0",
"psc": "^0.1.1", "psc": "^0.1.1",
"psc-package": "^3.0.1", "psc-package": "^4.0.0",
"pulp": "^13.0.0", "pulp": "^13.0.0",
"purescript": "^0.13.6", "purescript": "^0.13.6",
"purescript-language-server": "^0.12.7", "purescript-language-server": "^0.12.7",
......
This diff is collapsed.
import (
builtins.fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/ece829033b7b8f4e81261fef5427144df4147bc4.tar.gz";
sha256 = "07n91k3d9i9pym8npsszha9mnvg4d1r0l0ldnhk4g8sx15vv1br5";
}
)
{ {
"name": "gargantext", "name": "gargantext",
"set": "local", "set": "local",
"source": ".psc-package", "source": ".psc-package/local/.set/packages.json",
"depends": [ "depends": [
"affjax", "affjax",
"argonaut", "argonaut",
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
"random", "random",
"reactix", "reactix",
"read", "read",
"record-extra",
"routing", "routing",
"sequences", "sequences",
"smolder", "smolder",
...@@ -39,6 +40,7 @@ ...@@ -39,6 +40,7 @@
"tuples-native", "tuples-native",
"uint", "uint",
"uri", "uri",
"versions",
"web-html" "web-html"
] ]
} }
This diff is collapsed.
{ pkgs ? import ./pinned.nix {} }:
let
easy-ps = import (
pkgs.fetchFromGitHub {
owner = "justinwoo";
repo = "easy-purescript-nix";
rev = "14e7d85431e9f9838d7107d18cb79c7fa534f54e";
sha256 = "0lmkppidmhnayv0919990ifdd61f9d23dzjzr8amz7hjgc74yxs0";
}
) {
inherit pkgs;
};
soba = import (
pkgs.fetchFromGitHub {
owner = "justinwoo";
repo = "soba";
rev = "2add8804bce7e7c1ab5eb1c3d8f6783e938a04d3";
sha256 = "1qagyklcllr2sxdb315prw33af6g37762zgk2ahh3ifxpns6ifxx";
}
) {
inherit pkgs;
};
purs-packages = import ./purs-packages.nix { inherit pkgs; };
cpPackage = pp:
let
target = ".psc-package/local/${pp.name}/${pp.version}";
in
''
mkdir -p ${target}
cp --no-preserve=mode,ownership,timestamp -r ${pp.fetched.outPath}/* ${target}
'';
install-purs-packages = pkgs.writeShellScriptBin "install-purs-packages" ''
#!/usr/bin/env bash
${builtins.toString (builtins.map cpPackage (builtins.attrValues purs-packages))}
echo done installing deps.
'';
build-purs = pkgs.writeShellScriptBin "build-purs" ''
#!/usr/bin/env bash
purs compile "src/**/*.purs" ".psc-package/*/*/*/src/**/*.purs"
'';
storePath = x: ''"${x.fetched.outPath}/src/**/*.purs"'';
build-purs-from-store = pkgs.writeShellScriptBin "build-purs-from-store" ''
#!/usr/bin/env bash
purs compile "src/**/*.purs" \
${builtins.toString (builtins.map storePath (builtins.attrValues purs-packages))}
'';
in
pkgs.mkShell {
buildInputs = [
easy-ps.purs
easy-ps.psc-package
soba
install-purs-packages
build-purs
build-purs-from-store
pkgs.yarn
];
}
## how to build the project with nix dependencies:
#
# 1. start a nix shell (e.g. `nix-shell -j 20`, this uses 20 jobs to fetch deps)
# 2. run `yarn` to install npm deps
# 3. run `install-purs-packages` if you want dependencies locally, available for psc-package and for inspection
# 4. run `build-purs` to build from local sources. otherwise use `build-purs-from-store`.
#
# note that the purescript compiler uses filepaths and timestamps, so using the above two commands
# interchangeably will lead to constant rebuilding of the entire project.
#
## how to update purs-packages.nix
#
# 1. run `soba insdhall` to generate packages.json
# 2. run `soba nix` to generate a nix derivation from packages.json
...@@ -6,8 +6,14 @@ import Data.Array (fromFoldable) ...@@ -6,8 +6,14 @@ import Data.Array (fromFoldable)
import Data.Foldable (intercalate) import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..), maybe') import Data.Maybe (Maybe(..), maybe')
import Data.Tuple (fst, snd) import Data.Tuple (fst, snd)
import Gargantext.Components.Data.Lang (Lang(..)) import Data.Tuple.Nested ((/\))
import Gargantext.Components.Folder (folder) import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Components.Lang (LandingLang(..))
import Gargantext.Components.Forest (forest) import Gargantext.Components.Forest (forest)
import Gargantext.Components.GraphExplorer (explorerLayout) import Gargantext.Components.GraphExplorer (explorerLayout)
import Gargantext.Components.Login (login) import Gargantext.Components.Login (login)
...@@ -27,8 +33,7 @@ import Gargantext.Routes (AppRoute(..)) ...@@ -27,8 +33,7 @@ import Gargantext.Routes (AppRoute(..))
import Gargantext.Sessions (Sessions, useSessions) import Gargantext.Sessions (Sessions, useSessions)
import Gargantext.Sessions as Sessions import Gargantext.Sessions as Sessions
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix as R import Gargantext.Version as GV
import Reactix.DOM.HTML as H
-- TODO (what does this mean?) -- TODO (what does this mean?)
-- tree changes endConfig state => trigger endConfig change in outerLayout, layoutFooter etc -- tree changes endConfig state => trigger endConfig change in outerLayout, layoutFooter etc
...@@ -46,21 +51,36 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where ...@@ -46,21 +51,36 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
showLogin <- R.useState' false showLogin <- R.useState' false
showCorpus <- R.useState' false showCorpus <- R.useState' false
let forested = forestLayout frontends (fst sessions) (fst route) (snd showLogin) treeReload <- R.useState' 0
let forested child = forestLayout { child
, frontends
, reload: treeReload
, route: fst route
, sessions: fst sessions
, showLogin: snd showLogin }
let mCurrentRoute = fst route let mCurrentRoute = fst route
let backends = fromFoldable defaultBackends let backends = fromFoldable defaultBackends
let withSession = \sid f -> maybe' (\_ -> forested $ homeLayout EN) f $ Sessions.lookup sid (fst sessions) let ff f session = R.fragment [ f session, version { session } ]
let withSession sid f =
maybe' (const $ forested $ homeLayout LL_EN) (ff f) $ Sessions.lookup sid (fst sessions)
pure $ case fst showLogin of pure $ case fst showLogin of
true -> forested $ login { sessions, backends, visible: showLogin } true -> forested $ login { sessions, backends, visible: showLogin }
false -> false ->
case fst route of case fst route of
Home -> forested $ homeLayout EN Home -> forested $ homeLayout LL_EN
Login -> login { sessions, backends, visible: showLogin } Login -> login { sessions, backends, visible: showLogin }
Folder sid _ -> withSession sid $ \_ -> forested (folder {}) --Folder sid _ -> withSession sid $ \_ -> forested (folder {})
Corpus sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { nodeId, session } Folder sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
FolderPrivate sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
FolderPublic sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
FolderShared sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
Team sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
Corpus sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
Texts sid nodeId -> withSession sid $ \session -> forested $ textsLayout { nodeId, session, frontends } Texts sid nodeId -> withSession sid $ \session -> forested $ textsLayout { nodeId, session, frontends }
Lists sid nodeId -> withSession sid $ \session -> forested $ listsLayout { nodeId, session } Lists sid nodeId -> withSession sid $ \session -> forested $ listsLayout { nodeId, session }
Dashboard sid _nodeId -> withSession sid $ \session -> forested $ dashboardLayout {} Dashboard sid nodeId -> withSession sid $ \session -> forested $ dashboardLayout { nodeId, session }
Annuaire sid nodeId -> withSession sid $ \session -> forested $ annuaireLayout { frontends, nodeId, session } Annuaire sid nodeId -> withSession sid $ \session -> forested $ annuaireLayout { frontends, nodeId, session }
UserPage sid nodeId -> withSession sid $ \session -> forested $ userLayout { frontends, nodeId, session } UserPage sid nodeId -> withSession sid $ \session -> forested $ userLayout { frontends, nodeId, session }
ContactPage sid aId nodeId -> withSession sid $ \session -> forested $ annuaireUserLayout { annuaireId: aId, frontends, nodeId, session } ContactPage sid aId nodeId -> withSession sid $ \session -> forested $ annuaireUserLayout { annuaireId: aId, frontends, nodeId, session }
...@@ -73,18 +93,32 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where ...@@ -73,18 +93,32 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
withSession sid $ withSession sid $
\session -> \session ->
simpleLayout $ simpleLayout $
explorerLayout { graphId, mCurrentRoute, session explorerLayout { frontends
, sessions: (fst sessions), frontends , graphId
, showLogin } , mCurrentRoute
, session
, sessions: (fst sessions)
, showLogin
, treeReload }
type ForestLayoutProps =
(
child :: R.Element
, frontends :: Frontends
, reload :: R.State Int
, route :: AppRoute
, sessions :: Sessions
, showLogin :: R2.Setter Boolean
)
forestLayout :: Frontends -> Sessions -> AppRoute -> R2.Setter Boolean -> R.Element -> R.Element forestLayout :: Record ForestLayoutProps -> R.Element
forestLayout frontends sessions route showLogin child = do forestLayout { child, frontends, reload, route, sessions, showLogin } = do
R.fragment [ topBar {}, R2.row [main], footer {} ] R.fragment [ topBar {}, R2.row [main], footer { } ]
where where
main = main =
R.fragment R.fragment
[ H.div {className: "col-md-2", style: {paddingTop: "60px"}} [ H.div {className: "col-md-2", style: {paddingTop: "60px"}}
[ forest {sessions, route, frontends, showLogin } ] [ forest { frontends, reload, route, sessions, showLogin } ]
, mainPage child , mainPage child
] ]
...@@ -215,34 +249,65 @@ liNav (LiNav { title : title' ...@@ -215,34 +249,65 @@ liNav (LiNav { title : title'
] ]
] ]
type VersionProps =
(
session :: Sessions.Session
)
version :: Record VersionProps -> R.Element
version props = R.createElement versionCpt props []
versionCpt :: R.Component VersionProps
versionCpt = R.hooksComponent "G.C.A.version" cpt
where
cpt { session } _ = do
(ver /\ setVer) <- R.useState' "No Backend Version"
R.useEffect' $ do
launchAff_ $ do
v <- GV.getBackendVersion session
liftEffect $ setVer $ const v
pure $ H.div { className: "container" } [
H.footer {}
[
H.span {} [ H.text $ "Frontend version: " <> GV.version <> ", " ]
, H.span {} [ H.text $ "backend version: " <> ver ]
, warning ver GV.version
]
]
warning backendVer frontendVer =
if backendVer == frontendVer then
H.div {} []
else
H.div { className: "text-danger" } [ H.text "Versions do not match" ]
footer :: {} -> R.Element footer :: {} -> R.Element
footer props = R.createElement footerCpt props [] footer props = R.createElement footerCpt props []
footerCpt :: R.Component () footerCpt :: R.Component ()
footerCpt = R.staticComponent "G.C.Layout.footer" cpt footerCpt = R.hooksComponent "G.C.A.footer" cpt
where where
cpt _ _ = cpt _ _ = do
H.div { className: "container" } pure $ H.div { className: "container" }
[ H.hr {} [ H.hr {}
, H.footer {} , H.footer {}
[ H.p {} [ H.p {}
[ H.text "Gargantext " [ H.text "Gargantext "
, H.span {className: "glyphicon glyphicon-registration-mark"} [] , H.span {className: "glyphicon glyphicon-registration-mark"} []
, H.text ", version 4.0" , H.a { href: "http://www.cnrs.fr"
, H.a { href: "http://www.cnrs.fr" , target: "blank"
, target: "blank" , title: "Project hosted by CNRS."
, title: "Project hosted by CNRS." }
} [ H.text ", Copyrights "
[ H.text ", Copyrights " , H.span { className: "glyphicon glyphicon-copyright-mark" } []
, H.span { className: "glyphicon glyphicon-copyright-mark" } [] , H.text " CNRS 2017-Present"
, H.text " CNRS 2017-Present" ]
] , H.a { href: "http://gitlab.iscpif.fr/humanities/gargantext/blob/stable/LICENSE"
, H.a { href: "http://gitlab.iscpif.fr/humanities/gargantext/blob/stable/LICENSE" , target: "blank"
, target: "blank" , title: "Legal instructions of the project."
, title: "Legal instructions of the project." }
} [ H.text ", Licences aGPLV3 and CECILL variant Affero compliant" ]
[ H.text ", Licences aGPLV3 and CECILL variant Affero compliant" ] , H.text "."
, H.text "." ]]
]]
] ]
module Gargantext.Components.CodeEditor where module Gargantext.Components.CodeEditor where
import DOM.Simple.Types (Element)
import Data.Argonaut.Parser (jsonParser) import Data.Argonaut.Parser (jsonParser)
import Data.Either (either, Either(..)) import Data.Either (either, Either(..))
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
...@@ -8,11 +9,10 @@ import Data.Generic.Rep.Show (genericShow) ...@@ -8,11 +9,10 @@ import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable, null, toMaybe) import Data.Nullable (Nullable, null, toMaybe)
import Data.String.Utils (endsWith) import Data.String.Utils (endsWith)
import Data.Tuple (fst) import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import DOM.Simple.Types (Element)
import Effect (Effect) import Effect (Effect)
import FFI.Simple ((.=), delay) import FFI.Simple ((.=))
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Text.Markdown.SlamDown.Parser (parseMd) import Text.Markdown.SlamDown.Parser (parseMd)
...@@ -99,17 +99,10 @@ codeEditorCpt = R.hooksComponent "G.C.CE.CodeEditor" cpt ...@@ -99,17 +99,10 @@ codeEditorCpt = R.hooksComponent "G.C.CE.CodeEditor" cpt
cpt {code, defaultCodeType, onChange} _ = do cpt {code, defaultCodeType, onChange} _ = do
controls <- initControls code defaultCodeType controls <- initControls code defaultCodeType
-- Initial rendering of elements with given data R.useEffect2' (fst controls.codeS) (fst controls.codeType) $ do
let code' = fst controls.codeS
-- Note: delay is necessary here, otherwise initially the HTML won't get setCodeOverlay controls code'
-- rendered (DOM Element refs are still null) renderHtml code' controls
R.useEffectOnce $ delay unit $ \_ -> do
_ <- renderHtml code controls
pure $ pure unit
R.useEffectOnce $ delay unit $ \_ -> do
_ <- setCodeOverlay controls code
pure $ pure unit
pure $ H.div { className: "code-editor" } [ pure $ H.div { className: "code-editor" } [
toolbar {controls, onChange} toolbar {controls, onChange}
...@@ -127,7 +120,7 @@ codeEditorCpt = R.hooksComponent "G.C.CE.CodeEditor" cpt ...@@ -127,7 +120,7 @@ codeEditorCpt = R.hooksComponent "G.C.CE.CodeEditor" cpt
-- , contentEditable: "true" -- , contentEditable: "true"
, ref: controls.codeOverlayElRef , ref: controls.codeOverlayElRef
, rows: 30 , rows: 30
--, on: { input: onEditChange (fst codeType) codeElRef htmlRef editorCodeRef error } --, on: { input: onEditChange (fst codeType) codeElRef htmlRef codeRef error }
} [] } []
] ]
] ]
...@@ -148,8 +141,8 @@ codeEditorCpt = R.hooksComponent "G.C.CE.CodeEditor" cpt ...@@ -148,8 +141,8 @@ codeEditorCpt = R.hooksComponent "G.C.CE.CodeEditor" cpt
dividerHidden _ = " hidden" dividerHidden _ = " hidden"
langClass :: CodeType -> String langClass :: CodeType -> String
langClass Haskell = " language-haskell" langClass Haskell = " language-haskell"
langClass JSON = " language-json" langClass JSON = " language-json"
langClass Markdown = " language-md" langClass Markdown = " language-md"
previewHidden :: ViewType -> String previewHidden :: ViewType -> String
...@@ -158,11 +151,9 @@ codeEditorCpt = R.hooksComponent "G.C.CE.CodeEditor" cpt ...@@ -158,11 +151,9 @@ codeEditorCpt = R.hooksComponent "G.C.CE.CodeEditor" cpt
previewHidden _ = " hidden" previewHidden _ = " hidden"
onEditChange :: forall e. Record Controls -> (CodeType -> Code -> Effect Unit) -> e -> Effect Unit onEditChange :: forall e. Record Controls -> (CodeType -> Code -> Effect Unit) -> e -> Effect Unit
onEditChange controls@{codeElRef, codeOverlayElRef, codeType: (codeType /\ _), editorCodeRef} onChange e = do onEditChange controls@{codeElRef, codeOverlayElRef, codeType: (codeType /\ _), codeS} onChange e = do
let code = R2.unsafeEventValue e let code = R2.unsafeEventValue e
R.setRef editorCodeRef code snd codeS $ const code
setCodeOverlay controls code
renderHtml (R.readRef controls.editorCodeRef) controls
onChange codeType code onChange codeType code
setCodeOverlay :: Record Controls -> Code -> Effect Unit setCodeOverlay :: Record Controls -> Code -> Effect Unit
...@@ -214,11 +205,9 @@ toolbarCpt = R.hooksComponent "G.C.CE.toolbar" cpt ...@@ -214,11 +205,9 @@ toolbarCpt = R.hooksComponent "G.C.CE.toolbar" cpt
-- Handle rerendering of preview when viewType changed -- Handle rerendering of preview when viewType changed
onChangeCodeType :: forall e. Record ToolbarProps -> e -> Effect Unit onChangeCodeType :: forall e. Record ToolbarProps -> e -> Effect Unit
onChangeCodeType {controls, onChange} _ = do onChangeCodeType {controls, onChange} _ = do
setCodeOverlay controls code
renderHtml code controls
onChange (fst controls.codeType) code onChange (fst controls.codeType) code
where where
code = R.readRef controls.editorCodeRef code = fst controls.codeS
type ErrorComponentProps = type ErrorComponentProps =
...@@ -251,9 +240,10 @@ codeTypeSelectorCpt = R.hooksComponent "G.C.CE.CodeTypeSelector" cpt ...@@ -251,9 +240,10 @@ codeTypeSelectorCpt = R.hooksComponent "G.C.CE.CodeTypeSelector" cpt
where where
cpt {codeType, onChange} _ = do cpt {codeType, onChange} _ = do
pure $ R2.select { className: "form-control" pure $ R2.select { className: "form-control"
, on: { change: onSelectChange codeType onChange } , defaultValue: show $ fst codeType
, style: { width: "150px" } , on: { change: onSelectChange codeType onChange }
, value: show $ fst codeType } , style: { width: "150px" }
}
(option <$> [Haskell, JSON, Markdown]) (option <$> [Haskell, JSON, Markdown])
option :: CodeType -> R.Element option :: CodeType -> R.Element
...@@ -310,9 +300,9 @@ viewTypeSelectorCpt = R.hooksComponent "G.C.CE.ViewTypeSelector" cpt ...@@ -310,9 +300,9 @@ viewTypeSelectorCpt = R.hooksComponent "G.C.CE.ViewTypeSelector" cpt
type Controls = type Controls =
( (
codeElRef :: R.Ref (Nullable Element) codeElRef :: R.Ref (Nullable Element)
, codeS :: R.State Code
, codeType :: R.State CodeType , codeType :: R.State CodeType
, codeOverlayElRef :: R.Ref (Nullable Element) , codeOverlayElRef :: R.Ref (Nullable Element)
, editorCodeRef :: R.Ref Code
, error :: R.State (Maybe Error) , error :: R.State (Maybe Error)
, htmlElRef :: R.Ref (Nullable Element) , htmlElRef :: R.Ref (Nullable Element)
, viewType :: R.State ViewType , viewType :: R.State ViewType
...@@ -321,19 +311,25 @@ type Controls = ...@@ -321,19 +311,25 @@ type Controls =
initControls :: Code -> CodeType -> R.Hooks (Record Controls) initControls :: Code -> CodeType -> R.Hooks (Record Controls)
initControls code defaultCodeType = do initControls code defaultCodeType = do
htmlElRef <- R.useRef null htmlElRef <- R.useRef null
codeS <- R.useState' code
codeElRef <- R.useRef null codeElRef <- R.useRef null
codeOverlayElRef <- R.useRef null codeOverlayElRef <- R.useRef null
codeType <- R.useState' defaultCodeType codeType <- R.useState' defaultCodeType
editorCodeRef <- R.useRef code
error <- R.useState' Nothing error <- R.useState' Nothing
viewType <- R.useState' Both viewType <- R.useState' Preview
pure $ { pure $ {
codeElRef codeElRef
, codeS
, codeType , codeType
, codeOverlayElRef , codeOverlayElRef
, editorCodeRef
, error , error
, htmlElRef , htmlElRef
, viewType , viewType
} }
reinitControls :: Record Controls -> Code -> CodeType -> Effect Unit
reinitControls c@{codeType, codeS, error} code defaultCodeType = do
snd codeType $ const defaultCodeType
snd codeS $ const code
snd error $ const Nothing
...@@ -33,7 +33,7 @@ import Gargantext.Utils.Reactix as R2 ...@@ -33,7 +33,7 @@ import Gargantext.Utils.Reactix as R2
import Gargantext.Routes as Routes import Gargantext.Routes as Routes
import Gargantext.Routes (SessionRoute(NodeAPI)) import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, sessionId, post, delete, put) import Gargantext.Sessions (Session, sessionId, post, delete, put)
import Gargantext.Types (NodeType(..), OrderBy(..), TabType, TabPostQuery(..), AffTableResult) import Gargantext.Types (NodeType(..), OrderBy(..), TabType, TabPostQuery(..), AffTableResult, NodeID)
------------------------------------------------------------------------ ------------------------------------------------------------------------
data Category = Trash | UnRead | Checked | Topic | Favorite data Category = Trash | UnRead | Checked | Topic | Favorite
...@@ -143,7 +143,6 @@ categoryRoute nodeId = NodeAPI Node (Just nodeId) "category" ...@@ -143,7 +143,6 @@ categoryRoute nodeId = NodeAPI Node (Just nodeId) "category"
putCategories :: Session -> Int -> CategoryQuery -> Aff (Array Int) putCategories :: Session -> Int -> CategoryQuery -> Aff (Array Int)
putCategories session nodeId = put session $ categoryRoute nodeId putCategories session nodeId = put session $ categoryRoute nodeId
type NodeID = Int
type TotalRecords = Int type TotalRecords = Int
type LayoutProps = type LayoutProps =
...@@ -343,7 +342,7 @@ loadPage session {nodeId, tabType, query, listId, corpusId, params: {limit, offs ...@@ -343,7 +342,7 @@ loadPage session {nodeId, tabType, query, listId, corpusId, params: {limit, offs
let docs = res2corpus <$> res.docs let docs = res2corpus <$> res.docs
pure $ pure $
if mock then if mock then
Tuple 4737 (take limit $ drop offset sampleData) Tuple 0 (take limit $ drop offset sampleData)
else else
Tuple res.count docs Tuple res.count docs
where where
......
...@@ -25,13 +25,12 @@ import Gargantext.Components.Table as T ...@@ -25,13 +25,12 @@ import Gargantext.Components.Table as T
import Gargantext.Routes (SessionRoute(Search, NodeAPI)) import Gargantext.Routes (SessionRoute(Search, NodeAPI))
import Gargantext.Routes as Routes import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId, post, deleteWithBody) import Gargantext.Sessions (Session, sessionId, post, deleteWithBody)
import Gargantext.Types (NodeType(..), OrderBy(..), NodePath(..)) import Gargantext.Types (NodeType(..), OrderBy(..), NodePath(..), NodeID)
import Gargantext.Utils (toggleSet, zeroPad) import Gargantext.Utils (toggleSet, zeroPad)
import Gargantext.Utils.DecodeMaybe ((.|)) import Gargantext.Utils.DecodeMaybe ((.|))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
------------------------------------------------------------------------ ------------------------------------------------------------------------
type NodeID = Int
type TotalRecords = Int type TotalRecords = Int
-- Example: -- Example:
......
...@@ -4,21 +4,23 @@ import Gargantext.Prelude ...@@ -4,21 +4,23 @@ import Gargantext.Prelude
import Data.Array as A import Data.Array as A
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Set (Set)
import Data.Set as Set import Data.Set as Set
import Data.Tuple (fst) import Data.Tuple (fst)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Components.Forest.Tree (treeView) import Gargantext.Components.Forest.Tree (treeView)
import Gargantext.Components.Login.Types (TreeId) import Gargantext.Components.Forest.Tree.Node.Action (Reload)
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Routes (AppRoute) import Gargantext.Routes (AppRoute)
import Gargantext.Sessions (Session(..), Sessions, unSessions) import Gargantext.Sessions (Session(..), Sessions, OpenNodes, unSessions)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
type Props = type Props =
( frontends :: Frontends ( frontends :: Frontends
, reload :: R.State Int
, route :: AppRoute , route :: AppRoute
, sessions :: Sessions , sessions :: Sessions
, showLogin :: R2.Setter Boolean , showLogin :: R2.Setter Boolean
...@@ -29,15 +31,19 @@ forest props = R.createElement forestCpt props [] ...@@ -29,15 +31,19 @@ forest props = R.createElement forestCpt props []
forestCpt :: R.Component Props forestCpt :: R.Component Props
forestCpt = R.hooksComponent "G.C.Forest.forest" cpt where forestCpt = R.hooksComponent "G.C.Forest.forest" cpt where
cpt {frontends, route, sessions, showLogin } _ = do cpt { frontends, reload: extReload, route, sessions, showLogin } _ = do
openNodes <- R2.useLocalStorageState R2.openNodesKey (Set.empty :: Set TreeId) -- NOTE: this is a hack to reload the tree view on demand
R2.useCache (frontends /\ route /\ sessions /\ fst openNodes) (cpt' openNodes showLogin) reload <- R.useState' (0 :: Reload)
cpt' openNodes showLogin (frontends /\ route /\ sessions /\ openNodesState) = do openNodes <- R2.useLocalStorageState R2.openNodesKey (Set.empty :: OpenNodes)
R2.useCache
(frontends /\ route /\ sessions /\ fst openNodes /\ fst extReload /\ fst reload)
(cpt' openNodes reload showLogin)
cpt' openNodes reload showLogin (frontends /\ route /\ sessions /\ _ /\ _ /\ _) = do
pure $ R.fragment $ A.cons (plus showLogin) trees pure $ R.fragment $ A.cons (plus showLogin) trees
where where
trees = tree <$> unSessions sessions trees = tree <$> unSessions sessions
tree s@(Session {treeId}) = tree s@(Session {treeId}) =
treeView { root: treeId, frontends, mCurrentRoute: Just route, session: s, openNodes } treeView { root: treeId, frontends, mCurrentRoute: Just route, session: s, openNodes, reload }
plus :: R2.Setter Boolean -> R.Element plus :: R2.Setter Boolean -> R.Element
plus showLogin = plus showLogin =
...@@ -51,4 +57,4 @@ plus showLogin = ...@@ -51,4 +57,4 @@ plus showLogin =
-- [ H.i { className: "material-icons md-36"} [] ] -- [ H.i { className: "material-icons md-36"} [] ]
where where
click _ = do click _ = do
showLogin (const true) showLogin $ const true
This diff is collapsed.
...@@ -22,6 +22,7 @@ data NodeAction = Documentation NodeType ...@@ -22,6 +22,7 @@ data NodeAction = Documentation NodeType
| Move | Clone | Delete | Move | Clone | Delete
| Share | Link NodeType | Share | Link NodeType
| Add (Array NodeType) | Add (Array NodeType)
| CopyFromCorpus
instance eqNodeAction :: Eq NodeAction where instance eqNodeAction :: Eq NodeAction where
...@@ -36,6 +37,7 @@ instance eqNodeAction :: Eq NodeAction where ...@@ -36,6 +37,7 @@ instance eqNodeAction :: Eq NodeAction where
eq Share Share = true eq Share Share = true
eq (Link x) (Link y) = true && (x == y) eq (Link x) (Link y) = true && (x == y)
eq (Add x) (Add y) = true && (x == y) eq (Add x) (Add y) = true && (x == y)
eq CopyFromCorpus CopyFromCorpus = true
eq _ _ = false eq _ _ = false
instance showNodeAction :: Show NodeAction where instance showNodeAction :: Show NodeAction where
...@@ -50,6 +52,7 @@ instance showNodeAction :: Show NodeAction where ...@@ -50,6 +52,7 @@ instance showNodeAction :: Show NodeAction where
show Share = "Share" show Share = "Share"
show (Link x) = "Link to " <> show x show (Link x) = "Link to " <> show x
show (Add xs) = foldl (\a b -> a <> show b) "Add " xs show (Add xs) = foldl (\a b -> a <> show b) "Add " xs
show CopyFromCorpus = "Copy from corpus"
glyphiconNodeAction :: NodeAction -> String glyphiconNodeAction :: NodeAction -> String
...@@ -60,6 +63,7 @@ glyphiconNodeAction SearchBox = "search" ...@@ -60,6 +63,7 @@ glyphiconNodeAction SearchBox = "search"
glyphiconNodeAction Upload = "upload" glyphiconNodeAction Upload = "upload"
glyphiconNodeAction (Link _) = "transfer" glyphiconNodeAction (Link _) = "transfer"
glyphiconNodeAction Download = "download" glyphiconNodeAction Download = "download"
glyphiconNodeAction CopyFromCorpus = "random"
glyphiconNodeAction _ = "" glyphiconNodeAction _ = ""
...@@ -78,33 +82,25 @@ settingsBox NodeUser = SettingsBox { ...@@ -78,33 +82,25 @@ settingsBox NodeUser = SettingsBox {
show: true show: true
, edit : false , edit : false
, doc : Documentation NodeUser , doc : Documentation NodeUser
, buttons : [ SearchBox , buttons : [ Delete ]
, Add [ FolderPrivate
, FolderShared
, FolderPublic
]
, Delete
]
} }
settingsBox FolderPrivate = SettingsBox { settingsBox FolderPrivate = SettingsBox {
show: true show: true
, edit : false , edit : false
, doc : Documentation FolderPrivate , doc : Documentation FolderPrivate
, buttons : [ SearchBox , buttons : [ Add [ Corpus
, Add [ Corpus
, Folder , Folder
, Annuaire , Annuaire
] ]
, Delete] ]
} }
settingsBox Team = SettingsBox { settingsBox Team = SettingsBox {
show: true show: true
, edit : false , edit : true
, doc : Documentation Team , doc : Documentation Team
, buttons : [ SearchBox , buttons : [ Add [ Corpus
, Add [ Corpus
, Folder , Folder
, Annuaire , Annuaire
] ]
...@@ -116,7 +112,7 @@ settingsBox FolderShared = SettingsBox { ...@@ -116,7 +112,7 @@ settingsBox FolderShared = SettingsBox {
, edit : true , edit : true
, doc : Documentation FolderShared , doc : Documentation FolderShared
, buttons : [ Add [Team, FolderShared] , buttons : [ Add [Team, FolderShared]
, Delete -- , Delete
] ]
} }
...@@ -124,11 +120,9 @@ settingsBox FolderPublic = SettingsBox { ...@@ -124,11 +120,9 @@ settingsBox FolderPublic = SettingsBox {
show: true show: true
, edit : false , edit : false
, doc : Documentation FolderPublic , doc : Documentation FolderPublic
, buttons : [{-, SearchBox , buttons : [ Add [ Corpus
, Add [ Corpus , Folder
, Folder ]
]-}
Delete
] ]
} }
...@@ -136,8 +130,7 @@ settingsBox Folder = SettingsBox { ...@@ -136,8 +130,7 @@ settingsBox Folder = SettingsBox {
show: true show: true
, edit : true , edit : true
, doc : Documentation Folder , doc : Documentation Folder
, buttons : [ SearchBox , buttons : [ Add [ Corpus
, Add [ Corpus
, Folder , Folder
, Annuaire , Annuaire
] ]
...@@ -150,10 +143,10 @@ settingsBox Corpus = SettingsBox { ...@@ -150,10 +143,10 @@ settingsBox Corpus = SettingsBox {
, edit : true , edit : true
, doc : Documentation Corpus , doc : Documentation Corpus
, buttons : [ SearchBox , buttons : [ SearchBox
, Add [ NodeList {- , Add [ NodeList
, Graph , Graph
, Dashboard , Dashboard
] ] -}
, Upload , Upload
, Download , Download
--, Share --, Share
...@@ -170,7 +163,7 @@ settingsBox Texts = SettingsBox { ...@@ -170,7 +163,7 @@ settingsBox Texts = SettingsBox {
, doc : Documentation Texts , doc : Documentation Texts
, buttons : [ Upload , buttons : [ Upload
, Download , Download
, Delete -- , Delete
] ]
} }
...@@ -178,8 +171,7 @@ settingsBox Graph = SettingsBox { ...@@ -178,8 +171,7 @@ settingsBox Graph = SettingsBox {
show: true show: true
, edit : false , edit : false
, doc : Documentation Graph , doc : Documentation Graph
, buttons : [ Documentation Graph , buttons : [ Download -- TODO as GEXF or JSON
, Download
, Delete , Delete
] ]
} }
...@@ -189,8 +181,9 @@ settingsBox NodeList = SettingsBox { ...@@ -189,8 +181,9 @@ settingsBox NodeList = SettingsBox {
, edit : false , edit : false
, doc : Documentation NodeList , doc : Documentation NodeList
, buttons : [ Upload , buttons : [ Upload
, CopyFromCorpus
, Download , Download
, Delete -- , Delete
] ]
} }
...@@ -198,14 +191,16 @@ settingsBox Dashboard = SettingsBox { ...@@ -198,14 +191,16 @@ settingsBox Dashboard = SettingsBox {
show: true show: true
, edit : false , edit : false
, doc : Documentation Dashboard , doc : Documentation Dashboard
, buttons : [Delete] , buttons : []
} }
settingsBox Annuaire = SettingsBox { settingsBox Annuaire = SettingsBox {
show: true show: true
, edit : false , edit : false
, doc : Documentation Annuaire , doc : Documentation Annuaire
, buttons : [Delete] , buttons : [ Upload
, Delete
]
} }
settingsBox _ = SettingsBox { settingsBox _ = SettingsBox {
......
...@@ -16,20 +16,21 @@ import Reactix.DOM.HTML as H ...@@ -16,20 +16,21 @@ import Reactix.DOM.HTML as H
-- START Create Node -- START Create Node
type Dispatch = Action -> Aff Unit
data NodePopup = CreatePopup | NodePopup data NodePopup = CreatePopup | NodePopup
type CreateNodeProps = type CreateNodeProps =
( id :: ID ( id :: ID
, dispatch :: Dispatch
, name :: Name , name :: Name
, nodeType :: NodeType , nodeType :: NodeType
, nodeTypes :: Array NodeType
) )
createNodeView :: (Action -> Aff Unit) createNodeView :: Record CreateNodeProps
-> Record CreateNodeProps
-> R.State (Maybe NodePopup)
-> Array NodeType
-> R.Element -> R.Element
createNodeView d p@{nodeType} (_ /\ setPopupOpen) nodeTypes = R.createElement el p [] createNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p []
where where
el = R.hooksComponent "CreateNodeView" cpt el = R.hooksComponent "CreateNodeView" cpt
cpt {id, name} _ = do cpt {id, name} _ = do
...@@ -94,8 +95,9 @@ createNodeView d p@{nodeType} (_ /\ setPopupOpen) nodeTypes = R.createElement el ...@@ -94,8 +95,9 @@ createNodeView d p@{nodeType} (_ /\ setPopupOpen) nodeTypes = R.createElement el
[ H.button {className: "btn btn-primary text-center" [ H.button {className: "btn btn-primary text-center"
, type: "button" , type: "button"
, onClick: mkEffectFn1 $ \_ -> do , onClick: mkEffectFn1 $ \_ -> do
setPopupOpen $ const Nothing -- TODO
launchAff $ d $ CreateSubmit name' nt --setPopupOpen $ const Nothing
launchAff $ dispatch $ CreateSubmit name' nt
} [H.text "Add"] } [H.text "Add"]
] ]
......
This diff is collapsed.
This diff is collapsed.
...@@ -6,7 +6,6 @@ module Gargantext.Components.GraphExplorer.Search ...@@ -6,7 +6,6 @@ module Gargantext.Components.GraphExplorer.Search
import Prelude import Prelude
import Data.Sequence as Seq import Data.Sequence as Seq
import Data.Set as Set import Data.Set as Set
import Data.String as S
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2) import DOM.Simple.Console (log2)
import Effect (Effect) import Effect (Effect)
...@@ -14,6 +13,7 @@ import Reactix as R ...@@ -14,6 +13,7 @@ import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Gargantext.Components.InputWithAutocomplete (inputWithAutocomplete) import Gargantext.Components.InputWithAutocomplete (inputWithAutocomplete)
import Gargantext.Utils (queryMatchesLabel)
import Gargantext.Hooks.Sigmax.Types as SigmaxT import Gargantext.Hooks.Sigmax.Types as SigmaxT
type Props = ( type Props = (
...@@ -24,9 +24,7 @@ type Props = ( ...@@ -24,9 +24,7 @@ type Props = (
-- | Whether a node matches a search string -- | Whether a node matches a search string
nodeMatchesSearch :: String -> Record SigmaxT.Node -> Boolean nodeMatchesSearch :: String -> Record SigmaxT.Node -> Boolean
nodeMatchesSearch s n = S.contains (S.Pattern $ normalize s) (normalize n.label) nodeMatchesSearch s n = queryMatchesLabel s n.label
where
normalize = S.toLower
searchNodes :: String -> Seq.Seq (Record SigmaxT.Node) -> Seq.Seq (Record SigmaxT.Node) searchNodes :: String -> Seq.Seq (Record SigmaxT.Node) -> Seq.Seq (Record SigmaxT.Node)
searchNodes "" _ = Seq.empty searchNodes "" _ = Seq.empty
......
This diff is collapsed.
module Gargantext.Components.Data.Lang where
data Lang = EN | FR
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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