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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Christian Merten
purescript-gargantext
Commits
7c667c73
Commit
7c667c73
authored
Oct 03, 2023
by
Fabien Manière
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
complete breadcrumb
parent
4aca0e4a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
97 additions
and
23 deletions
+97
-23
bootstrap-darkster.css
dist/styles/bootstrap-darkster.css
+4
-0
bootstrap-default.css
dist/styles/bootstrap-default.css
+4
-0
bootstrap-greyson.css
dist/styles/bootstrap-greyson.css
+4
-0
bootstrap-herbie.css
dist/styles/bootstrap-herbie.css
+4
-0
bootstrap-monotony.css
dist/styles/bootstrap-monotony.css
+4
-0
Breadcrumb.purs
src/Gargantext/Components/Forest/Breadcrumb.purs
+73
-22
_breadcrumb.sass
src/sass/_legacy/_breadcrumb.sass
+4
-1
No files found.
dist/styles/bootstrap-darkster.css
View file @
7c667c73
...
@@ -12332,6 +12332,10 @@ select.form-control {
...
@@ -12332,6 +12332,10 @@ select.form-control {
.breadcrumb-wrapper
.breadcrumb-item
.b-icon
{
.breadcrumb-wrapper
.breadcrumb-item
.b-icon
{
margin
:
0
4px
;
margin
:
0
4px
;
}
}
.breadcrumb-wrapper
.fa-spinner
{
font-size
:
100%
;
margin
:
auto
10px
;
}
.dropdown-menu
{
.dropdown-menu
{
background-color
:
#181A1B
;
background-color
:
#181A1B
;
...
...
dist/styles/bootstrap-default.css
View file @
7c667c73
...
@@ -12134,6 +12134,10 @@ select.form-control {
...
@@ -12134,6 +12134,10 @@ select.form-control {
.breadcrumb-wrapper
.breadcrumb-item
.b-icon
{
.breadcrumb-wrapper
.breadcrumb-item
.b-icon
{
margin
:
0
4px
;
margin
:
0
4px
;
}
}
.breadcrumb-wrapper
.fa-spinner
{
font-size
:
100%
;
margin
:
auto
10px
;
}
.btn-secondary
,
.btn-secondary
,
.btn-secondary
:hover
,
.btn-secondary
:hover
,
...
...
dist/styles/bootstrap-greyson.css
View file @
7c667c73
...
@@ -11898,5 +11898,9 @@ select.form-control {
...
@@ -11898,5 +11898,9 @@ select.form-control {
.breadcrumb-wrapper
.breadcrumb-item
.b-icon
{
.breadcrumb-wrapper
.breadcrumb-item
.b-icon
{
margin
:
0
4px
;
margin
:
0
4px
;
}
}
.breadcrumb-wrapper
.fa-spinner
{
font-size
:
100%
;
margin
:
auto
10px
;
}
/*# sourceMappingURL=bootstrap-greyson.css.map */
/*# sourceMappingURL=bootstrap-greyson.css.map */
dist/styles/bootstrap-herbie.css
View file @
7c667c73
...
@@ -12146,5 +12146,9 @@ select.form-control {
...
@@ -12146,5 +12146,9 @@ select.form-control {
.breadcrumb-wrapper
.breadcrumb-item
.b-icon
{
.breadcrumb-wrapper
.breadcrumb-item
.b-icon
{
margin
:
0
4px
;
margin
:
0
4px
;
}
}
.breadcrumb-wrapper
.fa-spinner
{
font-size
:
100%
;
margin
:
auto
10px
;
}
/*# sourceMappingURL=bootstrap-herbie.css.map */
/*# sourceMappingURL=bootstrap-herbie.css.map */
dist/styles/bootstrap-monotony.css
View file @
7c667c73
...
@@ -12147,5 +12147,9 @@ select.form-control {
...
@@ -12147,5 +12147,9 @@ select.form-control {
.breadcrumb-wrapper
.breadcrumb-item
.b-icon
{
.breadcrumb-wrapper
.breadcrumb-item
.b-icon
{
margin
:
0
4px
;
margin
:
0
4px
;
}
}
.breadcrumb-wrapper
.fa-spinner
{
font-size
:
100%
;
margin
:
auto
10px
;
}
/*# sourceMappingURL=bootstrap-monotony.css.map */
/*# sourceMappingURL=bootstrap-monotony.css.map */
src/Gargantext/Components/Forest/Breadcrumb.purs
View file @
7c667c73
...
@@ -22,9 +22,11 @@ import Gargantext.Components.GraphQL.Tree (BreadcrumbInfo, TreeNode)
...
@@ -22,9 +22,11 @@ import Gargantext.Components.GraphQL.Tree (BreadcrumbInfo, TreeNode)
import Gargantext.Components.Login.Types (TreeId, UserId)
import Gargantext.Components.Login.Types (TreeId, UserId)
import Gargantext.Ends (Frontends, Backend(..))
import Gargantext.Ends (Frontends, Backend(..))
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Routes (AppRoute(Home), appPath, nodeTypeAppRoute)
import Gargantext.Sessions
import Gargantext.Sessions
import Gargantext.Sessions.Types
import Gargantext.Sessions.Types
import Gargantext.Types (CorpusId, FrontendError, NodeID, NodeType, SessionId)
import Gargantext.Types (CorpusId, FrontendError, NodeID, NodeType, SessionId)
import Gargantext.Types as GT
import Gargantext.Utils as GU
import Gargantext.Utils as GU
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix as R
...
@@ -44,13 +46,14 @@ here :: R2.Here
...
@@ -44,13 +46,14 @@ here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Breadcrumb"
here = R2.here "Gargantext.Components.Forest.Breadcrumb"
type PropsBoxes = ( boxes :: Boxes )
type PropsBoxes = ( boxes :: Boxes )
type Props =
type Props =
( nodeId :: Int
( nodeId :: Int
, session :: Maybe Session
, session :: Maybe Session
)
)
maybeToSession :: Maybe Session -> Session
--
maybeToSession :: Maybe Session -> Session
maybeToSession s = fromMaybe Nothing s
--
maybeToSession s = fromMaybe Nothing s
component :: R2.Leaf PropsBoxes
component :: R2.Leaf PropsBoxes
...
@@ -65,28 +68,48 @@ componentCpt = here.component "breadcrumb" cpt where
...
@@ -65,28 +68,48 @@ componentCpt = here.component "breadcrumb" cpt where
-- | Effects
-- | Effects
-- |
-- |
url <- R.unsafeHooksEffect GU.href
--
url <- R.unsafeHooksEffect GU.href
-- | Behaviors
-- | Behaviors
-- |
-- |
let
--
let
-- currentUrl = url
-- currentUrl = url
-- fragment = Fragment.toString $ Fragment.fromString "http://localhost:8008/#/corpus/user1@localhost:8008/112"
-- fragment = Fragment.toString $ Fragment.fromString "http://localhost:8008/#/corpus/user1@localhost:8008/112"
-- fragment = Fragment.toString $ Fragment.fromString url
-- fragment = Fragment.toString $ Fragment.fromString url
currentNodeId = fromMaybe 0 $ fromString $ getLastUrlElement url
--
currentNodeId = fromMaybe 0 $ fromString $ getLastUrlElement url
case session' of
case session' of
Nothing -> pure $ H.div {} []
Nothing -> pure $ H.div {} []
Just (session') -> do
Just (session') -> do
url <- R.unsafeHooksEffect GU.href
let nodeId = fromMaybe 0 $ fromString $ getLastUrlElement url
-- breadcrumbData <- R2.useLayoutEffect1' $ getBreadcrumb session' currentNodeId
-- breadcrumbData <- R2.useLayoutEffect1' $ getBreadcrumb session' currentNodeId
let session'' = Just session'
pure $
pure $
-- breadcrumb layout
-- breadcrumb layout
H.div {}
H.nav { className: "breadcrumb-wrapper bg-light"
, "aria-label": "breadcrumb" }
[
[
breadcrumbView { currentNodeId, session' }
H.ol { className: "breadcrumb text-small" }
[
H.li { className: "breadcrumb-item" }
[
H.a { href: "/" }
[ H.span { className: "" }
[
B.icon { name: "home" }
]
, H.text "Home"
]
]
,
breadcrumbView { nodeId: nodeId
, session: Just session'
}
]
-- ,
-- ,
-- H.nav
-- H.nav
-- { className: "breadcrumb-wrapper bg-light"
-- { className: "breadcrumb-wrapper bg-light"
...
@@ -143,17 +166,11 @@ breadcrumbView = R2.leaf breadcrumbViewCpt
...
@@ -143,17 +166,11 @@ breadcrumbView = R2.leaf breadcrumbViewCpt
breadcrumbViewCpt :: R.Component Props
breadcrumbViewCpt :: R.Component Props
breadcrumbViewCpt = here.component "breadcrumbViewCpt" cpt where
breadcrumbViewCpt = here.component "breadcrumbViewCpt" cpt where
cpt { nodeId, session } _ = do
cpt { nodeId, session } _ = do
-- session' <- session
let session' = session
-- session' <- T.useLive T.unequal session
-- url <- R.unsafeHooksEffect GU.href
-- let nodeId = fromMaybe 0 $ fromString $ getLastUrlElement url
session' <- liftEffect $ maybeToSession session
case session' of
case session' of
Nothing -> pure $ H.div {} []
Nothing -> pure $ H.div {} []
Just (session') -> do
Just (session') -> do
-- reload <- T.useBox T2.newReload
-- reload' <- T.useLive T.unequal reload
useLoader { errorHandler
useLoader { errorHandler
, loader: loadBreadcrumbData
, loader: loadBreadcrumbData
, path: { nodeId: nodeId
, path: { nodeId: nodeId
...
@@ -180,12 +197,17 @@ breadcrumbViewMain :: R2.Component BreadcrumbViewProps
...
@@ -180,12 +197,17 @@ breadcrumbViewMain :: R2.Component BreadcrumbViewProps
breadcrumbViewMain = R.createElement breadcrumbViewMainCpt
breadcrumbViewMain = R.createElement breadcrumbViewMainCpt
breadcrumbViewMainCpt :: R.Component BreadcrumbViewProps
breadcrumbViewMainCpt :: R.Component BreadcrumbViewProps
breadcrumbViewMainCpt = here.component "breadcrumbViewMainCpt" cpt where
breadcrumbViewMainCpt = here.component "breadcrumbViewMainCpt" cpt where
cpt props@{ items: { parents } } _ = do
cpt props@{ items: { parents }, session } _ = do
-- session' <- T.useLive T.unequal session
let items = makeBreadcrumbElements parents props
let items = makeBreadcrumbElements parents props
pure $
-- case session of
H.div { className: "breadcrumb-view" } $
-- Nothing -> pure $ H.div {} []
items
-- Just (session) -> do
pure $
R.fragment items
makeBreadcrumbElements :: Array TreeNode -> Record BreadcrumbViewProps -> Array R.Element
makeBreadcrumbElements :: Array TreeNode -> Record BreadcrumbViewProps -> Array R.Element
...
@@ -198,7 +220,7 @@ breadcrumbViewMainCpt = here.component "breadcrumbViewMainCpt" cpt where
...
@@ -198,7 +220,7 @@ breadcrumbViewMainCpt = here.component "breadcrumbViewMainCpt" cpt where
, parentId: props.nodeId
, parentId: props.nodeId
-- , reload: props.reload
-- , reload: props.reload
, session: props.session
, session: props.session
-- , style: Folder
Child
-- , style: Folder
Up
, text: node.name
, text: node.name
, disabled: false
, disabled: false
}
}
...
@@ -231,13 +253,42 @@ breadcrumbItemCpt = here.component "breadcrumbItemCpt" cpt where
...
@@ -231,13 +253,42 @@ breadcrumbItemCpt = here.component "breadcrumbItemCpt" cpt where
, text
, text
, disabled
, disabled
} _ = do
} _ = do
let sid = sessionId session
let rootId = treeId session
pure $
pure $
H.li { className: "breadcrumb-item" }
H.div { className: "bItem" }
[
[
H.text props.text
H.a { className: ""
, href: "/#/" <> createNodeUrl linkId rootId linkNodeType sid
}
[
H.span { className: "" }
[
-- B.icon { name: "folder-open-o" }
B.icon
{ className: ""
, name: GT.getIcon nodeType true
}
]
,
H.text props.text
]
]
]
createNodeUrl :: Int -> Int -> NodeType -> SessionId -> String
createNodeUrl lId rootId nType sId
-- | rootId == lId = appPath Home
| otherwise = appPath $ getFolderPath nType sId lId
getFolderPath :: GT.NodeType -> GT.SessionId -> Int -> AppRoute
getFolderPath nodeType sid nodeId = fromMaybe Home $ nodeTypeAppRoute nodeType sid nodeId
treeId :: Session -> Int
treeId (Session {treeId: tId}) = tId
getLastUrlElement :: String -> String
getLastUrlElement :: String -> String
getLastUrlElement str = fromMaybe "" $ A.last $ split (Pattern "/") str
getLastUrlElement str = fromMaybe "" $ A.last $ split (Pattern "/") str
...
...
src/sass/_legacy/_breadcrumb.sass
View file @
7c667c73
...
@@ -10,4 +10,7 @@
...
@@ -10,4 +10,7 @@
font-weight
:
bold
font-weight
:
bold
color
:
$primary
color
:
$primary
.b-icon
.b-icon
margin
:
0
space-x
(
0
.5
)
margin
:
0
space-x
(
0
.5
)
\ No newline at end of file
.fa-spinner
font-size
:
100%
margin
:
auto
10px
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment