Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-029
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2023-029
2023-029
Commits
69bfdd59
Commit
69bfdd59
authored
Sep 04, 2023
by
janithgamage1.ed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: update
Desc : update project
parent
124b8d76
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
11 deletions
+97
-11
Project/Frontend/SignConnectPlus/src/pages/learning-management/learning-curriculums-subscribed/list/list.tsx
...-management/learning-curriculums-subscribed/list/list.tsx
+94
-6
Project/Frontend/SignConnectPlus/src/sections/learning-management/learning-curriculums-subscribed/CurriculumSection.tsx
...ent/learning-curriculums-subscribed/CurriculumSection.tsx
+1
-1
Project/Frontend/SignConnectPlus/src/sections/learning-management/learning-curriculums/CurriculumCard.tsx
...arning-management/learning-curriculums/CurriculumCard.tsx
+1
-3
Project/Frontend/SignConnectPlus/src/store/reducers/userProgress.ts
...ontend/SignConnectPlus/src/store/reducers/userProgress.ts
+1
-1
No files found.
Project/Frontend/SignConnectPlus/src/pages/learning-management/learning-curriculums-subscribed/list/list.tsx
View file @
69bfdd59
...
...
@@ -26,9 +26,12 @@ import { GlobalFilter } from 'utils/react-table';
// assets
import
{
BookOutlined
}
from
'
@ant-design/icons
'
;
import
{
userProgress
}
from
'
data/userProgress
'
;
import
useAuth
from
'
hooks/useAuth
'
;
import
CurriculumSection
from
'
sections/learning-management/learning-curriculums-subscribed/CurriculumSection
'
;
import
EmptyCurriculumCard
from
'
sections/learning-management/learning-curriculums-subscribed/skeleton/EmptyCurriculumCard
'
;
import
{
useDispatch
,
useSelector
}
from
'
store
'
;
import
{
openSnackbar
}
from
'
store/reducers/snackbar
'
;
import
{
fetchUserProgress
,
toInitialState
}
from
'
store/reducers/userProgress
'
;
import
{
curriculumTypeUserProgress
,
userProgressType
}
from
'
types/userProgress
'
;
// ==============================|| List ||============================== //
...
...
@@ -46,6 +49,9 @@ const allColumns = [
const
List
=
()
=>
{
const
theme
=
useTheme
();
const
dispatch
=
useDispatch
();
const
{
userProgress
,
error
,
success
,
isLoading
}
=
useSelector
(
state
=>
state
.
userProgress
);
const
{
user
}
=
useAuth
();
const
[
data
,
setData
]
=
useState
<
userProgressType
[
"
curriculums
"
]
>
([])
...
...
@@ -61,7 +67,9 @@ const List = () => {
};
// search
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
data
||
data
.
length
==
0
)
return
const
newData
=
data
?.
filter
((
value
:
any
)
=>
{
if
(
globalFilter
)
{
return
value
.
curriculumTitle
.
toLowerCase
().
includes
(
globalFilter
.
toLowerCase
());
...
...
@@ -83,16 +91,96 @@ const List = () => {
_DATA
.
jump
(
p
);
};
useEffect
(()
=>
{
setData
(
userProgress
.
curriculums
)
},
[])
const
[
expanded
,
setExpanded
]
=
useState
<
string
|
false
>
(
'
panel0
'
);
const
handleAccordionChange
=
(
panel
:
string
)
=>
(
event
:
React
.
SyntheticEvent
,
newExpanded
:
boolean
)
=>
{
setExpanded
(
newExpanded
?
panel
:
false
);
};
/**
* API Config
* User Progress API
*/
useEffect
(()
=>
{
if
(
!
user
)
{
// User is missing
dispatch
(
openSnackbar
({
open
:
true
,
message
:
'
User data is missing
'
,
variant
:
'
alert
'
,
alert
:
{
color
:
'
warning
'
,
},
close
:
true
,
})
);
}
else
if
(
!
user
.
id
)
{
// User ID is missing
dispatch
(
openSnackbar
({
open
:
true
,
message
:
'
User ID is missing
'
,
variant
:
'
alert
'
,
alert
:
{
color
:
'
warning
'
,
},
close
:
true
,
})
);
}
else
{
dispatch
(
fetchUserProgress
(
user
.
id
));
}
},
[
dispatch
]);
useEffect
(()
=>
{
if
(
userProgress
)
{
setData
(
userProgress
?.
curriculums
);
}
},
[
userProgress
])
// handel error
useEffect
(()
=>
{
if
(
error
!=
null
)
{
dispatch
(
openSnackbar
({
open
:
true
,
//@ts-ignore
message
:
error
?
error
.
Message
:
"
Something went wrong ...
"
,
variant
:
'
alert
'
,
alert
:
{
color
:
'
error
'
},
close
:
true
})
);
dispatch
(
toInitialState
())
}
},
[
error
])
// handel success
useEffect
(()
=>
{
if
(
success
!=
null
)
{
dispatch
(
openSnackbar
({
open
:
true
,
message
:
success
,
variant
:
'
alert
'
,
alert
:
{
color
:
'
success
'
},
close
:
true
})
);
dispatch
(
toInitialState
())
}
},
[
success
])
if
(
isLoading
)
{
return
<
div
>
Loading...
</
div
>;
}
return
(
<>
<
Box
sx=
{
{
position
:
'
relative
'
,
marginBottom
:
3
}
}
>
...
...
Project/Frontend/SignConnectPlus/src/sections/learning-management/learning-curriculums-subscribed/CurriculumSection.tsx
View file @
69bfdd59
...
...
@@ -84,7 +84,7 @@ const CurriculumSection = ({ curriculum }: { curriculum: curriculumTypeUserProgr
</
MainCard
>
<
MainCard
title=
"Tutorials"
>
<
Grid
container
spacing=
{
2
}
>
{
curriculum
.
tutorials
?.
map
((
tutorial
,
index
)
=>
{
{
curriculum
.
tutorials
&&
curriculum
.
tutorials
?.
map
((
tutorial
,
index
)
=>
{
return
(<
TutorialSection
tutorial=
{
tutorial
!
}
/>)
})
}
</
Grid
>
...
...
Project/Frontend/SignConnectPlus/src/sections/learning-management/learning-curriculums/CurriculumCard.tsx
View file @
69bfdd59
...
...
@@ -52,9 +52,7 @@ const CurriculumCard = ({ curriculum }: { curriculum: curriculumType }) => {
* User Progress API
*/
const
FollowCurriculum
=
()
=>
{
console
.
log
(
user
);
const
FollowCurriculum
=
()
=>
{
if
(
!
user
)
{
// User is missing
dispatch
(
...
...
Project/Frontend/SignConnectPlus/src/store/reducers/userProgress.ts
View file @
69bfdd59
...
...
@@ -50,7 +50,7 @@ const slice = createSlice({
// GET USER_PROGRESS
fetchUserProgressSuccess
(
state
,
action
)
{
state
.
userProgress
=
action
.
payload
;
state
.
userProgress
=
action
.
payload
.
userProgress
;
state
.
success
=
null
},
...
...
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