去除是否自动展开配置

This commit is contained in:
IndieKKY
2024-03-18 19:14:24 +08:00
parent 72c8f9608e
commit e6db674755
5 changed files with 16 additions and 16 deletions

View File

@@ -368,10 +368,10 @@ const Body = () => {
</div> </div>
{/* recommend */} {/* recommend */}
<div className='' style={{ <div className='p-0.5' style={{
height: `${RECOMMEND_HEIGHT}px` height: `${RECOMMEND_HEIGHT}px`
}}> }}>
{recommendIdx === 0 && <div className='flex items-center gap-1 rounded shadow-sm bg-base-200/10 m-0.5'> {recommendIdx === 0 && <div className='flex items-center gap-1 rounded shadow-sm bg-base-200/10'>
<a className='link link-accent link-hover font-semibold text-sm flex items-center' onClick={(e) => { <a className='link link-accent link-hover font-semibold text-sm flex items-center' onClick={(e) => {
e.preventDefault() e.preventDefault()
openUrl('https://bibigpt.co/r/bilibili') openUrl('https://bibigpt.co/r/bilibili')
@@ -380,7 +380,7 @@ const Body = () => {
className='w-8 h-8'/> BibiGPT </a> className='w-8 h-8'/> BibiGPT </a>
<span className='text-sm desc'></span> <span className='text-sm desc'></span>
</div>} </div>}
{recommendIdx === 1 && <div className='flex items-center gap-1 rounded shadow-sm bg-base-200/10 m-1'> {recommendIdx === 1 && <div className='flex items-center gap-1 rounded shadow-sm bg-base-200/10'>
<a className='link link-accent link-hover font-semibold text-sm flex items-center' onClick={(e) => { <a className='link link-accent link-hover font-semibold text-sm flex items-center' onClick={(e) => {
e.preventDefault() e.preventDefault()
openUrl('https://chromewebstore.google.com/detail/fiaeclpicddpifeflpmlgmbjgaedladf') openUrl('https://chromewebstore.google.com/detail/fiaeclpicddpifeflpmlgmbjgaedladf')
@@ -389,7 +389,7 @@ const Body = () => {
className='w-8 h-8'/>YouTube Caption</a> className='w-8 h-8'/>YouTube Caption</a>
<span className='text-sm desc'>YouTube版的字幕列表</span> <span className='text-sm desc'>YouTube版的字幕列表</span>
</div>} </div>}
{recommendIdx === 2 && <div className='flex items-center gap-1 rounded shadow-sm bg-base-200/10 m-1'> {recommendIdx === 2 && <div className='flex items-center gap-1 rounded shadow-sm bg-base-200/10'>
<a className='link link-accent link-hover font-semibold text-sm flex items-center' onClick={(e) => { <a className='link link-accent link-hover font-semibold text-sm flex items-center' onClick={(e) => {
e.preventDefault() e.preventDefault()
openUrl('https://chromewebstore.google.com/detail/mcijpllinkhflgpkggimnafkbmpiijah') openUrl('https://chromewebstore.google.com/detail/mcijpllinkhflgpkggimnafkbmpiijah')

View File

@@ -57,7 +57,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)
@@ -110,7 +110,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,
@@ -134,7 +134,7 @@ const Settings = () => {
})) }))
dispatch(setPage(PAGE_MAIN)) dispatch(setPage(PAGE_MAIN))
toast.success('保存成功') toast.success('保存成功')
}, [dispatch, autoExpandValue, aiTypeValue, apiKeyValue, serverUrlValue, modelValue, geminiApiKeyValue, translateEnableValue, languageValue, hideOnDisableAutoTranslateValue, themeValue, transDisplayValue, summarizeEnableValue, summarizeFloatValue, summarizeLanguageValue, wordsValue, fetchAmountValue, fontSizeValue, promptsValue, searchEnabledValue, cnSearchEnabledValue, askEnabledValue]) }, [dispatch, 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))
@@ -193,10 +193,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

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

View File

@@ -53,7 +53,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'