Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
C
cms
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
Pedro-dev_2
cms
Commits
9370584b
Commit
9370584b
authored
Jun 03, 2021
by
PDuarte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storing poject current
parent
7cd6a131
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
1 deletion
+89
-1
NavbarUser.js
src/@core/layouts/components/navbar/NavbarUser.js
+10
-0
SelectProject.js
src/@core/layouts/components/navbar/SelectProject.js
+74
-0
index.js
src/redux/actions/navbar/index.js
+1
-0
index.js
src/redux/reducers/navbar/index.js
+4
-1
No files found.
src/@core/layouts/components/navbar/NavbarUser.js
View file @
9370584b
...
@@ -5,6 +5,9 @@ import UserDropdown from './UserDropdown'
...
@@ -5,6 +5,9 @@ import UserDropdown from './UserDropdown'
import
NavbarSearch
from
'./NavbarSearch'
import
NavbarSearch
from
'./NavbarSearch'
import
NotificationDropdown
from
'./NotificationDropdown'
import
NotificationDropdown
from
'./NotificationDropdown'
import
SelectProject
from
'./SelectProject'
// ** Third Party Components
// ** Third Party Components
import
{
Sun
,
Moon
}
from
'react-feather'
import
{
Sun
,
Moon
}
from
'react-feather'
import
{
NavItem
,
NavLink
}
from
'reactstrap'
import
{
NavItem
,
NavLink
}
from
'reactstrap'
...
@@ -25,11 +28,18 @@ const NavbarUser = props => {
...
@@ -25,11 +28,18 @@ const NavbarUser = props => {
return
(
return
(
<
ul
className
=
'nav navbar-nav align-items-center ml-auto'
>
<
ul
className
=
'nav navbar-nav align-items-center ml-auto'
>
{
/* <IntlDropdown /> */
}
{
/* <IntlDropdown /> */
}
<
NavItem
className
=
'd-none d-lg-block'
>
<
NavLink
className
=
'nav-link-style'
>
<
SelectProject
/>
<
/NavLink
>
<
/NavItem
>
<
NavItem
className
=
'd-none d-lg-block'
>
<
NavItem
className
=
'd-none d-lg-block'
>
<
NavLink
className
=
'nav-link-style'
>
<
NavLink
className
=
'nav-link-style'
>
<
ThemeToggler
/>
<
ThemeToggler
/>
<
/NavLink
>
<
/NavLink
>
<
/NavItem
>
<
/NavItem
>
{
/* <NavbarSearch /> */
}
{
/* <NavbarSearch /> */
}
{
/* <CartDropdown /> */
}
{
/* <CartDropdown /> */
}
{
/* <NotificationDropdown /> */
}
{
/* <NotificationDropdown /> */
}
...
...
src/@core/layouts/components/navbar/SelectProject.js
0 → 100644
View file @
9370584b
import
{
useState
,
useEffect
,
Fragment
}
from
'react'
import
AsyncSelect
from
'react-select/async'
import
{
useSelector
,
useDispatch
}
from
'react-redux'
import
{
selectThemeColors
}
from
'@utils'
import
{
getData_projects
}
from
'@src/views/settings/store/actions'
import
{
handleProjectSelected
}
from
'@store/actions/navbar'
//
const
SelectProject
=
props
=>
{
const
dispatch
=
useDispatch
()
const
store
=
useSelector
(
state
=>
state
.
projectsettings
)
const
[
dataProject
,
setProjectData
]
=
useState
([])
const
filterProjects
=
inputValue
=>
{
return
dataProject
.
filter
(
i
=>
i
.
label
.
toLowerCase
().
includes
(
inputValue
.
toLowerCase
()))
}
const
loadOptions
=
(
inputValue
,
callback
)
=>
{
setTimeout
(()
=>
{
callback
(
filterProjects
(
inputValue
))
},
2000
)
}
const
handleInputChange
=
newValue
=>
{
const
val
=
newValue
.
replace
(
/
\W
/g
,
''
)
return
val
}
const
handleChange
=
value
=>
{
console
.
log
(
value
)
dispatch
(
handleProjectSelected
(
value
))
}
useEffect
(()
=>
{
if
(
!
store
.
allDataProjects
||
store
.
allDataProjects
.
length
<
1
)
{
dispatch
(
getData_projects
({
start
:
0
,
length
:
1000
,
q
:
null
}))
}
},
[
dispatch
])
useEffect
(()
=>
{
if
(
store
.
allDataProjects
!==
null
)
{
const
proj
=
store
.
allDataProjects
.
map
(
elm
=>
{
return
{
value
:
elm
.
id
,
label
:
elm
.
app_name
}
})
setProjectData
(
proj
)
console
.
log
(
proj
)
}
},
[
store
.
allDataProjects
])
return
<
Fragment
>
{
dataProject
.
length
>
0
?
<
AsyncSelect
isClearable
=
{
false
}
className
=
'react-select'
classNamePrefix
=
'select'
name
=
'callback-react-select'
loadOptions
=
{
loadOptions
}
defaultOptions
onInputChange
=
{
handleInputChange
}
onChange
=
{
handleChange
}
theme
=
{
selectThemeColors
}
/> : <div>Loading...</
div
>
}
<
/Fragment
>
}
export
default
SelectProject
\ No newline at end of file
src/redux/actions/navbar/index.js
View file @
9370584b
...
@@ -24,3 +24,4 @@ export const updateBookmarked = id => {
...
@@ -24,3 +24,4 @@ export const updateBookmarked = id => {
// ** Handle Bookmarks & Main Search Queries
// ** Handle Bookmarks & Main Search Queries
export
const
handleSearchQuery
=
val
=>
dispatch
=>
dispatch
({
type
:
'HANDLE_SEARCH_QUERY'
,
val
})
export
const
handleSearchQuery
=
val
=>
dispatch
=>
dispatch
({
type
:
'HANDLE_SEARCH_QUERY'
,
val
})
export
const
handleProjectSelected
=
val
=>
dispatch
=>
dispatch
({
type
:
'HANDLE_PROJECT_SELECTED'
,
val
})
src/redux/reducers/navbar/index.js
View file @
9370584b
...
@@ -2,13 +2,16 @@
...
@@ -2,13 +2,16 @@
const
initialState
=
{
const
initialState
=
{
suggestions
:
[],
suggestions
:
[],
bookmarks
:
[],
bookmarks
:
[],
query
:
''
query
:
''
,
projectCurrent
:
null
}
}
const
navbarReducer
=
(
state
=
initialState
,
action
)
=>
{
const
navbarReducer
=
(
state
=
initialState
,
action
)
=>
{
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
case
'HANDLE_SEARCH_QUERY'
:
case
'HANDLE_SEARCH_QUERY'
:
return
{
...
state
,
query
:
action
.
val
}
return
{
...
state
,
query
:
action
.
val
}
case
'HANDLE_PROJECT_SELECTED'
:
return
{
...
state
,
projectCurrent
:
action
.
val
}
case
'GET_BOOKMARKS'
:
case
'GET_BOOKMARKS'
:
return
{
...
state
,
suggestions
:
action
.
data
,
bookmarks
:
action
.
bookmarks
}
return
{
...
state
,
suggestions
:
action
.
data
,
bookmarks
:
action
.
bookmarks
}
case
'UPDATE_BOOKMARKED'
:
case
'UPDATE_BOOKMARKED'
:
...
...
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