Commit 85f4f9f2 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[errors] implement errorsView

parent 613a0217
Pipeline #1709 failed with stage
module Gargantext.Components.App.Data (App, Boxes, emptyApp) where
import Gargantext.Prelude
import Data.Maybe (Maybe(..))
import Data.Set as Set
import Toestand as T
import Gargantext.Prelude
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.Nodes.Lists.Types as ListsT
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Ends (Backend)
import Gargantext.Routes (AppRoute(Home))
import Gargantext.Sessions as Sessions
import Gargantext.Sessions (Session, Sessions)
import Gargantext.Sessions as Sessions
import Gargantext.Sessions.Types (OpenNodes(..))
import Gargantext.Types (FrontendError, Handed(RightHanded), SidePanelState(..))
import Gargantext.Types (FrontendError(..), Handed(RightHanded), SidePanelState(..))
import Gargantext.Utils.Toestand as T2
type App =
......
......@@ -12,6 +12,7 @@ import Record.Extra as RE
import Toestand as T
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.ErrorsView (errorsView)
import Gargantext.Components.Footer (footer)
import Gargantext.Components.Forest as Forest
import Gargantext.Components.GraphExplorer as GraphExplorer
......@@ -43,7 +44,6 @@ import Gargantext.Sessions as Sessions
import Gargantext.Types (CorpusId, Handed(..), ListId, NodeID, NodeType(..), SessionId, SidePanelState(..), reverseHanded)
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.Router"
......@@ -67,8 +67,9 @@ routerCpt = here.component "router" cpt where
pure $ R.fragment
([ loginModal { boxes }
, topBar { boxes } ] <>
[ H.div { className: handedClassName <> " router-inner" } $ reverseHanded handed' $
, topBar { boxes }
, errorsView { errors: boxes.errors } []
, H.div { className: handedClassName <> " router-inner" } $ reverseHanded handed' $
[ forest { boxes }
, mainPage { boxes }
, sidePanel { boxes }
......
module Gargantext.Components.SimpleLayout where
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Prelude
import Gargantext.Components.TopBar (topBar)
import Gargantext.License (license)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.SimpleLayout"
-- Simple layout does not accommodate the tree
type SimpleLayoutProps = (
handed :: T.Box GT.Handed
, showTree :: T.Box Boolean
)
simpleLayout :: R2.Component SimpleLayoutProps
simpleLayout = R.createElement simpleLayoutCpt
simpleLayoutCpt :: R.Component SimpleLayoutProps
simpleLayoutCpt = here.component "simpleLayout" cpt
where
cpt { handed, showTree } children = do
pure $ H.div { className: "simple-layout" } (
[ topBar { handed, showTree } [] ] <> children <> [ license ]
)
module Gargantext.Components.TopBar where
import Gargantext.Prelude
import Data.Foldable (intercalate)
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Prelude
import Gargantext.Components.GraphExplorer.ToggleButton as Toggle
import Gargantext.Components.Themes (themeSwitcher, defaultTheme, allThemes)
import Gargantext.Types (Handed(..), reverseHanded)
import Gargantext.Types (FrontendError(..), Handed(..), reverseHanded)
import Gargantext.Utils.Reactix as R2
import Gargantext.Components.GraphExplorer.ToggleButton as Toggle
here :: R2.Here
here = R2.here "Gargantext.Components.TopBar"
type TopBarProps = ( handed :: T.Box Handed, showTree :: T.Box Boolean )
type TopBarProps =
( handed :: T.Box Handed
, showTree :: T.Box Boolean )
topBar :: R2.Component TopBarProps
topBar = R.createElement topBarCpt
topBarCpt :: R.Component TopBarProps
topBarCpt = here.component "topBar" cpt
where
......@@ -30,29 +31,30 @@ topBarCpt = here.component "topBar" cpt
, id: "dafixedtop"
, role: "navigation"
}
[ H.div { className: "container-fluid" } $ reverseHanded handed' [
-- NOTE: first (and only) entry in the sorted array should have the "ml-auto class"
-- https://stackoverflow.com/questions/19733447/bootstrap-navbar-with-left-center-or-right-aligned-items
-- In practice: only apply "ml-auto" to the last element of this list, if handed == LeftHanded
logo
, H.div { className: "collapse navbar-collapse" }
[ H.ul { className: "navbar-nav " <> if handed' == LeftHanded then "ml-auto" else "" } $ reverseHanded handed'
([ divDropdownLeft {} []
, handButton handed'
, smiley
, H.li { className: "nav-item" } [ themeSwitcher { theme: defaultTheme
, themes: allThemes } [] ]
, Toggle.treeToggleButton { state: showTree } []
] <> children)
]
]
[ H.div { className: "container-fluid" } $ reverseHanded handed'
[
-- NOTE: first (and only) entry in the sorted array should have the "ml-auto class"
-- https://stackoverflow.com/questions/19733447/bootstrap-navbar-with-left-center-or-right-aligned-items
-- In practice: only apply "ml-auto" to the last element of this list, if handed == LeftHanded
logo
, H.div { className: "collapse navbar-collapse" }
[ H.ul { className: "navbar-nav " <> if handed' == LeftHanded then "ml-auto" else "" } $ reverseHanded handed'
([ divDropdownLeft {} []
, handButton
, smiley
, H.li { className: "nav-item" } [ themeSwitcher { theme: defaultTheme
, themes: allThemes } [] ]
, Toggle.treeToggleButton { state: showTree } []
] <> children)
]
]
]
where
handButton handed' = H.li { title: "If you are Left Handed you can change\n"
<> "the interface by clicking on me. Click\n"
<> "again to come back to previous state."
, className: "nav-item"
} [handedChooser { handed } []]
handButton = H.li { title: "If you are Left Handed you can change\n"
<> "the interface by clicking on me. Click\n"
<> "again to come back to previous state."
, className: "nav-item"
} [handedChooser { handed } []]
smiley = H.li { title: "Hello! Looking for the tree ?\n"
<> "Just watch on the other side!\n"
......@@ -71,7 +73,6 @@ topBarCpt = here.component "topBar" cpt
-- SB.searchBar {session, databases: allDatabases}
logo :: R.Element
logo =
H.a { className, href: "#/" } [
......
......@@ -82,7 +82,6 @@ send m mtoken url reqbody = do
let cookie = "JWT-Cookie=" <> token <> "; Path=/;" --" HttpOnly; Secure; SameSite=Lax"
R2.setCookie cookie
affResp <- request req
liftEffect $ log2 "affResp" affResp
pure $ readJSON affResp
noReqBody :: Maybe String
......
......@@ -2,13 +2,12 @@ module Gargantext.Types where
import Gargantext.Prelude
import CSS.Cursor (Cursor(..))
import Data.Array as A
import Data.Either (Either)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Int (toNumber)
import Data.Maybe (Maybe(..), fromMaybe, maybe)
import Data.Maybe (Maybe(..), maybe)
import Data.Newtype (class Newtype)
import Data.Ord.Generic (genericCompare)
import Data.Show.Generic (genericShow)
......@@ -783,3 +782,6 @@ toggleSidePanelState Opened = Closed
newtype FrontendError = FrontendError
{ error :: String
}
derive instance Generic FrontendError _
instance Eq FrontendError where eq = genericEq
......@@ -6,9 +6,11 @@ if (typeof window !== 'undefined') {
window.ReactBootstrap = ReactBootstrap;
}
const Alert = require('react-bootstrap/Alert');
const OverlayTrigger = require('react-bootstrap/OverlayTrigger');
const Popover = require('react-bootstrap/Popover');
exports.alertCpt = Alert;
exports.overlayTriggerCpt = OverlayTrigger;
exports.popoverCpt = Popover;
exports.popoverContentCpt = Popover.Content;
......
module Gargantext.Utils.ReactBootstrap where
import Effect (Effect)
import Reactix as R
import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2
type OverlayTriggerProps =
(
overlay :: R.Element
......@@ -15,6 +18,12 @@ type Props =
(
)
type AlertProps =
( dismissible :: Boolean
, onClose :: Effect Unit
, variant :: String
)
type ContentProps =
(
)
......@@ -24,21 +33,25 @@ type TitleProps =
"as" :: String
)
foreign import alertCpt :: R.Component AlertProps
foreign import overlayTriggerCpt :: R.Component OverlayTriggerProps
foreign import popoverCpt :: R.Component Props
foreign import popoverContentCpt :: R.Component ContentProps
foreign import popoverTitleCpt :: R.Component TitleProps
overlayTrigger :: Record OverlayTriggerProps -> Array R.Element -> R.Element
alert :: R2.Component AlertProps
alert = R.rawCreateElement alertCpt
overlayTrigger :: R2.Component OverlayTriggerProps
overlayTrigger = R.rawCreateElement overlayTriggerCpt
popover :: Record Props -> Array R.Element -> R.Element
popover :: R2.Component Props
popover = R.rawCreateElement popoverCpt
popoverContent :: Record ContentProps -> Array R.Element -> R.Element
popoverContent :: R2.Component ContentProps
popoverContent = R.rawCreateElement popoverContentCpt
popoverTitle :: Record TitleProps -> Array R.Element -> R.Element
popoverTitle :: R2.Component TitleProps
popoverTitle = R.rawCreateElement popoverTitleCpt
......
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