Commit c6d891bb authored by Fabien Manière's avatar Fabien Manière

fix a systematic path in the search results

parent 4a302ff2
Pipeline #6020 failed with stage
in 18 minutes and 47 seconds
......@@ -172,12 +172,10 @@ treeSearchRender = R2.leaf treeSearchRenderCpt
treeSearchRenderCpt :: R.Component RenderProps
treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
cpt { visible, session, searchData, goToRoute } _ = do
{ route } <- AppStore.use
route' <- T.useLive T.unequal route
pure $ H.div {className: "search-modal__results"} (results route' searchData)
pure $ H.div {className: "search-modal__results"} (results searchData)
where
results route' s = map searchResult s
results s = map searchResult s
where
searchResult sd = H.div
{ className: "result py-1"}
......@@ -197,7 +195,7 @@ treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
[
H.text " Path: "
, breadcrumbView { format: "text"
, route: route'
, route: getRouteFromSearchResult sd session
, session
}
]
......@@ -207,7 +205,7 @@ treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
{ className: "result__button"
, callback: \_ -> do
T.write_ false visible
goToRoute $ fromMaybe Home $ nodeTypeAppRoute sd.type (sessionId session) sd.id
goToRoute $ getRouteFromSearchResult sd session
, variant: ButtonVariant Light }
[
B.icon {name: getIcon sd.type true}
......@@ -220,7 +218,7 @@ treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
[
H.text " — "
, breadcrumbView { format: "text"
, route: route'
, route: getRouteFromSearchResult sd session
, session: session
}
]
......@@ -231,3 +229,6 @@ type LoadProps = ( session :: Session, query :: String )
loadSearch :: Record LoadProps -> AffRESTError (Array SearchData)
loadSearch { session: s, query: q} = get s $ appPath (TreeFlat (sessionId s) (sessionRoot s) q)
where sessionRoot (Session {treeId}) = treeId
getRouteFromSearchResult :: SearchData -> Session -> AppRoute
getRouteFromSearchResult sd session = fromMaybe Home $ nodeTypeAppRoute sd.type (sessionId session) sd.id
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