@@ -5,6 +5,7 @@ import { MathJax, MathJaxContext } from 'better-react-mathjax';
55import Plot from 'react-plotly.js' ; // Import Plotly component
66import * as TransferFuncVar from './TransferFuncVar.js' ;
77import HomeIcon from "@material-ui/icons/Home" ;
8+ import packagejson from '../../package.json' ;
89
910class TransferFunc extends Component {
1011 constructor ( props ) {
@@ -13,6 +14,7 @@ class TransferFunc extends Component {
1314 A : TransferFuncVar . A ,
1415 B : TransferFuncVar . B ,
1516 C : TransferFuncVar . C ,
17+ version : packagejson . version ,
1618 token : '' ,
1719 errorA : false ,
1820 errorB : false ,
@@ -25,7 +27,7 @@ class TransferFunc extends Component {
2527 // Validation function
2628 validateInputs = ( ) => {
2729 let valid = true ;
28- const { A, B, C, token } = this . state ;
30+ const { A, B, C, token, version } = this . state ;
2931
3032 if ( ! A || isNaN ( A ) ) {
3133 this . setState ( { errorA : true } ) ;
@@ -48,6 +50,13 @@ class TransferFunc extends Component {
4850 this . setState ( { errorC : false } ) ;
4951 }
5052
53+ if ( ! version ) {
54+ this . setState ( { errorVersion : true } ) ;
55+ valid = false ;
56+ } else {
57+ this . setState ( { errorVersion : false } ) ;
58+ }
59+
5160 if ( ! token ) {
5261 this . setState ( { errorToken : true } ) ;
5362 valid = false ;
@@ -154,7 +163,7 @@ export const C = ${C};
154163 } ;
155164
156165 render ( ) {
157- const { A, B, C, token, errorA, errorB, errorC, errorToken, loading } = this . state ;
166+ const { A, B, C, token, version , errorA, errorB, errorC, errorToken, errorVersion , loading } = this . state ;
158167
159168 // Generate FC values and PO values
160169 const FCValues = Array . from ( { length : 1000 } , ( _ , i ) => Math . pow ( 10 , - 3 + ( i * 6 ) / 999 ) ) ; // From 1e-3 to 1e3
@@ -209,6 +218,7 @@ export const C = ${C};
209218 { label : 'Value for B' , value : B , error : errorB , onChange : ( e ) => this . setState ( { B : e . target . value } ) } ,
210219 { label : 'Value for C' , value : C , error : errorC , onChange : ( e ) => this . setState ( { C : e . target . value } ) } ,
211220 { label : 'GitHub Token' , value : token , error : errorToken , type : 'password' , onChange : ( e ) => this . setState ( { token : e . target . value } ) } ,
221+ { label : 'Version' , value : version , error : errorVersion , type : 'text' , onChange : ( e ) => this . setState ( { version : e . target . value } ) }
212222 ] . map ( ( { label, value, error, type = 'number' , onChange } , index ) => (
213223 < TextField
214224 key = { index }
0 commit comments