Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
138
Issues
138
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
afcab72f
Commit
afcab72f
authored
Jun 28, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[simple-json] lots of rewrites for Simple.JSON
Also, spago build used now.
parent
8d5bcec1
Changes
92
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
92 changed files
with
4737 additions
and
1379 deletions
+4737
-1379
packages.json
.psc-package/local/.set/packages.json
+10
-3
REACTIX.md
REACTIX.md
+1
-1
purs-packages.nix
nix/purs-packages.nix
+34
-7
packages.dhall
packages.dhall
+10
-4
packages.json
packages.json
+3333
-0
psc-package.json
psc-package.json
+1
-0
shell.nix
shell.nix
+3
-2
spago.dhall
spago.dhall
+66
-0
AsyncTasks.purs
src/Gargantext/AsyncTasks.purs
+8
-4
Menu.purs
src/Gargantext/Components/Annotation/Menu.purs
+2
-2
Category.purs
src/Gargantext/Components/Category.purs
+12
-14
Types.purs
src/Gargantext/Components/Category/Types.purs
+17
-24
ECharts.purs
src/Gargantext/Components/Charts/Options/ECharts.purs
+3
-3
Font.purs
src/Gargantext/Components/Charts/Options/Font.purs
+5
-4
Legend.purs
src/Gargantext/Components/Charts/Options/Legend.purs
+3
-3
Position.purs
src/Gargantext/Components/Charts/Options/Position.purs
+2
-2
Series.purs
src/Gargantext/Components/Charts/Options/Series.purs
+6
-6
CodeEditor.purs
src/Gargantext/Components/CodeEditor.purs
+6
-6
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+1
-1
Types.purs
src/Gargantext/Components/DocsTable/Types.purs
+70
-68
FacetsTable.purs
src/Gargantext/Components/FacetsTable.purs
+12
-12
Action.purs
src/Gargantext/Components/Forest/Tree/Node/Action.purs
+3
-3
Add.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
+8
-7
Contact.purs
...argantext/Components/Forest/Tree/Node/Action/Contact.purs
+4
-3
Types.purs
...ext/Components/Forest/Tree/Node/Action/Contact/Types.purs
+12
-16
Link.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
+8
-11
Rename.purs
...Gargantext/Components/Forest/Tree/Node/Action/Rename.purs
+10
-7
Frame.purs
...text/Components/Forest/Tree/Node/Action/Search/Frame.purs
+2
-2
Types.purs
...text/Components/Forest/Tree/Node/Action/Search/Types.purs
+52
-62
Share.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
+9
-16
Types.purs
...text/Components/Forest/Tree/Node/Action/Update/Types.purs
+42
-79
Upload.purs
...Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
+7
-7
Types.purs
...text/Components/Forest/Tree/Node/Action/Upload/Types.purs
+6
-6
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+2
-2
FTree.purs
src/Gargantext/Components/Forest/Tree/Node/Tools/FTree.purs
+23
-29
ProgressBar.purs
...antext/Components/Forest/Tree/Node/Tools/ProgressBar.purs
+1
-1
Types.purs
...text/Components/Forest/Tree/Node/Tools/SubTree/Types.purs
+6
-6
Graph.purs
src/Gargantext/Components/Graph.purs
+2
-2
Types.purs
src/Gargantext/Components/GraphExplorer/Types.purs
+46
-46
Lang.purs
src/Gargantext/Components/Lang.purs
+4
-4
Types.purs
src/Gargantext/Components/Login/Types.purs
+18
-34
Core.purs
src/Gargantext/Components/NgramsTable/Core.purs
+62
-62
Node.purs
src/Gargantext/Components/Node.purs
+4
-4
Annuaire.purs
src/Gargantext/Components/Nodes/Annuaire.purs
+7
-7
Tabs.purs
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
+3
-3
Tabs.purs
...gantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
+3
-3
Types.purs
...antext/Components/Nodes/Annuaire/User/Contacts/Types.purs
+37
-37
Corpus.purs
src/Gargantext/Components/Nodes/Corpus.purs
+3
-3
Histo.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Histo.purs
+7
-7
Metrics.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
+5
-5
Pie.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
+5
-5
Predefined.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Predefined.purs
+16
-24
Tree.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
+2
-2
Types.purs
src/Gargantext/Components/Nodes/Corpus/Document/Types.purs
+10
-10
Types.purs
src/Gargantext/Components/Nodes/Corpus/Types.purs
+28
-32
Types.purs
src/Gargantext/Components/Nodes/Dashboard/Types.purs
+30
-37
File.purs
src/Gargantext/Components/Nodes/File.purs
+10
-20
Frame.purs
src/Gargantext/Components/Nodes/Frame.purs
+5
-5
Home.purs
src/Gargantext/Components/Nodes/Home.purs
+1
-1
Public.purs
src/Gargantext/Components/Nodes/Home/Public.purs
+6
-12
Types.purs
src/Gargantext/Components/Nodes/Lists/Types.purs
+11
-18
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+3
-3
Types.purs
src/Gargantext/Components/Nodes/Texts/Types.purs
+1
-1
Types.purs
src/Gargantext/Components/Nodes/Types.purs
+152
-99
RangeSlider.purs
src/Gargantext/Components/RangeSlider.purs
+2
-2
Search.purs
src/Gargantext/Components/Search.purs
+60
-60
Table.purs
src/Gargantext/Components/Table.purs
+2
-2
Types.purs
src/Gargantext/Components/Table/Types.purs
+6
-6
Themes.purs
src/Gargantext/Components/Themes.purs
+2
-2
REST.purs
src/Gargantext/Config/REST.purs
+34
-48
Algorithm.purs
src/Gargantext/Data/Louvain/Algorithm.purs
+2
-2
Ends.purs
src/Gargantext/Ends.purs
+21
-34
Loader.purs
src/Gargantext/Hooks/Loader.purs
+2
-2
Sigma.purs
src/Gargantext/Hooks/Sigmax/Sigma.purs
+3
-3
Sigmajs.purs
src/Gargantext/Hooks/Sigmax/Sigmajs.purs
+2
-2
Types.purs
src/Gargantext/Hooks/Sigmax/Types.purs
+8
-8
Routes.purs
src/Gargantext/Routes.purs
+2
-2
Sessions.purs
src/Gargantext/Sessions.purs
+40
-42
Types.purs
src/Gargantext/Sessions/Types.purs
+40
-58
Types.purs
src/Gargantext/Types.purs
+121
-155
Utils.purs
src/Gargantext/Utils.purs
+2
-2
Argonaut.purs
src/Gargantext/Utils/Argonaut.purs
+12
-12
CacheAPI.purs
src/Gargantext/Utils/CacheAPI.purs
+1
-1
Crypto.purs
src/Gargantext/Utils/Crypto.purs
+3
-3
JSON.purs
src/Gargantext/Utils/JSON.purs
+52
-0
Range.purs
src/Gargantext/Utils/Range.purs
+3
-3
Reactix.purs
src/Gargantext/Utils/Reactix.purs
+10
-9
String.purs
src/Gargantext/Utils/String.purs
+7
-0
Toestand.purs
src/Gargantext/Utils/Toestand.purs
+2
-2
Tuple.purs
src/Gargantext/Utils/Tuple.purs
+6
-0
Main.purs
src/Main.purs
+1
-0
Spec.purs
test/Gargantext/Utils/Spec.purs
+10
-10
No files found.
.psc-package/local/.set/packages.json
View file @
afcab72f
...
...
@@ -3587,7 +3587,7 @@
"newtype"
],
"repo"
:
"https://github.com/hdgarrood/purescript-sequences.git"
,
"version"
:
"v
2.1.0
"
"version"
:
"v
3.0.2
"
},
"server-sent-events"
:
{
"dependencies"
:
[
...
...
@@ -3662,6 +3662,13 @@
"repo"
:
"https://github.com/justinwoo/purescript-simple-json.git"
,
"version"
:
"v8.0.0"
},
"simple-json-generics"
:
{
"dependencies"
:
[
"simple-json"
],
"repo"
:
"https://github.com/justinwoo/purescript-simple-json-generics"
,
"version"
:
"v0.1.0"
},
"simple-jwt"
:
{
"dependencies"
:
[
"crypto"
,
...
...
@@ -4159,8 +4166,8 @@
"typelevel"
,
"unsafe-coerce"
],
"repo"
:
"https://github.com/
athanclark
/purescript-tuples-native"
,
"version"
:
"v2.
0.1
"
"repo"
:
"https://github.com/
poorscript
/purescript-tuples-native"
,
"version"
:
"v2.
2.0
"
},
"turf"
:
{
"dependencies"
:
[
...
...
REACTIX.md
View file @
afcab72f
...
...
@@ -508,7 +508,7 @@ referring to both the `Read` and `Write` classes:
```
purescript
class (Read box val, Write box val) <= ReadWrite box val | box -> val
instance
readWrite ::
(Read box val, Write box val) => ReadWrite box val
instance (Read box val, Write box val) => ReadWrite box val
```
When you don't care about the current value, you can use
`write`
, the
...
...
nix/purs-packages.nix
View file @
afcab72f
...
...
@@ -822,11 +822,29 @@
};
"sequences"
=
{
name
=
"sequences"
;
version
=
"v
2.1.0
"
;
version
=
"v
3.0.2
"
;
src
=
pkgs
.
fetchgit
{
url
=
"https://github.com/hdgarrood/purescript-sequences.git"
;
rev
=
"v2.1.0"
;
sha256
=
"10fkkmmb7qh4p5gmgb6xpxh9g8hy06ddy8cyfrs3py8a5b8h46hw"
;
rev
=
"v3.0.2"
;
sha256
=
"0mc0jjs1119c2nyd08yhdmliq3s47lhrdknhziga3lnbzja889k4"
;
};
};
"simple-json"
=
{
name
=
"simple-json"
;
version
=
"v8.0.0"
;
src
=
pkgs
.
fetchgit
{
url
=
"https://github.com/justinwoo/purescript-simple-json.git"
;
rev
=
"v8.0.0"
;
sha256
=
"0q5hb324m1r5njnxq9wxgy99i0x8sd9mj2drq72i64xxr1k0m8qc"
;
};
};
"simple-json-generics"
=
{
name
=
"simple-json-generics"
;
version
=
"v0.1.0"
;
src
=
pkgs
.
fetchgit
{
url
=
"https://github.com/justinwoo/purescript-simple-json-generics"
;
rev
=
"v0.1.0"
;
sha256
=
"1izbrh9614yi0lzpnqbn9q7hbllhvvhrgyziganj7rzgphwn3ywx"
;
};
};
"simplecrypto"
=
{
...
...
@@ -966,11 +984,11 @@
};
"tuples-native"
=
{
name
=
"tuples-native"
;
version
=
"v2.
0.1
"
;
version
=
"v2.
2.0
"
;
src
=
pkgs
.
fetchgit
{
url
=
"https://github.com/
athanclark
/purescript-tuples-native"
;
rev
=
"v2.
0.1
"
;
sha256
=
"
1c8065krignnphiwnws9d5ingfx8k83wqnmd1zadyjlakfdg2b4h
"
;
url
=
"https://github.com/
poorscript
/purescript-tuples-native"
;
rev
=
"v2.
2.0
"
;
sha256
=
"
0hplpqc2sbcjin084jqzhzqhprlc1achbqmsn9czpnf6ylgkqhaz
"
;
};
};
"type-equality"
=
{
...
...
@@ -1063,6 +1081,15 @@
sha256
=
"0yfb97nk7179hp0r2iylj74wl7rnl1y2x6dh5hlipxg1kpq9yydk"
;
};
};
"variant"
=
{
name
=
"variant"
;
version
=
"v7.0.2"
;
src
=
pkgs
.
fetchgit
{
url
=
"https://github.com/natefaubion/purescript-variant.git"
;
rev
=
"v7.0.2"
;
sha256
=
"0a555fa2d8kd6rzfv9w64aphr7n6x0cizfp7n71wh5jw07b7hn5y"
;
};
};
"versions"
=
{
name
=
"versions"
;
version
=
"v6.0.0"
;
...
...
packages.dhall
View file @
afcab72f
...
...
@@ -38,7 +38,7 @@ let additions =
, "newtype"
]
, repo = "https://github.com/hdgarrood/purescript-sequences.git"
, version = "v
2.1.0
"
, version = "v
3.0.2
"
}
, spec-discovery =
{ dependencies = [ "prelude", "effect", "arrays", "spec", "node-fs" ]
...
...
@@ -115,10 +115,16 @@ let additions =
, repo = "https://github.com/irresponsible/purescript-reactix"
, version = "v0.4.11"
}
, simple-json-generics =
{ dependencies =
[ "simple-json" ]
, repo = "https://github.com/justinwoo/purescript-simple-json-generics"
, version = "v0.1.0"
}
, toestand =
{ dependencies = [ "effect", "reactix", "prelude", "record", "tuples", "typelevel-prelude", "typisch" ]
, repo = "https://github.com/poorscript/purescript-toestand"
, version = "v0.6.
1
"
, version = "v0.6.
2
"
}
, typisch =
{ dependencies = [ "prelude" ]
...
...
@@ -128,8 +134,8 @@ let additions =
, tuples-native =
{ dependencies =
[ "prelude", "typelevel", "unsafe-coerce" ]
, repo = "https://github.com/
athanclark
/purescript-tuples-native"
, version = "v2.
0.1
"
, repo = "https://github.com/
poorscript
/purescript-tuples-native"
, version = "v2.
2.0
"
}
, uint =
{ dependencies = [ "maybe", "math" ]
...
...
packages.json
0 → 100644
View file @
afcab72f
This diff is collapsed.
Click to expand it.
psc-package.json
View file @
afcab72f
...
...
@@ -36,6 +36,7 @@
"routing"
,
"sequences"
,
"simple-json"
,
"simple-json-generics"
,
"simplecrypto"
,
"smolder"
,
"spec-discovery"
,
...
...
shell.nix
View file @
afcab72f
...
...
@@ -16,9 +16,10 @@ let
set -e
echo "Compiling"
build-purs
#
build-purs
echo "Bundling"
yarn pulp browserify --skip-compile -t dist/bundle.js --src-path output
#yarn pulp browserify --skip-compile -t dist/bundle.js --src-path output
yarn spago bundle-app --to dist/bundle.js
''
;
repl
=
pkgs
.
writeShellScriptBin
"repl"
''
...
...
spago.dhall
0 → 100644
View file @
afcab72f
{-
Welcome to a Spago project!
You can edit this file as you like.
Need help? See the following resources:
- Spago documentation: https://github.com/purescript/spago
- Dhall language tour: https://docs.dhall-lang.org/tutorials/Language-Tour.html
When creating a new Spago project, you can use
`spago init --no-comments` or `spago init -C`
to generate this file without the comments in this block.
-}
{ name = "gargantext"
, dependencies =
[ "aff-promise"
, "affjax"
, "argonaut"
, "console"
, "css"
, "datetime"
, "debug"
, "dom-filereader"
, "dom-simple"
, "effect"
, "foreign-generic"
, "foreign-object"
, "formula"
, "globals"
, "integers"
, "js-timers"
, "markdown-smolder"
, "math"
, "maybe"
, "milkis"
, "nonempty"
, "now"
, "numbers"
, "prelude"
, "psci-support"
, "random"
, "react"
, "reactix"
, "read"
, "record-extra"
, "routing"
, "sequences"
, "simple-json"
, "simple-json-generics"
, "simplecrypto"
, "smolder"
, "spec-discovery"
, "spec-quickcheck"
, "string-parsers"
, "strings"
, "stringutils"
, "toestand"
, "tuples-native"
, "typisch"
, "uint"
, "uri"
, "versions"
, "web-html"
]
, packages = ./packages.dhall
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
}
src/Gargantext/AsyncTasks.purs
View file @
afcab72f
...
...
@@ -8,15 +8,17 @@ import Data.Map as Map
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import DOM.Simple.Console (log2)
import Effect (Effect)
import Gargantext.Types as GT
import Gargantext.Utils as GU
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Simple.JSON as JSON
import Toestand as T
import Web.Storage.Storage as WSS
import Gargantext.Types as GT
import Gargantext.Utils as GU
import Gargantext.Utils.JSON as GUJ
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
localStorageKey :: String
localStorageKey = "garg-async-tasks"
...
...
@@ -24,6 +26,8 @@ localStorageKey = "garg-async-tasks"
type TaskList = Array GT.AsyncTaskWithType
type Storage = Map.Map GT.NodeID TaskList
instance JSON.ReadForeign Storage where readImpl = GUJ.readMap
empty :: Storage
empty = Map.empty
...
...
src/Gargantext/Components/Annotation/Menu.purs
View file @
afcab72f
...
...
@@ -24,8 +24,8 @@ here :: R2.Here
here = R2.here "Gargantext.Components.Annotation.Menu"
data MenuType = NewNgram | SetTermListItem
derive instance
genericMenuType ::
Generic MenuType _
instance
eqMenuType ::
Eq MenuType where
derive instance Generic MenuType _
instance Eq MenuType where
eq = genericEq
type Props =
...
...
src/Gargantext/Components/Category.purs
View file @
afcab72f
-- TODO: this module should be replaced by FacetsTable
module Gargantext.Components.Category where
import Gargantext.Prelude (discard, map, pure, void, ($), (-), (<), (<>), (==))
import Data.Argonaut (class EncodeJson, encodeJson, jsonEmptyObject, (:=), (~>))
import Data.Array as A
import Data.Generic.Rep (class Generic)
import Data.Map as Map
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff, launchAff)
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Gargantext.Prelude
import Gargantext.Components.Category.Types
( Category(..), Star(..), cat2score, categories, clickAgain, star2score, stars )
...
...
@@ -56,12 +58,10 @@ newtype RatingQuery =
RatingQuery { nodeIds :: Array Int
, rating :: Star
}
instance encodeJsonRatingQuery :: EncodeJson RatingQuery where
encodeJson (RatingQuery post) =
"ntc_nodesId" := post.nodeIds
~> "ntc_category" := encodeJson post.rating
~> jsonEmptyObject
derive instance Generic RatingQuery _
instance JSON.WriteForeign RatingQuery where
writeImpl (RatingQuery post) = JSON.writeImpl { ntc_nodesId: post.nodeIds
, ntc_category: post.rating }
putRating :: Session -> Int -> RatingQuery -> Aff (Array Int)
putRating session nodeId = put session $ ratingRoute where
...
...
@@ -139,12 +139,10 @@ newtype CategoryQuery = CategoryQuery {
nodeIds :: Array Int
, category :: Category
}
instance encodeJsonCategoryQuery :: EncodeJson CategoryQuery where
encodeJson (CategoryQuery post) =
"ntc_nodesId" := post.nodeIds
~> "ntc_category" := encodeJson post.category
~> jsonEmptyObject
derive instance Generic CategoryQuery _
instance JSON.WriteForeign CategoryQuery where
writeImpl (CategoryQuery post) = JSON.writeImpl { ntc_nodesId: post.nodeIds
, ntc_category: post.category }
categoryRoute :: Int -> SessionRoute
categoryRoute nodeId = NodeAPI Node (Just nodeId) "category"
...
...
src/Gargantext/Components/Category/Types.purs
View file @
afcab72f
module Gargantext.Components.Category.Types where
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson)
import Data.Generic.Rep (class Generic)
import Data.Eq.Generic (genericEq)
import Data.Show.Generic (genericShow)
import Simple.JSON as JSON
import Gargantext.Prelude
...
...
@@ -13,18 +13,14 @@ data Star = Star_0 | Star_1 | Star_2 | Star_3 | Star_4
stars :: Array Star
stars = [Star_0, Star_1, Star_2, Star_3, Star_4]
derive instance genericStar :: Generic Star _
instance showStar :: Show Star where
show = genericShow
instance eqStar :: Eq Star where
eq = genericEq
instance decodeJsonStar :: DecodeJson Star where
decodeJson json = do
obj <- decodeJson json
pure $ decodeStar obj
instance encodeJsonStar :: EncodeJson Star where
encodeJson x = encodeJson (star2score x)
derive instance Generic Star _
instance Show Star where show = genericShow
instance Eq Star where eq = genericEq
instance JSON.ReadForeign Star where
readImpl f = do
inst <- JSON.readImpl f
pure $ decodeStar inst
instance JSON.WriteForeign Star where writeImpl = JSON.writeImpl <<< star2score
decodeStar :: Int -> Star
decodeStar 0 = Star_0
...
...
@@ -53,17 +49,14 @@ data Category = Trash | UnRead | Checked | Topic | Favorite
categories :: Array Category
categories = [Trash, UnRead, Checked, Topic, Favorite]
derive instance genericFavorite :: Generic Category _
instance showCategory :: Show Category where
show = genericShow
instance eqCategory :: Eq Category where
eq = genericEq
instance decodeJsonCategory :: DecodeJson Category where
decodeJson json = do
obj <- decodeJson json
pure $ decodeCategory obj
instance encodeJsonCategory :: EncodeJson Category where
encodeJson cat = encodeJson (cat2score cat)
derive instance Generic Category _
instance Show Category where show = genericShow
instance Eq Category where eq = genericEq
instance JSON.ReadForeign Category where
readImpl f = do
inst <- JSON.readImpl f
pure $ decodeCategory inst
instance JSON.WriteForeign Category where writeImpl = JSON.writeImpl <<< cat2score
favCategory :: Category -> Category
favCategory Favorite = Topic
...
...
src/Gargantext/Components/Charts/Options/ECharts.purs
View file @
afcab72f
...
...
@@ -2,8 +2,8 @@ module Gargantext.Components.Charts.Options.ECharts where
import Prelude
import CSS (italic)
import CSS.Common (normal)
import CSS.FontStyle (FontStyle(..))
import Gargantext.Components.Charts.Options.Color (transparent, violet, black)
import Gargantext.Components.Charts.Options.Data (DataLegend, dataSerie)
import Gargantext.Components.Charts.Options.Font (IconOptions(..), Shape(..), TextStyle, chartFontStyle, chartFontWeight, icon, mkTooltip, Tooltip, mkToolBox)
...
...
@@ -183,7 +183,7 @@ opts (Options { mainTitle
data Zoom = Slider | Inside
instance
showZoom ::
Show Zoom where
instance Show Zoom where
show Slider = "slider"
show Inside = "inside"
...
...
@@ -211,7 +211,7 @@ seriesPie = seriesPieD1
textStyle2 :: TextStyle
textStyle2 =
{ color: black
, fontStyle: chartFontStyle
i
talic
, fontStyle: chartFontStyle
I
talic
, fontWeight: chartFontWeight normal
, fontFamily: "sans-serif"
, fontSize: 11
...
...
src/Gargantext/Components/Charts/Options/Font.purs
View file @
afcab72f
...
...
@@ -31,7 +31,8 @@ import Prelude (Unit, ($), (<<<), (<>))
import Data.Generic.Rep
import Data.Show.Generic (genericShow)
import CSS (FontStyle(..), FontWeight(..), Prefixed(..), Value(..))
import CSS (FontWeight(..), Prefixed(..), Value(..))
import CSS.FontStyle (FontStyle(..))
import Data.String (toLower)
import Gargantext.Components.Charts.Options.Color (Color)
import Gargantext.Components.Charts.Options.Position (LeftRelativePosition, Position, TopRelativePosition)
...
...
@@ -62,8 +63,8 @@ type TextStyle =
newtype ChartFontStyle = ChartFontStyle String
chartFontStyle :: FontStyle -> ChartFontStyle
chartFontStyle
(FontStyle (Value (Plain "italic")))
= ChartFontStyle "italic"
chartFontStyle (
FontStyle (Value (Plain "oblique"))
) = ChartFontStyle "oblique"
chartFontStyle
Italic
= ChartFontStyle "italic"
chartFontStyle (
Oblique _
) = ChartFontStyle "oblique"
chartFontStyle _ = ChartFontStyle "normal"
...
...
@@ -81,7 +82,7 @@ newtype Icon = Icon String
newtype ImageURL = ImageURL String
data Shape = Circle | Rect | RoundRect | Triangle | Diamond | Pin | Arrow
derive instance
genericShape ::
Generic Shape _
derive instance Generic Shape _
data IconOptions = Shape Shape | Image ImageURL
...
...
src/Gargantext/Components/Charts/Options/Legend.purs
View file @
afcab72f
...
...
@@ -21,7 +21,7 @@ import Unsafe.Coerce (unsafeCoerce)
newtype LegendType = LegendType String
data PlainOrScroll = Plain | Scroll
instance
showPlainOrScroll ::
Show PlainOrScroll where
instance Show PlainOrScroll where
show (Plain) = "plain"
show (Scroll) = "scroll"
...
...
@@ -32,7 +32,7 @@ legendType = LegendType <<< toLower <<< show
newtype Orient = Orient String
data Orientation = Horizontal | Vertical
derive instance
genericOrientation ::
Generic Orientation _
derive instance Generic Orientation _
orient :: Orientation -> Orient
orient = Orient <<< toLower <<< genericShow
...
...
@@ -41,7 +41,7 @@ orient = Orient <<< toLower <<< genericShow
foreign import data SelectedMode :: Type
data LegendMode = Bool Boolean | Single | Multiple
derive instance
genericLegendMode ::
Generic LegendMode _
derive instance Generic LegendMode _
selectedMode :: LegendMode -> SelectedMode
selectedMode (Bool b) = unsafeCoerce b
...
...
src/Gargantext/Components/Charts/Options/Position.purs
View file @
afcab72f
...
...
@@ -34,13 +34,13 @@ relativePosition (Relative r) = unsafeCoerce $ show r
data Align p = Auto | Relative p
data TopRelativePosition = Top | Middle | Bottom
instance
showTopRelativePosition ::
Show TopRelativePosition
instance Show TopRelativePosition
where show (Top) = "top"
show (Middle) = "middle"
show (Bottom) = "bottom"
data LeftRelativePosition = LeftPos | Center | RightPos
instance
showLeftRelativePosition ::
Show LeftRelativePosition
instance Show LeftRelativePosition
where show (LeftPos) = "left"
show (Center) = "center"
show (RightPos) = "right"
src/Gargantext/Components/Charts/Options/Series.purs
View file @
afcab72f
...
...
@@ -39,7 +39,7 @@ data Chart = Line
| ThemeRiver
-- Trees
instance
showChart ::
Show Chart where
instance Show Chart where
show Bar = "bar"
show EffectScatter = "effectScatter" -- ^ https://ecomfe.github.io/echarts-examples/public/editor.html?c=scatter-effect
show Funnel = "funnel"
...
...
@@ -131,7 +131,7 @@ seriesSankey o = unsafeSeries ((unsafeCoerce o) { "type" = seriesType Sankey })
-- Tree types
data Trees = TreeLine | TreeRadial | TreeMap
instance
showTrees ::
Show Trees where
instance Show Trees where
show TreeLine = "tree" -- ^ https://ecomfe.github.io/echarts-examples/public/editor.html?c=tree-radial
show TreeRadial = "tree" -- ^ https://ecomfe.github.io/echarts-examples/public/editor.html?c=scatter-simple
show TreeMap = "treemap" -- ^ https://ecomfe.github.io/echarts-examples/public/editor.html?c=treemap-simple
...
...
@@ -192,17 +192,17 @@ data TreeNode = TreeNode {
, value :: Int
}
derive instance
genericTreeNode ::
Generic TreeNode _
instance
eqTreeNode ::
Eq TreeNode where
derive instance Generic TreeNode _
instance Eq TreeNode where
eq (TreeNode n1) (TreeNode n2) = eq n1 n2
instance
decodeTreeNode ::
DecodeJson TreeNode where
instance DecodeJson TreeNode where
decodeJson json = do
obj <- decodeJson json
children <- obj .: "children"
name <- obj .: "label"
value <- obj .: "value"
pure $ TreeNode { children, name, value }
instance
encodeTreeNode ::
EncodeJson TreeNode where
instance EncodeJson TreeNode where
encodeJson (TreeNode { children, name, value }) =
"children" := encodeJson children
~> "label" := encodeJson name
...
...
src/Gargantext/Components/CodeEditor.purs
View file @
afcab72f
...
...
@@ -36,17 +36,17 @@ type ElRef = R.Ref (Nullable Element)
data CodeType = Haskell | JSON | Markdown | Python
derive instance
genericCodeType ::
Generic CodeType _
instance
eqCodeType ::
Eq CodeType where
derive instance Generic CodeType _
instance Eq CodeType where
eq = genericEq
instance
showCodeType ::
Show CodeType where
instance Show CodeType where
show = genericShow
data ViewType = Code | Preview | Both
derive instance
genericViewType ::
Generic ViewType _
instance
eqViewType ::
Eq ViewType where
derive instance Generic ViewType _
instance Eq ViewType where
eq = genericEq
instance
showViewType ::
Show ViewType where
instance Show ViewType where
show = genericShow
type Props =
...
...
src/Gargantext/Components/DocsTable.purs
View file @
afcab72f
...
...
@@ -507,7 +507,7 @@ newtype SearchQuery = SearchQuery {
}
instance
encodeJsonSQuery ::
EncodeJson SearchQuery where
instance EncodeJson SearchQuery where
encodeJson (SearchQuery {query, parent_id})
= "query" := query
~> "parent_id" := parent_id
...
...
src/Gargantext/Components/DocsTable/Types.purs
View file @
afcab72f
module Gargantext.Components.DocsTable.Types where
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject, (.:), (:=), (~>))
import Data.Generic.Rep (class Generic)
import Data.Eq.Generic (genericEq)
import Data.Map (Map)
import Data.Map as Map
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Simple.JSON as JSON
import Gargantext.Prelude
...
...
@@ -15,92 +15,94 @@ import Gargantext.Components.Category.Types (Category(..), decodeCategory, Star(
data Action
= MarkCategory Int Category
type DocumentsViewT =
( category :: Star
, date :: Int
, ngramCount :: Maybe Int
, score :: Maybe Int
, source :: String
, title :: String
, url :: String
)
newtype DocumentsView
= DocumentsView
{ _id :: Int
, category :: Star
, date :: Int
, ngramCount :: Maybe Int
, score :: Maybe Int
, source :: String
, title :: String
, url :: String
| DocumentsViewT
}
derive instance
genericDocumentsView ::
Generic DocumentsView _
instance
eqDocumentsView ::
Eq DocumentsView where
derive instance Generic DocumentsView _
instance Eq DocumentsView where
eq = genericEq
{-
derive instance
genericDocumentsView ::
Generic DocumentsView _
instance
showDocumentsView ::
Show DocumentsView where
derive instance Generic DocumentsView _
instance Show DocumentsView where
show = genericShow
instance
decodeJsonSearchType ::
Argonaut.DecodeJson SearchType where
instance Argonaut.DecodeJson SearchType where
decodeJson = genericSumDecodeJson
instance
encodeJsonSearchType ::
Argonaut.EncodeJson SearchType where
instance Argonaut.EncodeJson SearchType where
encodeJson = genericSumEncodeJson
-}
instance decodeDocumentsView :: DecodeJson DocumentsView where
decodeJson json = do
obj <- decodeJson json
_id <- obj .: "id"
category <- obj .: "category"
date <- obj .: "date"
ngramCount <- obj .: "ngramCount"
score <- obj .: "score"
source <- obj .: "source"
title <- obj .: "title"
url <- obj .: "url"
pure $ DocumentsView { _id, category, date, ngramCount, score, source, title, url }
instance encodeDocumentsView :: EncodeJson DocumentsView where
encodeJson (DocumentsView dv) =
"id" := dv._id
~> "category" := dv.category
~> "date" := dv.date
~> "ngramCount" := dv.ngramCount
~> "score" := dv.score
~> "source" := dv.source
~> "title" := dv.title
~> "url" := dv.url
~> jsonEmptyObject
instance JSON.ReadForeign DocumentsView where
readImpl f = do
{ id, category, date, ngramCount, score, source, title, url } :: { id :: Int | DocumentsViewT } <- JSON.readImpl f
pure $ DocumentsView { _id: id
, category
, date
, ngramCount
, score
, source
, title
, url }
instance JSON.WriteForeign DocumentsView where
writeImpl (DocumentsView { _id, category, date, ngramCount, score, source, title, url }) =
JSON.writeImpl { id: _id
, category
, date
, ngramCount
, score
, source
, title
, url }
type ResponseT =
( hyperdata :: Hyperdata
, ngramCount :: Maybe Int
, score :: Maybe Int
, title :: String )
newtype Response = Response
{ cid :: Int
, hyperdata :: Hyperdata
, category :: Star
, ngramCount :: Maybe Int
, score :: Maybe Int
, title :: String
, category :: Star
| ResponseT
}
instance JSON.ReadForeign Response where
readImpl f = do
{ category, id, hyperdata, ngramCount, score, title } :: { category :: Int, id :: Int | ResponseT } <- JSON.readImpl f
--pure $ Response { category: decodeCategory category, cid, hyperdata, ngramCount, score, title }
pure $ Response { category: decodeStar category
, cid: id
, hyperdata
, ngramCount
, score
, title }
type HyperdataT =
( title :: String
, source :: String )
newtype Hyperdata = Hyperdata
{ title :: String
, source :: String
, pub_year :: Int
{ pub_year :: Int
| HyperdataT
}
instance decodeHyperdata :: DecodeJson Hyperdata where
decodeJson json = do
obj <- decodeJson json
pub_year <- obj .: "publication_year"
source <- obj .: "source"
title <- obj .: "title"
pure $ Hyperdata { title,source, pub_year}
instance decodeResponse :: DecodeJson Response where
decodeJson json = do
obj <- decodeJson json
category <- obj .: "category"