[reactix] leafComponent -> leaf

Removes duplications in Reactix.purs.
parent f4aba988
......@@ -70,7 +70,7 @@ type InnerProps =
)
annotatedFieldInner :: R2.Leaf InnerProps
annotatedFieldInner = R2.leafComponent annotatedFieldInnerCpt
annotatedFieldInner = R2.leaf annotatedFieldInnerCpt
annotatedFieldInnerCpt :: R.Component InnerProps
annotatedFieldInnerCpt = here.component "annotatedFieldInner" cpt where
......
......@@ -55,7 +55,7 @@ type Props =
data FolderStyle = FolderUp | FolderChild
folderView :: R2.Leaf Props
folderView = R2.leafComponent folderViewCpt
folderView = R2.leaf folderViewCpt
folderViewCpt :: R.Component Props
folderViewCpt = here.component "folderViewCpt" cpt where
cpt { nodeId, session } _ = do
......
......@@ -24,7 +24,7 @@ type NodePopupProps =
)
nodePopupView :: R2.Leaf NodePopupProps
nodePopupView = R2.leafComponent nodePopupViewCpt
nodePopupView = R2.leaf nodePopupViewCpt
nodePopupViewCpt :: R.Component NodePopupProps
nodePopupViewCpt = here.component "nodePopupView" cpt where
cpt props _ = do
......
......@@ -75,7 +75,7 @@ forestLayoutCpt = here.component "forest" cpt where
type Plus = ( boxes :: Boxes )
plus :: R2.Leaf Plus
plus = R2.leafComponent plusCpt
plus = R2.leaf plusCpt
plusCpt :: R.Component Plus
plusCpt = here.component "plus" cpt where
cpt { boxes: { backend, showLogin } } _ = do
......
......@@ -569,7 +569,7 @@ nodeActionsCpt = here.component "nodeActions" cpt where
child _ = mempty
graphNodeActions :: R2.Leaf NodeActionsCommon
graphNodeActions = R2.leafComponent graphNodeActionsCpt
graphNodeActions = R2.leaf graphNodeActionsCpt
graphNodeActionsCpt :: R.Component NodeActionsCommon
graphNodeActionsCpt = here.component "graphNodeActions" cpt where
cpt { id, session, refresh } _ = do
......@@ -596,7 +596,7 @@ graphNodeActionsCpt = here.component "graphNodeActions" cpt where
listNodeActions :: R2.Leaf NodeActionsCommon
listNodeActions = R2.leafComponent listNodeActionsCpt
listNodeActions = R2.leaf listNodeActionsCpt
listNodeActionsCpt :: R.Component NodeActionsCommon
listNodeActionsCpt = here.component "listNodeActions" cpt where
cpt { id, session, refresh } _ = do
......
......@@ -54,7 +54,7 @@ type TextInputBoxProps =
type AddContactProps = ( firstname :: String, lastname :: String )
textInputBox :: R2.Leaf TextInputBoxProps
textInputBox = R2.leafComponent textInputBoxCpt
textInputBox = R2.leaf textInputBoxCpt
textInputBoxCpt :: R.Component TextInputBoxProps
textInputBoxCpt = here.component "textInputBox" cpt where
cpt { boxName, boxAction, dispatch, isOpen
......
......@@ -67,14 +67,14 @@ type TeamRowProps =
( nodeId :: ID
, session :: Session
, team :: T.Box (Array TeamMember)
, error :: T.Box String
, error :: T.Box String
, team' :: Array TeamMember
, error' :: String
, team_owner_username :: String
)
teamLayoutRows :: R2.Leaf TeamRowProps
teamLayoutRows = R2.leafComponent teamLayoutRowsCpt
teamLayoutRows = R2.leaf teamLayoutRowsCpt
teamLayoutRowsCpt :: R.Component TeamRowProps
teamLayoutRowsCpt = here.component "teamLayoutRows" cpt where
......@@ -94,8 +94,8 @@ teamLayoutRowsCpt = here.component "teamLayoutRows" cpt where
, on: {click: submit shared_folder_id }
} []
]
makeLeader username = H.div {className: "from-group row"} [ H.div { className: "col-8"} [ H.text username ]
makeLeader username = H.div {className: "from-group row"} [ H.div { className: "col-8"} [ H.text username ]
, H.p { className: "col-2"} [ H.text "owner"]
]
......
......@@ -101,7 +101,7 @@ type UploadFile =
uploadFileView :: R2.Leaf Props
uploadFileView = R2.leafComponent uploadFileViewCpt
uploadFileView = R2.leaf uploadFileViewCpt
uploadFileViewCpt :: R.Component Props
uploadFileViewCpt = here.component "uploadFileView" cpt
where
......@@ -276,7 +276,7 @@ uploadButtonCpt = here.component "uploadButton" cpt
dispatch CloseBox
uploadListView :: R2.Leaf Props
uploadListView = R2.leafComponent uploadListViewCpt
uploadListView = R2.leaf uploadListViewCpt
uploadListViewCpt :: R.Component Props
uploadListViewCpt = here.component "uploadListView" cpt where
cpt { dispatch, session } _ = do
......@@ -676,7 +676,7 @@ type UploadTermButtonProps =
)
uploadTermButton :: R2.Leaf UploadTermButtonProps
uploadTermButton = R2.leafComponent uploadTermButtonCpt
uploadTermButton = R2.leaf uploadTermButtonCpt
uploadTermButtonCpt :: R.Component UploadTermButtonProps
uploadTermButtonCpt = here.component "uploadTermButton" cpt
where
......
......@@ -47,7 +47,7 @@ type CommonProps =
)
nodePopupView :: R2.Leaf NodePopupProps
nodePopupView = R2.leafComponent nodePopupViewCpt
nodePopupView = R2.leaf nodePopupViewCpt
nodePopupViewCpt :: R.Component NodePopupProps
nodePopupViewCpt = here.component "nodePopupView" cpt where
cpt p@{ id, name, nodeType } _ = do
......@@ -328,7 +328,7 @@ type PanelActionProps =
)
panelAction :: R2.Leaf PanelActionProps
panelAction = R2.leafComponent panelActionCpt
panelAction = R2.leaf panelActionCpt
panelActionCpt :: R.Component PanelActionProps
panelActionCpt = here.component "panelAction" cpt
where
......
......@@ -280,7 +280,7 @@ type CheckboxProps =
( value :: T.Box Boolean )
checkbox :: R2.Leaf CheckboxProps
checkbox = R2.leafComponent checkboxCpt
checkbox = R2.leaf checkboxCpt
checkboxCpt :: R.Component CheckboxProps
checkboxCpt = here.component "checkbox" cpt
where
......
......@@ -23,7 +23,7 @@ type Props =
)
inputWithEnterWithKey :: R2.Leaf ( key :: String | Props )
inputWithEnterWithKey = R2.leafComponent inputWithEnterWithKeyCpt
inputWithEnterWithKey = R2.leaf inputWithEnterWithKeyCpt
inputWithEnterWithKeyCpt :: R.Component ( key :: String | Props )
inputWithEnterWithKeyCpt = here.component "inputWithEnterWithKey" cpt where
cpt { onBlur, onEnter, onValueChanged, autoFocus, className, defaultValue, placeholder, type: t } _ = do
......@@ -37,7 +37,7 @@ inputWithEnterWithKeyCpt = here.component "inputWithEnterWithKey" cpt where
, type: t }
inputWithEnter :: R2.Leaf Props
inputWithEnter = R2.leafComponent inputWithEnterCpt
inputWithEnter = R2.leaf inputWithEnterCpt
inputWithEnterCpt :: R.Component Props
inputWithEnterCpt = here.component "inputWithEnter" cpt
where
......
......@@ -169,7 +169,7 @@ type RenderListElementProps =
, selection :: T.Box Selection )
renderListElement :: R2.Leaf RenderListElementProps
renderListElement = R2.leafComponent renderListElementCpt
renderListElement = R2.leaf renderListElementCpt
renderListElementCpt :: R.Component RenderListElementProps
renderListElementCpt = here.component "renderListElement" cpt where
cpt { id, name, selection } _ = do
......
......@@ -25,7 +25,7 @@ type SearchInputProps =
-- "key": to prevent refreshing & losing input
searchInput :: R2.Leaf ( key :: String | SearchInputProps )
searchInput = R2.leafComponent searchInputCpt
searchInput = R2.leaf searchInputCpt
searchInputCpt :: R.Component ( key :: String | SearchInputProps )
searchInputCpt = here.component "searchInput" cpt
where
......
......@@ -54,7 +54,7 @@ type LayoutProps =
)
annuaireLayout :: R2.Leaf LayoutProps
annuaireLayout = R2.leafComponent annuaireLayoutCpt
annuaireLayout = R2.leaf annuaireLayoutCpt
annuaireLayoutCpt :: R.Component LayoutProps
annuaireLayoutCpt = here.component "annuaireLayout" cpt where
cpt { frontends, nodeId, session } _ = do
......@@ -68,7 +68,7 @@ type KeyLayoutProps =
)
annuaireLayoutWithKey :: R2.Leaf KeyLayoutProps
annuaireLayoutWithKey = R2.leafComponent annuaireLayoutWithKeyCpt
annuaireLayoutWithKey = R2.leaf annuaireLayoutWithKeyCpt
annuaireLayoutWithKeyCpt :: R.Component KeyLayoutProps
annuaireLayoutWithKeyCpt = here.component "annuaireLayoutWithKey" cpt where
......@@ -92,7 +92,7 @@ type AnnuaireProps =
-- | Renders a basic table and the page loader
annuaire :: R2.Leaf AnnuaireProps
annuaire = R2.leafComponent annuaireCpt
annuaire = R2.leaf annuaireCpt
-- Abuses closure to work around the Loader
annuaireCpt :: R.Component AnnuaireProps
......
......@@ -60,7 +60,7 @@ type TabsProps =
)
tabs :: R2.Leaf TabsProps
tabs = R2.leafComponent tabsCpt
tabs = R2.leaf tabsCpt
tabsCpt :: R.Component TabsProps
tabsCpt = here.component "tabs" cpt where
cpt props _ = do
......@@ -110,7 +110,7 @@ type NgramsViewTabsProps =
| TabsProps )
ngramsView :: R2.Leaf NgramsViewTabsProps
ngramsView = R2.leafComponent ngramsViewCpt
ngramsView = R2.leaf ngramsViewCpt
ngramsViewCpt :: R.Component NgramsViewTabsProps
ngramsViewCpt = here.component "ngramsView" cpt where
cpt props@{ defaultListId, mode, nodeId, session } _ = do
......
......@@ -91,7 +91,7 @@ userLayoutCpt = here.component "userLayout" cpt
pure $ userLayoutWithKey $ Record.merge props { key: show sid <> "-" <> show nodeId }
userLayoutWithKey :: R2.Leaf ( key :: String | LayoutProps )
userLayoutWithKey = R2.leafComponent userLayoutWithKeyCpt
userLayoutWithKey = R2.leaf userLayoutWithKeyCpt
userLayoutWithKeyCpt :: R.Component ( key :: String | LayoutProps )
userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
cpt { boxes: boxes@{ sidePanelTexts }
......@@ -184,7 +184,7 @@ type ContactInfoItemProps =
)
contactInfoItem :: R2.Leaf ContactInfoItemProps
contactInfoItem = R2.leafComponent contactInfoItemCpt
contactInfoItem = R2.leaf contactInfoItemCpt
contactInfoItemCpt :: R.Component ContactInfoItemProps
contactInfoItemCpt = here.component "contactInfoItem" cpt
where
......@@ -216,7 +216,7 @@ type ItemProps =
)
itemNotEditing :: R2.Leaf ItemProps
itemNotEditing = R2.leafComponent itemNotEditingCpt
itemNotEditing = R2.leaf itemNotEditingCpt
itemNotEditingCpt :: R.Component ItemProps
itemNotEditingCpt = here.component "itemEditing" cpt where
cpt { isEditing, valueBox } _ = do
......@@ -233,7 +233,7 @@ itemNotEditingCpt = here.component "itemEditing" cpt where
click _ = T.write_ true isEditing
itemEditing :: R2.Leaf ItemProps
itemEditing = R2.leafComponent itemEditingCpt
itemEditing = R2.leaf itemEditingCpt
itemEditingCpt :: R.Component ItemProps
itemEditingCpt = here.component "itemNotEditing" cpt where
cpt { defaultVal, isEditing, lens, onUpdateUserInfo, userInfo, valueBox } _ = do
......
......@@ -58,7 +58,7 @@ type TabsProps =
)
tabs :: R2.Leaf TabsProps
tabs = R2.leafComponent tabsCpt
tabs = R2.leaf tabsCpt
tabsCpt :: R.Component TabsProps
tabsCpt = here.component "tabs" cpt
where
......
......@@ -97,7 +97,7 @@ mkRequest :: Session -> ReloadPath -> GUC.Request
mkRequest session (_ /\ path) = GUC.makeGetRequest session $ chartUrl path
pie :: R2.Leaf Props
pie = R2.leafComponent pieCpt
pie = R2.leaf pieCpt
pieCpt :: R.Component Props
pieCpt = here.component "pie" cpt
where
......
......@@ -46,7 +46,7 @@ type ViewProps =
)
corpusCodeLayout :: R2.Leaf Props
corpusCodeLayout = R2.leafComponent corpusCodeLayoutCpt
corpusCodeLayout = R2.leaf corpusCodeLayoutCpt
corpusCodeLayoutCpt :: R.Component Props
corpusCodeLayoutCpt = here.component "corpusCodeLayout" cpt where
cpt { nodeId, session, boxes } _ = do
......
......@@ -48,7 +48,7 @@ instance Eq File where
type FileLayoutProps = ( nodeId :: NodeID, session :: Session )
fileLayout :: R2.Leaf FileLayoutProps
fileLayout = R2.leafComponent fileLayoutCpt
fileLayout = R2.leaf fileLayoutCpt
fileLayoutCpt :: R.Component FileLayoutProps
fileLayoutCpt = here.component "fileLayout" cpt where
cpt { nodeId, session } _ = do
......
......@@ -83,7 +83,7 @@ type HomeProps =
( boxes :: Boxes )
homeLayout :: R2.Leaf HomeProps
homeLayout = R2.leafComponent homeLayoutCpt
homeLayout = R2.leaf homeLayoutCpt
homeLayoutCpt :: R.Component HomeProps
homeLayoutCpt = here.component "homeLayout" cpt
where
......@@ -223,7 +223,7 @@ type TutorialProps =
, sessions :: Array Session )
tutorial :: R2.Leaf TutorialProps
tutorial = R2.leafComponent tutorialCpt
tutorial = R2.leaf tutorialCpt
tutorialCpt :: R.Component TutorialProps
tutorialCpt = here.component "tutorial" cpt where
cpt { sessions } _ = do
......
......@@ -66,7 +66,7 @@ loadPublicData _l = do
-}
renderPublic :: R2.Leaf ()
renderPublic = R2.leafComponent renderPublicCpt
renderPublic = R2.leaf renderPublicCpt
renderPublicCpt :: R.Component ()
renderPublicCpt = here.component "renderPublic" cpt where
cpt _ _ = do
......
......@@ -64,7 +64,7 @@ type SessionNodeProps = ( nodeId :: NodeID | SessionProps )
type Props' = ( backend :: Backend, route' :: AppRoute | Props )
router :: R2.Leaf Props
router = R2.leafComponent routerCpt
router = R2.leaf routerCpt
routerCpt :: R.Component Props
routerCpt = here.component "router" cpt where
cpt { boxes: boxes@{ handed } } _ = do
......@@ -121,7 +121,7 @@ routerCpt = here.component "router" cpt where
--------------------------------------------------------------
mainPage :: R2.Leaf Props
mainPage = R2.leafComponent mainPageCpt
mainPage = R2.leaf mainPageCpt
mainPageCpt :: R.Component Props
mainPageCpt = here.component "mainPage" cpt where
cpt { boxes } _ = do
......@@ -266,7 +266,7 @@ forestCpt = R.memo' $ here.component "forest" cpt where
--------------------------------------------------------------
sidePanel :: R2.Leaf Props
sidePanel = R2.leafComponent sidePanelCpt
sidePanel = R2.leaf sidePanelCpt
sidePanelCpt :: R.Component Props
sidePanelCpt = here.component "sidePanel" cpt where
cpt props@{ boxes: { session
......
......@@ -731,7 +731,7 @@ tableHeaderLayoutCpt = here.component "tableHeaderLayout" cpt
cacheStateToggle NT.CacheOff = NT.CacheOn
table :: R2.Leaf Props
table = R2.leafComponent tableCpt
table = R2.leaf tableCpt
tableCpt :: R.Component Props
tableCpt = here.component "table" cpt
where
......@@ -860,7 +860,7 @@ type PaginationProps =
, totalPages :: Int )
pagination :: R2.Leaf PaginationProps
pagination = R2.leafComponent paginationCpt
pagination = R2.leaf paginationCpt
paginationCpt :: R.Component PaginationProps
paginationCpt = here.component "pagination" cpt
where
......
......@@ -51,9 +51,6 @@ type Component p = Record p -> Array R.Element -> R.Element
-- | UI Component type with only required props and no child
type Leaf p = Record p -> R.Element
leafComponent :: forall p. (R.Component p) -> Record p -> R.Element
leafComponent cpt p = R.createElement cpt p []
-- | UI Component type containing optional props and children
type OptComponent options props provided = CO.Defaults (Record options) (Record provided) (Record props)
=> Record provided -> Array R.Element -> R.Element
......
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