-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1597 from clpetersonucf/issue/1590-improve-pre-em…
…bed-view Improves widget pre-embed views
- Loading branch information
Showing
8 changed files
with
128 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
|
||
span.subtitle { | ||
font-size: .7em; | ||
font-weight: 300; | ||
font-weight: 400; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,56 @@ | ||
import React, { useState, useEffect} from 'react' | ||
import Summary from './widget-summary' | ||
import Header from './header' | ||
import EmbedFooter from './widget-embed-footer' | ||
|
||
const NoAttempts = () => { | ||
const [attempts, setAttempts] = useState(null) | ||
const [scoresPath, setScoresPath] = useState(null) | ||
const [attempts, setAttempts] = useState(null) | ||
const [scoresPath, setScoresPath] = useState(null) | ||
|
||
useEffect(() => { | ||
waitForWindow().then(() => { | ||
const scoresPath = `/scores${window.IS_EMBEDDED ? '/embed' : ''}/${window.WIDGET_ID}`; | ||
useEffect(() => { | ||
waitForWindow().then(() => { | ||
const scoresPath = `/scores${window.IS_EMBEDDED ? '/embed' : ''}/${window.WIDGET_ID}`; | ||
|
||
setScoresPath(scoresPath); | ||
setAttempts(window.ATTEMPTS) | ||
}) | ||
}, []) | ||
setScoresPath(scoresPath); | ||
setAttempts(window.ATTEMPTS) | ||
}) | ||
}, []) | ||
|
||
const waitForWindow = async () => { | ||
const waitForWindow = async () => { | ||
while(!window.hasOwnProperty('WIDGET_ID') | ||
&& !window.hasOwnProperty('IS_EMBEDDED') | ||
&& !window.hasOwnProperty('ATTEMPTS')) { | ||
await new Promise(resolve => setTimeout(resolve, 500)) | ||
} | ||
} | ||
|
||
let bodyRender = null | ||
if (!!attempts) { | ||
bodyRender = ( | ||
<div className={"container widget"}> | ||
<section className="attempts page"> | ||
<Summary/> | ||
|
||
<div className="detail icon-offset"> | ||
<h2 className="unavailable-text">No remaining attempts</h2> | ||
<span className="unavailable-subtext">You've used all { attempts } available attempts.</span> | ||
<p> | ||
<a href={ scoresPath }>Review previous scores</a> | ||
</p> | ||
</div> | ||
</section> | ||
</div> | ||
) | ||
} | ||
|
||
return ( | ||
<> | ||
<Header /> | ||
{ bodyRender } | ||
</> | ||
) | ||
let bodyRender = null | ||
if (!!attempts) { | ||
bodyRender = ( | ||
<div className={"container widget"}> | ||
<section className="attempts page"> | ||
<Summary/> | ||
|
||
<div className="detail icon-offset"> | ||
<h2 className="unavailable-text">No remaining attempts</h2> | ||
<span className="unavailable-subtext">You've used all { attempts } available attempts.</span> | ||
<p> | ||
<a href={ scoresPath }>Review previous scores</a> | ||
</p> | ||
</div> | ||
|
||
<EmbedFooter/> | ||
</section> | ||
</div> | ||
) | ||
} | ||
|
||
return ( | ||
<> | ||
<Header /> | ||
{ bodyRender } | ||
</> | ||
) | ||
} | ||
|
||
export default NoAttempts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react' | ||
|
||
const EmbedFooter = () => { | ||
|
||
return ( | ||
<section className='widget-embed-footer'> | ||
<a className="materia-logo" href={window.BASE_URL} target="_blank"><img src="/img/materia-logo-thin.svg" alt="materia logo" /></a> | ||
<span> | ||
Content embedded from Materia. Need a hand? View <a className='inline-link' href={`${window.BASE_URL}/help#students`} target='_blank'>support options</a>. | ||
</span> | ||
</section> | ||
) | ||
} | ||
|
||
export default EmbedFooter |