Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scientia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zhige Yu
scientia
Commits
8cb63bdd
Commit
8cb63bdd
authored
4 years ago
by
danieldeng2
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into 3-css-grid-timeline
parents
68355bbd
90dc5def
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/pages/ModuleDashboard/index.tsx
+17
-7
17 additions, 7 deletions
src/components/pages/ModuleDashboard/index.tsx
src/components/pages/ModuleResources/index.tsx
+9
-9
9 additions, 9 deletions
src/components/pages/ModuleResources/index.tsx
with
26 additions
and
16 deletions
src/components/pages/ModuleDashboard/index.tsx
+
17
−
7
View file @
8cb63bdd
...
@@ -5,6 +5,7 @@ import styles from "./style.module.scss";
...
@@ -5,6 +5,7 @@ import styles from "./style.module.scss";
import
classNames
from
"
classnames
"
;
import
classNames
from
"
classnames
"
;
import
{
faGlobe
,
faLink
}
from
"
@fortawesome/free-solid-svg-icons
"
;
import
{
faGlobe
,
faLink
}
from
"
@fortawesome/free-solid-svg-icons
"
;
import
PageButtonGroup
from
"
components/molecules/PageButtonGroup
"
;
import
PageButtonGroup
from
"
components/molecules/PageButtonGroup
"
;
import
queryString
from
"
query-string
"
;
import
{
request
}
from
"
../../../utils/api
"
;
import
{
request
}
from
"
../../../utils/api
"
;
import
{
api
,
methods
}
from
"
../../../constants/routes
"
;
import
{
api
,
methods
}
from
"
../../../constants/routes
"
;
...
@@ -33,13 +34,19 @@ const ModuleDashboard: React.FC = () => {
...
@@ -33,13 +34,19 @@ const ModuleDashboard: React.FC = () => {
data
.
json
().
then
((
json
)
=>
{
data
.
json
().
then
((
json
)
=>
{
for
(
const
key
in
json
)
{
for
(
const
key
in
json
)
{
let
resource
=
json
[
key
];
let
resource
=
json
[
key
];
if
(
resource
.
type
!==
"
link
"
)
continue
;
let
resource
URL
=
queryString
.
parseUrl
(
resource
.
path
)
;
newButtons
.
push
({
if
(
title
:
resource
.
title
,
resource
.
type
===
"
link
"
&&
icon
:
faLink
,
resourceURL
.
url
!==
url
:
resource
.
path
,
"
https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx
"
});
)
{
newButtons
.
push
({
title
:
resource
.
title
,
icon
:
faLink
,
url
:
resource
.
path
,
});
}
}
}
setButtons
((
b
)
=>
b
.
concat
(
newButtons
));
setButtons
((
b
)
=>
b
.
concat
(
newButtons
));
});
});
...
@@ -63,7 +70,10 @@ const ModuleDashboard: React.FC = () => {
...
@@ -63,7 +70,10 @@ const ModuleDashboard: React.FC = () => {
<
Dandruff
heading
=
{
generateHeading
(
id
)
}
/>
<
Dandruff
heading
=
{
generateHeading
(
id
)
}
/>
<
h4
className
=
{
classNames
(
styles
.
moduleSectionHeader
)
}
>
Module Aims
</
h4
>
<
h4
className
=
{
classNames
(
styles
.
moduleSectionHeader
)
}
>
Module Aims
</
h4
>
<
div
className
=
{
styles
.
moduleDashboardText
}
style
=
{
{
paddingTop
:
"
0.75rem
"
}
}
>
<
div
className
=
{
styles
.
moduleDashboardText
}
style
=
{
{
paddingTop
:
"
0.75rem
"
}
}
>
<
span
>
In this module you will have the opportunity to:
</
span
>
<
span
>
In this module you will have the opportunity to:
</
span
>
<
ul
>
<
ul
>
<
li
>
<
li
>
...
...
This diff is collapsed.
Click to expand it.
src/components/pages/ModuleResources/index.tsx
+
9
−
9
View file @
8cb63bdd
...
@@ -58,16 +58,17 @@ class ModuleResources extends React.Component<ResourcesProps, ResourceState> {
...
@@ -58,16 +58,17 @@ class ModuleResources extends React.Component<ResourcesProps, ResourceState> {
let
resourceURL
=
queryString
.
parseUrl
(
resource
.
path
);
let
resourceURL
=
queryString
.
parseUrl
(
resource
.
path
);
let
thumbnail
=
undefined
;
let
thumbnail
=
undefined
;
let
altType
=
undefined
;
if
(
if
(
resource
.
type
===
"
video
"
&&
resourceURL
.
url
===
resourceURL
.
url
===
"
https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx
"
"
https://imperial.cloud.panopto.eu/Panopto/Pages/Viewer.aspx
"
)
{
)
{
altType
=
"
video
"
;
thumbnail
=
`https://imperial.cloud.panopto.eu/Panopto/Services/FrameGrabber.svc/FrameRedirect?objectId=
${
resourceURL
.
query
.
id
}
&mode=Delivery`
;
thumbnail
=
`https://imperial.cloud.panopto.eu/Panopto/Services/FrameGrabber.svc/FrameRedirect?objectId=
${
resourceURL
.
query
.
id
}
&mode=Delivery`
;
}
}
resourceArr
.
push
({
resourceArr
.
push
({
title
:
resource
.
title
,
title
:
resource
.
title
,
type
:
resource
.
type
,
type
:
altType
||
resource
.
type
,
tags
:
resource
.
tags
,
tags
:
resource
.
tags
,
folder
:
resource
.
category
.
toLowerCase
(),
folder
:
resource
.
category
.
toLowerCase
(),
thumbnail
:
thumbnail
,
thumbnail
:
thumbnail
,
...
@@ -79,12 +80,11 @@ class ModuleResources extends React.Component<ResourcesProps, ResourceState> {
...
@@ -79,12 +80,11 @@ class ModuleResources extends React.Component<ResourcesProps, ResourceState> {
});
});
};
};
const
onFailure
=
(
error
:
{
text
:
()
=>
Promise
<
any
>
})
=>
{
const
onFailure
=
(
error
:
{
text
:
()
=>
Promise
<
any
>
})
=>
{
if
(
error
.
text
){
if
(
error
.
text
)
{
error
.
text
().
then
((
errorText
)
=>
{
error
.
text
().
then
((
errorText
)
=>
{
this
.
setState
({
error
:
errorText
,
isLoaded
:
true
});
this
.
setState
({
error
:
errorText
,
isLoaded
:
true
});
});
});
}
}
};
};
request
(
api
.
MATERIALS_RESOURCES
,
methods
.
GET
,
onSuccess
,
onFailure
,
{
request
(
api
.
MATERIALS_RESOURCES
,
methods
.
GET
,
onSuccess
,
onFailure
,
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment