11import _i18n , { useI18N } from 'src/i18n' ;
22import './RecommendMods.scss' ;
33import { h } from 'preact' ;
4- import { useGamePath , useInstalledMods } from '../states' ;
4+ import { useAutoDisableNewMods , useGamePath , useInstalledMods } from '../states' ;
55import { Mod } from '../components/ModList' ;
66import { Button } from '../components/Button' ;
77import { useState , useEffect } from 'react' ;
@@ -22,13 +22,15 @@ const RMod = ({
2222 installed,
2323 startDownloadHandler,
2424 modsFolder,
25+ autoDisableNewMods,
2526} : {
2627 name : string ;
2728 download_url : string ;
2829 description : string ;
2930 installed ?: boolean ;
3031 startDownloadHandler ?: any ;
3132 modsFolder ?: string ;
33+ autoDisableNewMods : boolean ;
3234} ) => {
3335 const [ state , setState ] = useState (
3436 installed ? _i18n . t ( '已安装' ) : _i18n . t ( '下载' )
@@ -43,6 +45,7 @@ const RMod = ({
4345 if ( ! ! data ) {
4446 const [ gbFileId , version ] = JSON . parse ( data ) ;
4547 ctx . download . downloadMod ( name , parseInt ( gbFileId ) === - 1 ? download_url : gbFileId , {
48+ autoDisableNewMods,
4649 onProgress ( task , progress ) {
4750 setState (
4851 `${ progress } % (${ task . subtasks . filter ( ( v ) => v . state === 'Finished' ) . length
@@ -92,6 +95,7 @@ export const RecommendMods = () => {
9295 const skinMods = _skinMods ( )
9396
9497 const { installedMods } = useInstalledMods ( ) ;
98+ const [ autoDisableNewMods ] = useAutoDisableNewMods ( ) ;
9599 const [ gamePath ] = useGamePath ( ) ;
96100 const modsPath = gamePath + '/Mods' ;
97101 const refDownloadHandlers = useRef (
@@ -138,6 +142,7 @@ export const RecommendMods = () => {
138142 download_url = { mod . download_url }
139143 description = { mod . description }
140144 modsFolder = { modsPath }
145+ autoDisableNewMods = { autoDisableNewMods }
141146 installed = { installedMods . some (
142147 ( m ) => m . name === modNameFromUrl ( mod . download_url )
143148 ) }
@@ -154,6 +159,7 @@ export const RecommendMods = () => {
154159 download_url = { mod . download_url }
155160 description = { mod . description }
156161 modsFolder = { modsPath }
162+ autoDisableNewMods = { autoDisableNewMods }
157163 startDownloadHandler = {
158164 // @ts -ignore
159165 refDownloadHandlers . current [ mod . name ]
0 commit comments