Revert "去除是否自动展开配置"

This reverts commit e6db6747
This commit is contained in:
IndieKKY
2024-03-19 21:39:16 +08:00
parent 2383603b39
commit 9b2d620cdf
5 changed files with 20 additions and 18 deletions

View File

@@ -313,7 +313,7 @@ const Body = () => {
{/* onClick={onCopy}>点击复制生成的{SUMMARIZE_TYPES[curSummaryType].name}<RiFileCopy2Line/> */} {/* onClick={onCopy}>点击复制生成的{SUMMARIZE_TYPES[curSummaryType].name}<RiFileCopy2Line/> */}
{/* </button>} */} {/* </button>} */}
{/* </div> */} {/* </div> */}
{((infos == null) || infos.length === 0) && <div className='flex flex-col'> <div className='flex flex-col'>
<div className='flex flex-col items-center text-center py-2 mx-4'> <div className='flex flex-col items-center text-center py-2 mx-4'>
<div className='font-semibold text-accent flex items-center gap-1'><img src='/bibigpt.png' <div className='font-semibold text-accent flex items-center gap-1'><img src='/bibigpt.png'
alt='BibiGPT logo' alt='BibiGPT logo'
@@ -349,7 +349,8 @@ const Body = () => {
e.preventDefault() e.preventDefault()
openUrl('https://microsoftedge.microsoft.com/addons/detail/galeejdehabppfgooagmkclpppnbccpc') openUrl('https://microsoftedge.microsoft.com/addons/detail/galeejdehabppfgooagmkclpppnbccpc')
}} className='link text-sm text-accent'>Edge商店</a> }} className='link text-sm text-accent'>Edge商店</a>
<a title='Crx搜搜(国内可访问)' href='https://www.crxsoso.com/webstore/detail/fiaeclpicddpifeflpmlgmbjgaedladf' <a title='Crx搜搜(国内可访问)'
href='https://www.crxsoso.com/webstore/detail/fiaeclpicddpifeflpmlgmbjgaedladf'
onClick={(e) => { onClick={(e) => {
e.preventDefault() e.preventDefault()
openUrl('https://www.crxsoso.com/webstore/detail/fiaeclpicddpifeflpmlgmbjgaedladf') openUrl('https://www.crxsoso.com/webstore/detail/fiaeclpicddpifeflpmlgmbjgaedladf')
@@ -376,7 +377,7 @@ const Body = () => {
}} className='link text-sm text-accent'>Crx搜搜(访)</a> }} className='link text-sm text-accent'>Crx搜搜(访)</a>
</div> </div>
</div> </div>
</div>} </div>
</div> </div>
{/* recommend */} {/* recommend */}
@@ -417,7 +418,8 @@ const Body = () => {
}}><img src='/openai-up.ico' }}><img src='/openai-up.ico'
alt='Openai Up logo' alt='Openai Up logo'
className='w-8 h-8'/>Openai代理</a> className='w-8 h-8'/>Openai代理</a>
<span className='text-sm desc flex items-center'>6<FaGripfire className='text-amber-600'/></span> <span className='text-sm desc flex items-center'>6<FaGripfire
className='text-amber-600'/></span>
</div>} </div>}
</div> </div>
</div> </div>

View File

@@ -56,7 +56,7 @@ const FormItem = (props: {
const Settings = () => { const Settings = () => {
const dispatch = useAppDispatch() const dispatch = useAppDispatch()
const envData = useAppSelector(state => state.env.envData) const envData = useAppSelector(state => state.env.envData)
// const {value: autoExpandValue, onChange: setAutoExpandValue} = useEventChecked(envData.autoExpand) const {value: autoExpandValue, onChange: setAutoExpandValue} = useEventChecked(envData.autoExpand)
// const {value: autoScrollValue, onChange: setAutoScrollValue} = useEventChecked(envData.autoScroll) // const {value: autoScrollValue, onChange: setAutoScrollValue} = useEventChecked(envData.autoScroll)
const {value: translateEnableValue, onChange: setTranslateEnableValue} = useEventChecked(envData.translateEnable) const {value: translateEnableValue, onChange: setTranslateEnableValue} = useEventChecked(envData.translateEnable)
const {value: summarizeEnableValue, onChange: setSummarizeEnableValue} = useEventChecked(envData.summarizeEnable) const {value: summarizeEnableValue, onChange: setSummarizeEnableValue} = useEventChecked(envData.summarizeEnable)
@@ -109,7 +109,7 @@ const Settings = () => {
const onSave = useCallback(() => { const onSave = useCallback(() => {
dispatch(setEnvData({ dispatch(setEnvData({
// autoExpand: autoExpandValue, autoExpand: autoExpandValue,
aiType: aiTypeValue, aiType: aiTypeValue,
apiKey: apiKeyValue, apiKey: apiKeyValue,
serverUrl: serverUrlValue, serverUrl: serverUrlValue,
@@ -133,7 +133,7 @@ const Settings = () => {
})) }))
dispatch(setPage(PAGE_MAIN)) dispatch(setPage(PAGE_MAIN))
toast.success('保存成功') toast.success('保存成功')
}, [dispatch, aiTypeValue, apiKeyValue, serverUrlValue, modelValue, geminiApiKeyValue, translateEnableValue, languageValue, hideOnDisableAutoTranslateValue, themeValue, transDisplayValue, summarizeEnableValue, summarizeFloatValue, summarizeLanguageValue, wordsValue, fetchAmountValue, fontSizeValue, promptsValue, searchEnabledValue, cnSearchEnabledValue, askEnabledValue]) }, [dispatch, autoExpandValue, aiTypeValue, apiKeyValue, serverUrlValue, modelValue, geminiApiKeyValue, translateEnableValue, languageValue, hideOnDisableAutoTranslateValue, themeValue, transDisplayValue, summarizeEnableValue, summarizeFloatValue, summarizeLanguageValue, wordsValue, fetchAmountValue, fontSizeValue, promptsValue, searchEnabledValue, cnSearchEnabledValue, askEnabledValue])
const onCancel = useCallback(() => { const onCancel = useCallback(() => {
dispatch(setPage(PAGE_MAIN)) dispatch(setPage(PAGE_MAIN))
@@ -192,10 +192,10 @@ const Settings = () => {
}}> }}>
<div className="flex flex-col gap-3 p-2"> <div className="flex flex-col gap-3 p-2">
<Section title='通用配置'> <Section title='通用配置'>
{/* <FormItem title='自动展开' htmlFor='autoExpand' tip='是否视频有字幕时自动展开字幕列表'> */} <FormItem title='自动展开' htmlFor='autoExpand' tip='是否视频有字幕时自动展开字幕列表'>
{/* <input id='autoExpand' type='checkbox' className='toggle toggle-primary' checked={autoExpandValue} */} <input id='autoExpand' type='checkbox' className='toggle toggle-primary' checked={autoExpandValue}
{/* onChange={setAutoExpandValue}/> */} onChange={setAutoExpandValue}/>
{/* </FormItem> */} </FormItem>
<FormItem title='主题'> <FormItem title='主题'>
<div className="btn-group"> <div className="btn-group">
<button onClick={onSelTheme1} className={classNames('btn btn-xs no-animation', (!themeValue || themeValue === 'system')?'btn-active':'')}></button> <button onClick={onSelTheme1} className={classNames('btn btn-xs no-animation', (!themeValue || themeValue === 'system')?'btn-active':'')}></button>

View File

@@ -100,20 +100,20 @@ const useSubtitleService = () => {
// 有数据时自动展开 // 有数据时自动展开
useEffect(() => { useEffect(() => {
if (infos != null) { if ((data != null) && data.body.length > 0) {
eventBus.emit({ eventBus.emit({
type: EVENT_EXPAND type: EVENT_EXPAND
}) })
} }
}, [eventBus, infos]) }, [data, eventBus, infos])
// 当前未展示 & 未折叠 & 有列表 => 展示第一个 // 当前未展示 & (未折叠 | 自动展开) & 有列表 => 展示第一个
useEffect(() => { useEffect(() => {
if (!curInfo && !fold && (infos != null) && infos.length > 0) { if (!curInfo && (!fold || (envReady && envData.autoExpand)) && (infos != null) && infos.length > 0) {
dispatch(setCurInfo(infos[0])) dispatch(setCurInfo(infos[0]))
dispatch(setCurFetched(false)) dispatch(setCurFetched(false))
} }
}, [curInfo, dispatch, envReady, fold, infos]) }, [curInfo, dispatch, envData.autoExpand, envReady, fold, infos])
// 获取 // 获取
useEffect(() => { useEffect(() => {
if (curInfo && !curFetched) { if (curInfo && !curFetched) {

View File

@@ -54,7 +54,7 @@ const initialState: EnvState = {
serverUrl: SERVER_URL_OPENAI, serverUrl: SERVER_URL_OPENAI,
translateEnable: true, translateEnable: true,
summarizeEnable: true, summarizeEnable: true,
// autoExpand: true, autoExpand: true,
theme: 'light', theme: 'light',
searchEnabled: true, searchEnabled: true,
}, },

2
src/typings.d.ts vendored
View File

@@ -1,5 +1,5 @@
interface EnvData { interface EnvData {
// autoExpand?: boolean autoExpand?: boolean
flagDot?: boolean flagDot?: boolean
aiType?: 'openai' | 'gemini' aiType?: 'openai' | 'gemini'