From d541f3044206312da84e76e07a32f0d8b544f54a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Delano=C3=AB?= <devel+git@delanoe.org> Date: Thu, 15 Dec 2022 15:47:25 +0100 Subject: [PATCH] [FEAT] Text Flow with NoList built as option --- .../Components/Forest/Tree/Node/Action/Upload.purs | 2 +- src/Gargantext/Components/ListSelection.purs | 10 ++++++---- src/Gargantext/Components/ListSelection/Types.purs | 5 ++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs b/src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs index dfa39259b..2a1fbdda2 100644 --- a/src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs +++ b/src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs @@ -265,7 +265,7 @@ uploadButtonCpt = here.component "uploadButton" cpt _ -> do contents <- case fileFormat' of Plain -> readUFBAsText blob - ZIP -> readUFBAsBase64 blob + ZIP -> readUFBAsBase64 blob dispatch $ UploadFile nodeType fileType' fileFormat' lang' (Just name) contents selection' liftEffect $ do T.write_ Nothing mFile diff --git a/src/Gargantext/Components/ListSelection.purs b/src/Gargantext/Components/ListSelection.purs index afffdba59..d064cbc5d 100644 --- a/src/Gargantext/Components/ListSelection.purs +++ b/src/Gargantext/Components/ListSelection.purs @@ -40,11 +40,11 @@ selectionCpt = here.component "selection" cpt where , list: [ MyListsFirst , OtherListsFirst , SelectedLists [] + , NoList ] } [] - , - selectedIds { selection, session } [] + , selectedIds { selection, session } [] ] selectedIds :: R2.Component Props @@ -88,7 +88,8 @@ type ListTreeProps = , nodeType :: NodeType , root :: ID , selection :: T.Box Selection - , session :: Session ) + , session :: Session + ) listTree :: R2.Leaf ListTreeProps listTree props = R.createElement listTreeCpt props [] @@ -110,7 +111,8 @@ type ListTreeChildrenProps = ( render :: Render , root :: ID , selection :: T.Box Selection - , session :: Session ) + , session :: Session + ) listTreeChildren :: R2.Component ListTreeChildrenProps listTreeChildren = R.createElement listTreeChildrenCpt diff --git a/src/Gargantext/Components/ListSelection/Types.purs b/src/Gargantext/Components/ListSelection/Types.purs index 445e0ff1f..579a85b6e 100644 --- a/src/Gargantext/Components/ListSelection/Types.purs +++ b/src/Gargantext/Components/ListSelection/Types.purs @@ -9,20 +9,23 @@ import Data.Newtype (class Newtype) import Gargantext.Types (ID, ListId, NodeType) import Simple.JSON as JSON -data Selection = MyListsFirst | OtherListsFirst | SelectedLists (Array ListId) +data Selection = MyListsFirst | OtherListsFirst | SelectedLists (Array ListId) | NoList derive instance Generic Selection _ instance Show Selection where show MyListsFirst = "My lists first" show OtherListsFirst = "Other lists first" + show NoList = "NoList" show (SelectedLists _) = "Selected lists" instance Eq Selection where eq = genericEq instance Read Selection where read "My lists first" = Just MyListsFirst read "Other lists first" = Just OtherListsFirst read "Selected lists" = Just $ SelectedLists [] + read "NoList" = Just NoList read _ = Nothing instance JSON.WriteForeign Selection where writeImpl MyListsFirst = JSON.writeImpl { "type": "MyListsFirst" } + writeImpl NoList = JSON.writeImpl { "type": "NoList" } writeImpl OtherListsFirst = JSON.writeImpl { "type": "OtherListsFirst" } writeImpl (SelectedLists ids) = JSON.writeImpl { "type": "SelectedLists", value: ids } -- 2.21.0