Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nisum-scorecard
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
Venkaiah Naidu Singamchetty
nisum-scorecard
Commits
2a5ebb50
Commit
2a5ebb50
authored
Mar 21, 2024
by
Shiva Komirishetti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Page count changes
parent
6afce932
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
13 deletions
+17
-13
index.jsx
src/components/leftSidebar/index.jsx
+4
-6
index.jsx
src/pages/dashboard/index.jsx
+4
-6
reporteesSlice.js
src/redux/reducers/reporteesSlice.js
+9
-1
No files found.
src/components/leftSidebar/index.jsx
View file @
2a5ebb50
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
fetchReportees
,
setViewReportee
}
from
"../../redux/reducers/reporteesSlice"
;
import
{
fetchReportees
,
setViewReportee
,
setCurrPage
,
setPagesCount
}
from
"../../redux/reducers/reporteesSlice"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
useSelector
,
useDispatch
}
from
"react-redux"
;
import
{
useSelector
,
useDispatch
}
from
"react-redux"
;
import
{
useParams
}
from
"react-router-dom"
;
import
{
useParams
}
from
"react-router-dom"
;
...
@@ -9,10 +9,8 @@ import PaginationComponent from "../Pagenation/Pagenation";
...
@@ -9,10 +9,8 @@ import PaginationComponent from "../Pagenation/Pagenation";
function
LeftSidebar
()
{
function
LeftSidebar
()
{
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
[
currPage
,
setCurrPage
]
=
useState
(
1
);
const
[
pagesCount
,
setPagesCount
]
=
useState
(
1
);
const
[
inputValue
,
setInputValue
]
=
useState
(
null
);
const
[
inputValue
,
setInputValue
]
=
useState
(
null
);
const
{
reportees
,
loading
,
viewReportee
,
totalCount
}
=
useSelector
((
state
)
=>
state
.
reportees
);
const
{
reportees
,
loading
,
viewReportee
,
totalCount
,
currPage
,
pagesCount
}
=
useSelector
((
state
)
=>
state
.
reportees
);
const
userDetails
=
useSelector
((
state
)
=>
state
.
userDetails
);
const
userDetails
=
useSelector
((
state
)
=>
state
.
userDetails
);
...
@@ -38,7 +36,7 @@ function LeftSidebar() {
...
@@ -38,7 +36,7 @@ function LeftSidebar() {
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
setPagesCount
(
Math
.
ceil
((
totalCount
)
/
(
10
)))
dispatch
(
setPagesCount
(
Math
.
ceil
((
totalCount
)
/
(
10
)
)))
},
[
totalCount
])
},
[
totalCount
])
const
handlePageChange
=
(
currPage
)
=>
{
const
handlePageChange
=
(
currPage
)
=>
{
...
@@ -47,7 +45,7 @@ function LeftSidebar() {
...
@@ -47,7 +45,7 @@ function LeftSidebar() {
page
:
currPage
,
page
:
currPage
,
perPage
:
10
perPage
:
10
}
}
setCurrPage
(
currPage
)
dispatch
(
setCurrPage
(
currPage
)
)
dispatch
(
fetchReportees
(
data
))
dispatch
(
fetchReportees
(
data
))
}
}
...
...
src/pages/dashboard/index.jsx
View file @
2a5ebb50
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Link
,
useNavigate
}
from
"react-router-dom"
;
import
{
Link
,
useNavigate
}
from
"react-router-dom"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
fetchReportees
,
setViewReportee
}
from
"../../redux/reducers/reporteesSlice"
;
import
{
fetchReportees
,
setViewReportee
,
setCurrPage
,
setPagesCount
}
from
"../../redux/reducers/reporteesSlice"
;
import
Table
from
'../../components/table'
;
import
Table
from
'../../components/table'
;
import
RightArrowIcon
from
'../../assets/icons/rightArrowIcon'
;
import
RightArrowIcon
from
'../../assets/icons/rightArrowIcon'
;
import
{
scoreColor
}
from
'../../utils/commonFunctions'
;
import
{
scoreColor
}
from
'../../utils/commonFunctions'
;
...
@@ -10,11 +10,9 @@ import PaginationComponent from "../../components/Pagenation/Pagenation";
...
@@ -10,11 +10,9 @@ import PaginationComponent from "../../components/Pagenation/Pagenation";
function
Dashboard
()
{
function
Dashboard
()
{
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
const
{
reportees
,
loading
,
totalCount
}
=
useSelector
((
state
)
=>
state
.
reportees
);
const
{
reportees
,
loading
,
totalCount
,
currPage
,
pagesCount
}
=
useSelector
((
state
)
=>
state
.
reportees
);
const
userDetails
=
useSelector
((
state
)
=>
state
.
userDetails
);
const
userDetails
=
useSelector
((
state
)
=>
state
.
userDetails
);
const
[
reporteIds
,
setReporteIds
]
=
useState
([]);
const
[
reporteIds
,
setReporteIds
]
=
useState
([]);
const
[
currPage
,
setCurrPage
]
=
useState
(
1
)
const
[
pagesCount
,
setPagesCount
]
=
useState
(
1
);
const
[
inputValue
,
setInputValue
]
=
useState
(
''
);
const
[
inputValue
,
setInputValue
]
=
useState
(
''
);
// userDetails.user.reportees || [];
// userDetails.user.reportees || [];
...
@@ -24,13 +22,13 @@ function Dashboard() {
...
@@ -24,13 +22,13 @@ function Dashboard() {
page
:
currPage
,
page
:
currPage
,
perPage
:
10
perPage
:
10
}
}
setCurrPage
(
currPage
)
dispatch
(
setCurrPage
(
currPage
)
)
dispatch
(
fetchReportees
(
data
))
dispatch
(
fetchReportees
(
data
))
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
setPagesCount
(
Math
.
ceil
((
totalCount
)
/
(
10
)))
dispatch
(
setPagesCount
(
Math
.
ceil
((
totalCount
)
/
(
10
)
)))
},
[
totalCount
])
},
[
totalCount
])
useEffect
(()
=>
{
useEffect
(()
=>
{
...
...
src/redux/reducers/reporteesSlice.js
View file @
2a5ebb50
...
@@ -8,6 +8,8 @@ const initialState = {
...
@@ -8,6 +8,8 @@ const initialState = {
totalCount
:
0
,
totalCount
:
0
,
loading
:
false
,
loading
:
false
,
error
:
null
,
error
:
null
,
currPage
:
1
,
pagesCount
:
1
};
};
export
const
fetchReportees
=
createAsyncThunk
(
"getreportees"
,
async
(
data
)
=>
{
export
const
fetchReportees
=
createAsyncThunk
(
"getreportees"
,
async
(
data
)
=>
{
...
@@ -35,6 +37,12 @@ const reporteesSlice = createSlice({
...
@@ -35,6 +37,12 @@ const reporteesSlice = createSlice({
viewReportee
:
reportee
viewReportee
:
reportee
}
}
}
}
},
setCurrPage
:
(
state
,
action
)
=>
{
state
.
currPage
=
action
.
payload
},
setPagesCount
:
(
state
,
action
)
=>
{
state
.
pagesCount
=
action
.
payload
}
}
},
},
extraReducers
:
(
builder
)
=>
{
extraReducers
:
(
builder
)
=>
{
...
@@ -56,6 +64,6 @@ const reporteesSlice = createSlice({
...
@@ -56,6 +64,6 @@ const reporteesSlice = createSlice({
},
},
});
});
export
const
{
resetReportees
,
setViewReportee
}
=
reporteesSlice
.
actions
;
export
const
{
resetReportees
,
setViewReportee
,
setCurrPage
,
setPagesCount
}
=
reporteesSlice
.
actions
;
export
default
reporteesSlice
.
reducer
;
export
default
reporteesSlice
.
reducer
;
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