File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
client/modules/IDE/components Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change 1
- import React , { useEffect , useState } from 'react' ;
1
+ import React from 'react' ;
2
+ import { useSelector } from 'react-redux' ;
2
3
import { Helmet } from 'react-helmet' ;
3
- import axios from 'axios' ;
4
4
import { useTranslation } from 'react-i18next' ;
5
5
import { Link } from 'react-router' ;
6
6
import SquareLogoIcon from '../../../images/p5js-square-logo.svg' ;
@@ -10,12 +10,10 @@ import packageData from '../../../../package.json';
10
10
11
11
function About ( props ) {
12
12
const { t } = useTranslation ( ) ;
13
- const [ p5version , setP5version ] = useState ( 0 ) ;
14
- useEffect ( ( ) => {
15
- axios
16
- . get ( 'https://cdn.jsdelivr.net/npm/p5/package.json' )
17
- . then ( ( data ) => setP5version ( data ?. data ?. version ) ) ;
18
- } , [ ] ) ;
13
+ const p5version = useSelector ( ( state ) => {
14
+ const index = state . files . find ( ( file ) => file . name === 'index.html' ) ;
15
+ return index ?. content . match ( / \/ p 5 \. j s \/ ( [ \d . ] + ) \/ / ) ?. [ 1 ] ;
16
+ } ) ;
19
17
return (
20
18
< div className = "about__content" >
21
19
< Helmet >
You can’t perform that action at this time.
0 commit comments