File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ const Sicp: React.FC = () => {
4444 const [ data , setData ] = useState ( < > </ > ) ;
4545 const [ loading , setLoading ] = useState ( false ) ;
4646 const [ active , setActive ] = useState ( '0' ) ;
47- const { param_lang, section } = useParams < { param_lang :string , section : string } > ( ) ;
47+ const { param_lang, section } = useParams < { param_lang : string ; section : string } > ( ) ;
4848 const [ lang , setLang ] = useState ( readSicpLangLocalStorage ( ) ) ;
4949 const parentRef = useRef < HTMLDivElement > ( null ) ;
5050 const refs = useRef < Record < string , HTMLElement | null > > ( { } ) ;
@@ -96,8 +96,8 @@ const Sicp: React.FC = () => {
9696 React . useEffect ( ( ) => {
9797 const valid_langs = [ 'en' , 'zh_CN' ] ;
9898
99- if ( section && valid_langs . includes ( section ) || param_lang ) {
100- const plang = param_lang ? param_lang : ( section ? section : SICP_DEF_TB_LANG ) ;
99+ if ( ( section && valid_langs . includes ( section ) ) || param_lang ) {
100+ const plang = param_lang ? param_lang : section ? section : SICP_DEF_TB_LANG ;
101101 if ( ! valid_langs . includes ( plang ) ) {
102102 setLang ( SICP_DEF_TB_LANG ) ;
103103 setSicpLangLocalStorage ( SICP_DEF_TB_LANG ) ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ type OwnProps = {
2121 * Table of contents of SICP.
2222 */
2323
24- const Toc : React . FC < { toc : TreeNodeInfo [ ] , props : TocProps } > = ( { toc, props} ) => {
24+ const Toc : React . FC < { toc : TreeNodeInfo [ ] ; props : TocProps } > = ( { toc, props } ) => {
2525 const [ sidebarContent , setSidebarContent ] = useState ( toc ) ;
2626 const navigate = useNavigate ( ) ;
2727
@@ -67,9 +67,9 @@ const SicpToc: React.FC<TocProps> = props => {
6767 React . useEffect ( ( ) => {
6868 const handleLangChange = ( ) => {
6969 setLang ( readSicpLangLocalStorage ( ) ) ;
70- }
70+ } ;
7171 window . addEventListener ( 'sicp-tb-lang-change' , handleLangChange ) ;
72- return ( ) => window . removeEventListener ( 'sicp-tb-lang-change' , handleLangChange )
72+ return ( ) => window . removeEventListener ( 'sicp-tb-lang-change' , handleLangChange ) ;
7373 } , [ ] ) ;
7474
7575 React . useEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments