Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
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
edx
edx-platform
Commits
06eeeeec
Commit
06eeeeec
authored
Dec 14, 2017
by
AlasdairSwan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding in React components
parent
1931c1bf
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
88 additions
and
34 deletions
+88
-34
lms/static/js/learner_analytics_dashboard/CircleChartLegend.jsx
+26
-2
lms/static/js/learner_analytics_dashboard/LearnerAnalyticsDashboard.jsx
+52
-0
lms/static/js/learner_analytics_dashboard/index.jsx
+0
-31
openedx/features/learner_analytics/templates/learner_analytics/dashboard.html
+9
-0
webpack.common.config.js
+1
-1
No files found.
lms/static/js/learner_analytics_dashboard/CircleChartLegend.jsx
View file @
06eeeeec
...
@@ -21,14 +21,38 @@ class CircleChartLegend extends React.Component {
...
@@ -21,14 +21,38 @@ class CircleChartLegend extends React.Component {
style=
{
style
}
style=
{
style
}
aria
-
hidden=
"true"
></
div
>
aria
-
hidden=
"true"
></
div
>
<
span
className=
"label"
>
{
label
}
</
span
>
<
span
className=
"label"
>
{
label
}
</
span
>
<
span
className=
"percentage"
>
{
value
}
%
</
span
>
<
span
className=
"percentage"
>
{
this
.
getPercentage
(
value
)
}
</
span
>
</
li
>
</
li
>
);
);
});
});
}
}
getPercentage
(
value
)
{
const
num
=
value
*
100
;
return
`
${
num
}
%`
;
}
renderList
()
{
return
(
<
ul
className=
"legend-list"
>
{
this
.
getList
()
}
</
ul
>
);
}
render
()
{
return
(
<
div
className=
"legend"
>
{
this
.
renderList
()
}
</
div
>
);
}
}
CircleChartLegend
.
propTypes
=
{
CircleChartLegend
.
propTypes
=
{
data
:
PropTypes
.
array
.
isRequired
data
:
PropTypes
.
array
.
isRequired
}
;
}
export
default
CircleChartLegend
;
export
default
CircleChartLegend
;
lms/static/js/learner_analytics_dashboard/LearnerAnalyticsDashboard.jsx
0 → 100644
View file @
06eeeeec
/* global gettext */
import
PropTypes
from
'prop-types'
;
import
React
from
'react'
;
import
ReactDOM
from
'react-dom'
;
import
CircleChart
from
'./CircleChart'
;
import
CircleChartLegend
from
'./CircleChartLegend'
;
export
function
LearnerAnalyticsDashboard
(
props
)
{
console
.
log
(
'props: '
,
props
);
const
data
=
[
{
color
:
'#7ab'
,
value
:
0.15
,
label
:
'Chucky'
},
{
color
:
'#ebb90d'
,
value
:
0.25
,
label
:
'Michael Myers'
},
{
color
:
'hotpink'
,
value
:
0.3
,
label
:
'Freddy Krueger'
},
{
color
:
'#73bde7'
,
value
:
0.3
,
label
:
'Jason Vorhees'
}
];
return
(
<
div
className=
"analytics-group"
>
<
h2
>
Grading
</
h2
>
<
h3
>
Weight
</
h3
>
<
div
className=
"grading-weight-wrapper"
>
<
CircleChart
slices=
{
data
}
centerHole=
{
true
}
sliceBorder=
{
{
strokeColor
:
'#fff'
,
strokeWidth
:
1
}
}
/>
</
div
>
<
CircleChartLegend
data=
{
data
}
/>
</
div
>
);
}
lms/static/js/learner_analytics_dashboard/index.jsx
deleted
100644 → 0
View file @
1931c1bf
/* global gettext */
/* eslint one-var: ["error", "always"] */
/* eslint no-alert: "error" */
import
PropTypes
from
'prop-types'
;
import
React
from
'react'
;
import
ReactDOM
from
'react-dom'
;
class
RenderPage
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
}
render
()
{
return
(
<
div
className=
"my-test-div"
>
<
h2
>
A React App!!!
</
h2
>
</
div
>
);
}
}
export
class
LearnerAnalyticsDashboard
{
constructor
(
context
)
{
ReactDOM
.
render
(
<
RenderPage
context=
{
context
}
/>,
document
.
getElementById
(
'root'
),
);
}
}
openedx/features/learner_analytics/templates/learner_analytics/dashboard.html
View file @
06eeeeec
...
@@ -52,6 +52,15 @@ from openedx.features.course_experience import course_home_page_title
...
@@ -52,6 +52,15 @@ from openedx.features.course_experience import course_home_page_title
</div>
</div>
</header>
</header>
<div
class=
"page-content"
>
<div
class=
"page-content"
>
<div
id=
"root"
class=
"learner-analytics-dashboard"
>
${static.renderReact(
component="LearnerAnalyticsDashboard",
id="react-learner-analytics-dashboard",
props={
'data': 'data'
}
)}
</div>
</div>
</div>
</div>
</div>
</
%
block>
</
%
block>
...
...
webpack.common.config.js
View file @
06eeeeec
...
@@ -25,7 +25,7 @@ module.exports = {
...
@@ -25,7 +25,7 @@ module.exports = {
// LMS
// LMS
SingleSupportForm
:
'./lms/static/support/jsx/single_support_form.jsx'
,
SingleSupportForm
:
'./lms/static/support/jsx/single_support_form.jsx'
,
AlertStatusBar
:
'./lms/static/js/accessible_components/StatusBarAlert.jsx'
,
AlertStatusBar
:
'./lms/static/js/accessible_components/StatusBarAlert.jsx'
,
LearnerAnalyticsDashboard
:
'./lms/static/js/learner_analytics_dashboard/
index
.jsx'
,
LearnerAnalyticsDashboard
:
'./lms/static/js/learner_analytics_dashboard/
LearnerAnalyticsDashboard
.jsx'
,
// Features
// Features
CourseGoals
:
'./openedx/features/course_experience/static/course_experience/js/CourseGoals.js'
,
CourseGoals
:
'./openedx/features/course_experience/static/course_experience/js/CourseGoals.js'
,
...
...
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