Commit 9f93eb2b authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[forest] refactor node popup view

parent 1aaa37f8
......@@ -22,6 +22,7 @@ data NodeAction = Documentation NodeType
| Move | Clone | Delete
| Share | Link NodeType
| Add (Array NodeType)
| CopyFromCorpus
instance eqNodeAction :: Eq NodeAction where
......@@ -36,6 +37,7 @@ instance eqNodeAction :: Eq NodeAction where
eq Share Share = true
eq (Link x) (Link y) = true && (x == y)
eq (Add x) (Add y) = true && (x == y)
eq CopyFromCorpus CopyFromCorpus = true
eq _ _ = false
instance showNodeAction :: Show NodeAction where
......@@ -50,6 +52,7 @@ instance showNodeAction :: Show NodeAction where
show Share = "Share"
show (Link x) = "Link to " <> show x
show (Add xs) = foldl (\a b -> a <> show b) "Add " xs
show CopyFromCorpus = "Copy from corpus"
glyphiconNodeAction :: NodeAction -> String
......@@ -60,6 +63,7 @@ glyphiconNodeAction SearchBox = "search"
glyphiconNodeAction Upload = "upload"
glyphiconNodeAction (Link _) = "transfer"
glyphiconNodeAction Download = "download"
glyphiconNodeAction CopyFromCorpus = "random"
glyphiconNodeAction _ = ""
......@@ -183,6 +187,7 @@ settingsBox NodeList = SettingsBox {
, edit : false
, doc : Documentation NodeList
, buttons : [ Upload
, CopyFromCorpus
, Download
, Delete
]
......
......@@ -33,7 +33,7 @@ uploadFileView :: (Action -> Aff Unit) -> Record Props -> R.Element
uploadFileView d props = R.createElement (uploadFileViewCpt d) props []
uploadFileViewCpt :: (Action -> Aff Unit) -> R.Component Props
uploadFileViewCpt d = R.hooksComponent "UploadFileView" cpt
uploadFileViewCpt d = R.hooksComponent "G.C.F.T.N.A.U.UploadFileView" cpt
where
cpt {id, nodeType} _ = do
mContents :: R.State (Maybe UploadFileContents) <- R.useState' Nothing
......@@ -234,3 +234,12 @@ uploadFile session nodeType id fileType (UploadFileContents fileContents) = do
Tuple "_wf_data" (Just fileContents)
, Tuple "_wf_filetype" (Just $ show fileType)
]
uploadTermListView :: (Action -> Aff Unit) -> Record Props -> R.Element
uploadTermListView d props = R.createElement (uploadFileViewCpt d) props []
uploadTermListViewCpt :: (Action -> Aff Unit) -> R.Component Props
uploadTermListViewCpt d = R.hooksComponent "G.C.F.T.N.A.U.UploadTermListView" cpt
where
cpt {id, nodeType} _ = do
pure $ H.div {} [ H.text "Upload term list" ]
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