diff --git a/src/api/getChallengeFullDescription.js b/src/api/getChallengeFullDescription.js new file mode 100644 index 0000000..4463790 --- /dev/null +++ b/src/api/getChallengeFullDescription.js @@ -0,0 +1,11 @@ +import {API} from "../utils/globals"; + +const getChallengeFullDescription = (setState, challengeName) => { + fetch(`${API}/challenge-readme/${challengeName}/markdown`) + .then(response => response.text()) + .then(data => { + setState(data); + }); +} + +export default getChallengeFullDescription; \ No newline at end of file diff --git a/src/components/sections/Readme.js b/src/components/sections/Readme.js index c03fa0b..a0ac61d 100644 --- a/src/components/sections/Readme.js +++ b/src/components/sections/Readme.js @@ -10,8 +10,15 @@ import metricIco from '../../assets/metric_ico.svg'; import coinsIco from '../../assets/coins_ico.svg'; import textIco from '../../assets/text_ico.svg'; import {RENDER_DEADLINE_TIME} from "../../utils/globals"; +import getChallengeFullDescription from "../../api/getChallengeFullDescription"; const Readme = (props) => { + const [fullDescription, setFullDescription] = React.useState(''); + + React.useEffect(() => { + getChallengeFullDescription(setFullDescription, props.challengeName); + }, []); + const mobileRender = () => { return ( @@ -69,7 +76,7 @@ const Readme = (props) => { Description - {props.description} + {fullDescription ? fullDescription : props.description} @@ -95,8 +102,83 @@ const Readme = (props) => { const desktopRender = () => { return ( - <> - + + +

+ Info +

+ + + + + The word-processing challenge + + + + + + Metrics: {props.metric ? props.metric : 'xxx'} + + + + + + Best score: {props.bestScore ? props.bestScore : 'xxx'} + + + + + + Baseline: {props.baseline ? props.baseline : 'xxx'} + + + + + + Deadline: {props.deadline ? RENDER_DEADLINE_TIME(props.deadline) : 'xxx'} + + + + + + Prize: {props.prize ? props.prize : 'xxx'} + + + +
+ +

+ Description +

+ + {fullDescription ? fullDescription : props.description} + +
+ +

+ Baseline +

+ + + In metus ex, venenatis quis risus eget, sodales venenatis nibh. Sed ullamcorper leo non nunc + euismod, id faucibus justo finibus. Nullam malesuada eros quam, eu lobortis leo feugiat non. + + + See notebook  + + here. + + + +
+
); } @@ -106,7 +188,7 @@ const Readme = (props) => { {mobileRender()} - + {desktopRender()} ); diff --git a/src/pages/Challenge.js b/src/pages/Challenge.js index 9616d24..8190d48 100644 --- a/src/pages/Challenge.js +++ b/src/pages/Challenge.js @@ -66,7 +66,7 @@ const Challenge = () => { {challenge.title} - {MINI_DESCRIPTION_RENDER(challenge.description)} + {challenge.description}