From d52231227e9e911a982ede83bf3a3925f4d0485a Mon Sep 17 00:00:00 2001 From: IndieKKY Date: Sat, 5 Oct 2024 20:03:02 +0800 Subject: [PATCH] fix --- src/App.tsx | 2 +- src/Router.tsx | 1 + src/chrome/background.ts | 2 +- src/chrome/openaiService.ts | 2 +- src/chrome/taskService.ts | 2 +- src/{biz => components}/Ask.tsx | 0 src/{biz => components}/Body.tsx | 2 +- src/{biz => components}/CompactSegmentItem.tsx | 2 +- src/{biz => components}/Header.tsx | 2 +- src/{biz => components}/MoreBtn.tsx | 6 +++--- src/{biz => components}/NormalSegmentItem.tsx | 4 ++-- src/components/RateExtension.tsx | 2 +- src/{biz => components}/SegmentCard.tsx | 6 +++--- src/{biz => components}/SegmentItem.tsx | 0 src/{ => consts}/const.ts | 0 src/hooks/useMessagingService.ts | 2 +- src/hooks/useSearchService.ts | 2 +- src/hooks/useSubtitle.ts | 2 +- src/hooks/useSubtitleService.ts | 6 +++--- src/hooks/useTranslate.ts | 6 +++--- src/inject/inject.ts | 4 ++-- src/main.tsx | 2 +- src/messaging/ExtensionMessage.ts | 2 +- src/messaging/InjectMessage.ts | 3 +-- src/messaging/useMessage.ts | 2 +- src/messaging/useMessageService.ts | 7 ++----- src/pages/MainPage.tsx | 16 ++++++---------- src/pages/OptionsPage.tsx | 4 ++-- src/redux/envReducer.ts | 2 +- src/{util => utils}/biz_util.ts | 2 +- src/{util => utils}/pinyin_util.ts | 0 src/{util => utils}/search.ts | 0 src/{util => utils}/util.ts | 0 33 files changed, 44 insertions(+), 51 deletions(-) rename src/{biz => components}/Ask.tsx (100%) rename src/{biz => components}/Body.tsx (99%) rename src/{biz => components}/CompactSegmentItem.tsx (96%) rename src/{biz => components}/Header.tsx (98%) rename src/{biz => components}/MoreBtn.tsx (98%) rename src/{biz => components}/NormalSegmentItem.tsx (93%) rename src/{biz => components}/SegmentCard.tsx (99%) rename src/{biz => components}/SegmentItem.tsx (100%) rename src/{ => consts}/const.ts (100%) rename src/{util => utils}/biz_util.ts (99%) rename src/{util => utils}/pinyin_util.ts (100%) rename src/{util => utils}/search.ts (100%) rename src/{util => utils}/util.ts (100%) diff --git a/src/App.tsx b/src/App.tsx index 724cbb7..ae9546d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,7 +3,7 @@ import 'tippy.js/dist/tippy.css' import {useAppDispatch, useAppSelector} from './hooks/redux' import {setEnvData, setEnvReady, setTempData, setTempReady} from './redux/envReducer' import {cloneDeep} from 'lodash-es' -import {STORAGE_ENV, STORAGE_TEMP} from './const' +import {STORAGE_ENV, STORAGE_TEMP} from './consts/const' import OptionsPage from './pages/OptionsPage' import {handleJson} from '@kky002/kky-util' import {useLocalStorage} from '@kky002/kky-hooks' diff --git a/src/Router.tsx b/src/Router.tsx index 0fbc608..f4e1564 100644 --- a/src/Router.tsx +++ b/src/Router.tsx @@ -8,6 +8,7 @@ export const EventBusContext = React.createContext(null) const map: { [key: string]: string } = { '/options.html': 'options', + '/sidepanel.html': 'app', // '/close': 'close', } diff --git a/src/chrome/background.ts b/src/chrome/background.ts index 8a0cba9..313af26 100644 --- a/src/chrome/background.ts +++ b/src/chrome/background.ts @@ -1,6 +1,6 @@ import {v4} from 'uuid' import {handleTask, initTaskService, tasksMap} from './taskService' -import {MESSAGE_TARGET_INJECT, MESSAGE_TO_EXTENSION_ADD_TASK, MESSAGE_TO_EXTENSION_GET_TASK, MESSAGE_TO_EXTENSION_SHOW_FLAG, MESSAGE_TO_INJECT_TOGGLE_DISPLAY, STORAGE_ENV} from '@/const' +import {MESSAGE_TARGET_INJECT, MESSAGE_TO_EXTENSION_ADD_TASK, MESSAGE_TO_EXTENSION_GET_TASK, MESSAGE_TO_EXTENSION_SHOW_FLAG, MESSAGE_TO_INJECT_TOGGLE_DISPLAY, STORAGE_ENV} from '@/consts/const' import ExtensionMessage from '@/messaging/ExtensionMessage' const setBadgeOk = async (tabId: number, ok: boolean) => { diff --git a/src/chrome/openaiService.ts b/src/chrome/openaiService.ts index ae98d47..84c0233 100644 --- a/src/chrome/openaiService.ts +++ b/src/chrome/openaiService.ts @@ -1,4 +1,4 @@ -import {DEFAULT_SERVER_URL_OPENAI} from '../const' +import {DEFAULT_SERVER_URL_OPENAI} from '../consts/const' const getServerUrl = (serverUrl?: string) => { if (!serverUrl) { diff --git a/src/chrome/taskService.ts b/src/chrome/taskService.ts index beb14f0..5c040ba 100644 --- a/src/chrome/taskService.ts +++ b/src/chrome/taskService.ts @@ -1,4 +1,4 @@ -import {TASK_EXPIRE_TIME} from '../const' +import {TASK_EXPIRE_TIME} from '../consts/const' import {handleChatCompleteTask, handleGeminiChatCompleteTask} from './openaiService' export const tasksMap = new Map() diff --git a/src/biz/Ask.tsx b/src/components/Ask.tsx similarity index 100% rename from src/biz/Ask.tsx rename to src/components/Ask.tsx diff --git a/src/biz/Body.tsx b/src/components/Body.tsx similarity index 99% rename from src/biz/Body.tsx rename to src/components/Body.tsx index b1208e8..3e98c46 100644 --- a/src/biz/Body.tsx +++ b/src/components/Body.tsx @@ -30,7 +30,7 @@ import { SEARCH_BAR_HEIGHT, SUMMARIZE_ALL_THRESHOLD, TITLE_HEIGHT -} from '../const' +} from '../consts/const' import {FaClipboardList} from 'react-icons/fa' import useTranslate from '../hooks/useTranslate' import {openUrl} from '@kky002/kky-util' diff --git a/src/biz/CompactSegmentItem.tsx b/src/components/CompactSegmentItem.tsx similarity index 96% rename from src/biz/CompactSegmentItem.tsx rename to src/components/CompactSegmentItem.tsx index 6457e49..ea0ff3c 100644 --- a/src/biz/CompactSegmentItem.tsx +++ b/src/components/CompactSegmentItem.tsx @@ -1,6 +1,6 @@ import React, {useMemo} from 'react' import {useAppSelector} from '../hooks/redux' -import {getDisplay, getTransText} from '../util/biz_util' +import {getDisplay, getTransText} from '../utils/biz_util' import classNames from 'classnames' const CompactSegmentItem = (props: { diff --git a/src/biz/Header.tsx b/src/components/Header.tsx similarity index 98% rename from src/biz/Header.tsx rename to src/components/Header.tsx index ff3d3f8..7c4dbe1 100644 --- a/src/biz/Header.tsx +++ b/src/components/Header.tsx @@ -5,7 +5,7 @@ import {find, remove} from 'lodash-es' import {setCurFetched, setCurInfo, setData, setInfos, setUploadedTranscript} from '../redux/envReducer' import MoreBtn from './MoreBtn' import classNames from 'classnames' -import {parseTranscript} from '../util/biz_util' +import {parseTranscript} from '../utils/biz_util' const Header = (props: { foldCallback: () => void diff --git a/src/biz/MoreBtn.tsx b/src/components/MoreBtn.tsx similarity index 98% rename from src/biz/MoreBtn.tsx rename to src/components/MoreBtn.tsx index 04751dd..9873310 100644 --- a/src/biz/MoreBtn.tsx +++ b/src/components/MoreBtn.tsx @@ -13,11 +13,11 @@ import {Placement} from '@popperjs/core/lib/enums' import {useAppDispatch, useAppSelector} from '../hooks/redux' import {setEnvData, setTempData} from '../redux/envReducer' import {EventBusContext} from '../Router' -import {EVENT_EXPAND, MESSAGE_TO_INJECT_DOWNLOAD_AUDIO} from '../const' -import {formatSrtTime, formatTime, formatVttTime} from '../util/util' +import {EVENT_EXPAND, MESSAGE_TO_INJECT_DOWNLOAD_AUDIO} from '../consts/const' +import {formatSrtTime, formatTime, formatVttTime} from '../utils/util' import {downloadText, openUrl} from '@kky002/kky-util' import toast from 'react-hot-toast' -import {getSummarize} from '../util/biz_util' +import {getSummarize} from '../utils/biz_util' import useMessage from '../messaging/useMessage' interface Props { placement: Placement diff --git a/src/biz/NormalSegmentItem.tsx b/src/components/NormalSegmentItem.tsx similarity index 93% rename from src/biz/NormalSegmentItem.tsx rename to src/components/NormalSegmentItem.tsx index 4f3b72d..3dd0fa5 100644 --- a/src/biz/NormalSegmentItem.tsx +++ b/src/components/NormalSegmentItem.tsx @@ -1,7 +1,7 @@ import React, {useMemo} from 'react' -import {formatTime} from '../util/util' +import {formatTime} from '../utils/util' import {useAppSelector} from '../hooks/redux' -import {getDisplay, getTransText} from '../util/biz_util' +import {getDisplay, getTransText} from '../utils/biz_util' import classNames from 'classnames' const NormalSegmentItem = (props: { diff --git a/src/components/RateExtension.tsx b/src/components/RateExtension.tsx index 7c82fb2..dcb4bb8 100644 --- a/src/components/RateExtension.tsx +++ b/src/components/RateExtension.tsx @@ -4,7 +4,7 @@ import { IoMdClose } from 'react-icons/io'; import { setTempData } from '../redux/envReducer'; import { useAppDispatch, useAppSelector } from '../hooks/redux'; import { openUrl } from '@kky002/kky-util'; -import { isEdgeBrowser } from '../util/util'; +import { isEdgeBrowser } from '../utils/util'; const RateExtension: React.FC = () => { const dispatch = useAppDispatch() diff --git a/src/biz/SegmentCard.tsx b/src/components/SegmentCard.tsx similarity index 99% rename from src/biz/SegmentCard.tsx rename to src/components/SegmentCard.tsx index 65edf1a..9201f17 100644 --- a/src/biz/SegmentCard.tsx +++ b/src/components/SegmentCard.tsx @@ -3,14 +3,14 @@ import {useAppDispatch, useAppSelector} from '../hooks/redux' import {setFloatKeyPointsSegIdx, setSegmentFold, setTempData} from '../redux/envReducer' import classNames from 'classnames' import {FaClipboardList} from 'react-icons/fa' -import {PAGE_MAIN, PAGE_SETTINGS, SUMMARIZE_THRESHOLD, SUMMARIZE_TYPES} from '../const' +import {PAGE_MAIN, PAGE_SETTINGS, SUMMARIZE_THRESHOLD, SUMMARIZE_TYPES} from '../consts/const' import useTranslate from '../hooks/useTranslate' import {BsDashSquare, BsPlusSquare, CgFileDocument, FaQuestion, GrOverview, RiFileCopy2Line} from 'react-icons/all' import toast from 'react-hot-toast' -import {getLastTime, getSummaryStr, isSummaryEmpty, parseStrTimeToSeconds} from '../util/biz_util' +import {getLastTime, getSummaryStr, isSummaryEmpty, parseStrTimeToSeconds} from '../utils/biz_util' import {useInViewport} from 'ahooks' import SegmentItem from './SegmentItem' -import {stopPopFunc} from '../util/util' +import {stopPopFunc} from '../utils/util' import useSubtitle from '../hooks/useSubtitle' const SummarizeItemOverview = (props: { diff --git a/src/biz/SegmentItem.tsx b/src/components/SegmentItem.tsx similarity index 100% rename from src/biz/SegmentItem.tsx rename to src/components/SegmentItem.tsx diff --git a/src/const.ts b/src/consts/const.ts similarity index 100% rename from src/const.ts rename to src/consts/const.ts diff --git a/src/hooks/useMessagingService.ts b/src/hooks/useMessagingService.ts index a9b5661..031ab42 100644 --- a/src/hooks/useMessagingService.ts +++ b/src/hooks/useMessagingService.ts @@ -1,7 +1,7 @@ import { setCurFetched, setCurInfo, setData, setInfos, setTitle, setUrl } from '@/redux/envReducer' import { useMemo } from 'react' import { useAppDispatch } from './redux' -import { MESSAGE_TO_APP_SET_INFOS, MESSAGE_TO_APP_SET_VIDEO_INFO } from '@/const' +import { MESSAGE_TO_APP_SET_INFOS, MESSAGE_TO_APP_SET_VIDEO_INFO } from '@/consts/const' import useMessageService from '@/messaging/useMessageService' const useMessagingService = () => { diff --git a/src/hooks/useSearchService.ts b/src/hooks/useSearchService.ts index 33ad661..c4283dc 100644 --- a/src/hooks/useSearchService.ts +++ b/src/hooks/useSearchService.ts @@ -1,7 +1,7 @@ import {useAppDispatch, useAppSelector} from './redux' import {useEffect, useMemo} from 'react' import {setSearchResult, setSearchText, } from '../redux/envReducer' -import {Search} from '../util/search' +import {Search} from '../utils/search' interface Document { idx: number diff --git a/src/hooks/useSubtitle.ts b/src/hooks/useSubtitle.ts index 96a3737..b750ec5 100644 --- a/src/hooks/useSubtitle.ts +++ b/src/hooks/useSubtitle.ts @@ -1,7 +1,7 @@ import {useAppDispatch, useAppSelector} from './redux' import React, {useCallback} from 'react' import {setNeedScroll, setReviewAction, setTempData} from '../redux/envReducer' -import {MESSAGE_TO_INJECT_MOVE} from '../const' +import {MESSAGE_TO_INJECT_MOVE} from '../consts/const' import useMessage from '../messaging/useMessage' const useSubtitle = () => { const dispatch = useAppDispatch() diff --git a/src/hooks/useSubtitleService.ts b/src/hooks/useSubtitleService.ts index cb7612e..fd3d07a 100644 --- a/src/hooks/useSubtitleService.ts +++ b/src/hooks/useSubtitleService.ts @@ -16,10 +16,10 @@ import { setTempData, } from '../redux/envReducer' import {EventBusContext} from '../Router' -import {EVENT_EXPAND, GEMINI_TOKENS, TOTAL_HEIGHT_MAX, TOTAL_HEIGHT_MIN, WORDS_MIN, WORDS_RATE, MESSAGE_TO_INJECT_GET_VIDEO_STATUS, MESSAGE_TO_INJECT_GET_VIDEO_ELEMENT_INFO, MESSAGE_TO_INJECT_REFRESH_VIDEO_INFO, MESSAGE_TO_INJECT_HIDE_TRANS, MESSAGE_TO_INJECT_UPDATETRANSRESULT, TOTAL_HEIGHT_DEF} from '../const' +import {EVENT_EXPAND, GEMINI_TOKENS, TOTAL_HEIGHT_MAX, TOTAL_HEIGHT_MIN, WORDS_MIN, WORDS_RATE, MESSAGE_TO_INJECT_GET_VIDEO_STATUS, MESSAGE_TO_INJECT_GET_VIDEO_ELEMENT_INFO, MESSAGE_TO_INJECT_REFRESH_VIDEO_INFO, MESSAGE_TO_INJECT_HIDE_TRANS, MESSAGE_TO_INJECT_UPDATETRANSRESULT, TOTAL_HEIGHT_DEF} from '../consts/const' import {useAsyncEffect, useInterval} from 'ahooks' -import {getModelMaxTokens, getWholeText} from '../util/biz_util' -import {MESSAGE_TO_INJECT_GET_SUBTITLE} from '../const' +import {getModelMaxTokens, getWholeText} from '../utils/biz_util' +import {MESSAGE_TO_INJECT_GET_SUBTITLE} from '../consts/const' import useMessage from '../messaging/useMessage' import { injectWaiter } from '@/messaging/useMessageService' diff --git a/src/hooks/useTranslate.ts b/src/hooks/useTranslate.ts index dfcc97c..7724997 100644 --- a/src/hooks/useTranslate.ts +++ b/src/hooks/useTranslate.ts @@ -26,11 +26,11 @@ import { SUMMARIZE_TYPES, TRANSLATE_COOLDOWN, TRANSLATE_FETCH_DEFAULT, -} from '../const' +} from '../consts/const' import toast from 'react-hot-toast' import {useMemoizedFn} from 'ahooks/es' -import {extractJsonArray, extractJsonObject, getModel} from '../util/biz_util' -import {formatTime} from '../util/util' +import {extractJsonArray, extractJsonObject, getModel} from '../utils/biz_util' +import {formatTime} from '../utils/util' import useMessage from '@/messaging/useMessage' const useTranslate = () => { const dispatch = useAppDispatch() diff --git a/src/inject/inject.ts b/src/inject/inject.ts index 0c813b3..ad8c8c4 100644 --- a/src/inject/inject.ts +++ b/src/inject/inject.ts @@ -1,5 +1,5 @@ -import { TOTAL_HEIGHT_DEF, HEADER_HEIGHT, TOTAL_HEIGHT_MIN, TOTAL_HEIGHT_MAX, IFRAME_ID, MESSAGE_TO_INJECT_DOWNLOAD_AUDIO, MESSAGE_TARGET_INJECT, MESSAGE_TO_APP_SET_INFOS, MESSAGE_TO_INJECT_TOGGLE_DISPLAY, STORAGE_ENV, MESSAGE_TO_EXTENSION_SHOW_FLAG } from '@/const' -import { MESSAGE_TO_INJECT_FOLD, MESSAGE_TO_INJECT_MOVE, MESSAGE_TO_APP_SET_VIDEO_INFO, MESSAGE_TO_INJECT_GET_SUBTITLE, MESSAGE_TO_INJECT_GET_VIDEO_STATUS, MESSAGE_TO_INJECT_GET_VIDEO_ELEMENT_INFO, MESSAGE_TO_INJECT_UPDATETRANSRESULT, MESSAGE_TO_INJECT_PLAY, MESSAGE_TO_INJECT_HIDE_TRANS, MESSAGE_TO_INJECT_REFRESH_VIDEO_INFO } from '@/const' +import { TOTAL_HEIGHT_DEF, HEADER_HEIGHT, TOTAL_HEIGHT_MIN, TOTAL_HEIGHT_MAX, IFRAME_ID, MESSAGE_TO_INJECT_DOWNLOAD_AUDIO, MESSAGE_TARGET_INJECT, MESSAGE_TO_APP_SET_INFOS, MESSAGE_TO_INJECT_TOGGLE_DISPLAY, STORAGE_ENV, MESSAGE_TO_EXTENSION_SHOW_FLAG } from '@/consts/const' +import { MESSAGE_TO_INJECT_FOLD, MESSAGE_TO_INJECT_MOVE, MESSAGE_TO_APP_SET_VIDEO_INFO, MESSAGE_TO_INJECT_GET_SUBTITLE, MESSAGE_TO_INJECT_GET_VIDEO_STATUS, MESSAGE_TO_INJECT_GET_VIDEO_ELEMENT_INFO, MESSAGE_TO_INJECT_UPDATETRANSRESULT, MESSAGE_TO_INJECT_PLAY, MESSAGE_TO_INJECT_HIDE_TRANS, MESSAGE_TO_INJECT_REFRESH_VIDEO_INFO } from '@/consts/const' import InjectMessage from '@/messaging/InjectMessage' const debug = (...args: any[]) => { diff --git a/src/main.tsx b/src/main.tsx index 01ea0e9..8a919f7 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -4,7 +4,7 @@ import './index.less' import store from './store' import {Provider} from 'react-redux' import Router from './Router' -import {APP_DOM_ID} from './const' +import {APP_DOM_ID} from './consts/const' const body = document.querySelector('body') const app = document.createElement('div') diff --git a/src/messaging/ExtensionMessage.ts b/src/messaging/ExtensionMessage.ts index 85077a4..f495e24 100644 --- a/src/messaging/ExtensionMessage.ts +++ b/src/messaging/ExtensionMessage.ts @@ -1,4 +1,4 @@ -import { MESSAGE_TARGET_EXTENSION, MESSAGE_TARGET_INJECT, MESSAGE_TO_EXTENSION_ROUTE_MSG } from '@/const' +import { MESSAGE_TARGET_EXTENSION, MESSAGE_TO_EXTENSION_ROUTE_MSG } from '@/consts/const' import PortMessageHandler from './PortMessageHandler' export type PortContext = { diff --git a/src/messaging/InjectMessage.ts b/src/messaging/InjectMessage.ts index 4658e67..7e181ca 100644 --- a/src/messaging/InjectMessage.ts +++ b/src/messaging/InjectMessage.ts @@ -1,5 +1,4 @@ -import { MESSAGE_TARGET_APP, MESSAGE_TARGET_EXTENSION, MESSAGE_TARGET_INJECT, MESSAGE_TO_EXTENSION_ROUTE_MSG } from '@/const' -import { PostMessagePayload, PostMessageResponse, startListening } from 'postmessage-promise' +import { MESSAGE_TARGET_APP, MESSAGE_TARGET_EXTENSION, MESSAGE_TARGET_INJECT, MESSAGE_TO_EXTENSION_ROUTE_MSG } from '@/consts/const' import PortMessageHandler from './PortMessageHandler' class InjectMessage { diff --git a/src/messaging/useMessage.ts b/src/messaging/useMessage.ts index 7829453..034b91b 100644 --- a/src/messaging/useMessage.ts +++ b/src/messaging/useMessage.ts @@ -1,4 +1,4 @@ -import { MESSAGE_TARGET_EXTENSION, MESSAGE_TARGET_INJECT, MESSAGE_TO_EXTENSION_ROUTE_MSG } from '@/const' +import { MESSAGE_TARGET_EXTENSION, MESSAGE_TARGET_INJECT, MESSAGE_TO_EXTENSION_ROUTE_MSG } from '@/consts/const' import { injectWaiter } from './useMessageService' import { useCallback } from 'react' import PortMessageHandler from './PortMessageHandler' diff --git a/src/messaging/useMessageService.ts b/src/messaging/useMessageService.ts index 021907c..dc5da8f 100644 --- a/src/messaging/useMessageService.ts +++ b/src/messaging/useMessageService.ts @@ -1,10 +1,7 @@ -import { useCallback, useEffect, useMemo } from 'react' +import { useCallback, useMemo } from 'react' import { MESSAGE_TARGET_APP, - MESSAGE_TARGET_EXTENSION, - MESSAGE_TARGET_INJECT, -} from '@/const' -import { callServer, PostMessagePayload, PostMessageResponse } from 'postmessage-promise' +} from '@/consts/const' import { Waiter } from '@kky002/kky-util' import PortMessageHandler from './PortMessageHandler' diff --git a/src/pages/MainPage.tsx b/src/pages/MainPage.tsx index fce12ad..3ee2f76 100644 --- a/src/pages/MainPage.tsx +++ b/src/pages/MainPage.tsx @@ -1,19 +1,15 @@ -import React, {useCallback, useContext, useEffect, useMemo} from 'react' +import React, {useCallback, useContext, useEffect} from 'react' import {useAppDispatch, useAppSelector} from '../hooks/redux' -import {setEnvData, setEnvReady, setFold, setTempData, setTempReady} from '../redux/envReducer' -import Header from '../biz/Header' -import Body from '../biz/Body' +import Header from '../components/Header' +import Body from '../components/Body' import useSubtitleService from '../hooks/useSubtitleService' -import {cloneDeep} from 'lodash-es' -import {EVENT_EXPAND, MESSAGE_TO_INJECT_FOLD, PAGE_MAIN, PAGE_SETTINGS, STORAGE_ENV, STORAGE_TEMP} from '../const' +import {EVENT_EXPAND, MESSAGE_TO_INJECT_FOLD} from '../consts/const' import {EventBusContext} from '../Router' import useTranslateService from '../hooks/useTranslateService' -import {handleJson} from '@kky002/kky-util' -import {useLocalStorage} from '@kky002/kky-hooks' -import {Toaster} from 'react-hot-toast' -import {setTheme} from '../util/biz_util' +import {setTheme} from '../utils/biz_util' import useSearchService from '../hooks/useSearchService' import useMessage from '../messaging/useMessage' +import {setFold} from '../redux/envReducer' function App() { const dispatch = useAppDispatch() diff --git a/src/pages/OptionsPage.tsx b/src/pages/OptionsPage.tsx index 7bfc0aa..34fef4f 100644 --- a/src/pages/OptionsPage.tsx +++ b/src/pages/OptionsPage.tsx @@ -1,4 +1,4 @@ -import React, {PropsWithChildren, useCallback, useEffect, useMemo, useState} from 'react' +import React, {PropsWithChildren, useCallback, useMemo, useState} from 'react' import {setEnvData, setTempData} from '../redux/envReducer' import {useAppDispatch, useAppSelector} from '../hooks/redux' import { @@ -22,7 +22,7 @@ import { TRANSLATE_FETCH_MIN, TRANSLATE_FETCH_STEP, WORDS_RATE, -} from '../const' +} from '../consts/const' import {IoWarning} from 'react-icons/all' import classNames from 'classnames' import toast from 'react-hot-toast' diff --git a/src/redux/envReducer.ts b/src/redux/envReducer.ts index e802628..a9ea0f3 100644 --- a/src/redux/envReducer.ts +++ b/src/redux/envReducer.ts @@ -1,6 +1,6 @@ import {createSlice, PayloadAction} from '@reduxjs/toolkit' import {find, findIndex} from 'lodash-es' -import {DEFAULT_SERVER_URL_OPENAI, TOTAL_HEIGHT_DEF} from '../const' +import {DEFAULT_SERVER_URL_OPENAI, TOTAL_HEIGHT_DEF} from '../consts/const' interface EnvState { envData: EnvData diff --git a/src/util/biz_util.ts b/src/utils/biz_util.ts similarity index 99% rename from src/util/biz_util.ts rename to src/utils/biz_util.ts index e3a5acb..3fda843 100644 --- a/src/util/biz_util.ts +++ b/src/utils/biz_util.ts @@ -1,4 +1,4 @@ -import {APP_DOM_ID, CUSTOM_MODEL_TOKENS, MODEL_DEFAULT, MODEL_MAP, SUMMARIZE_TYPES} from '../const' +import {APP_DOM_ID, CUSTOM_MODEL_TOKENS, MODEL_DEFAULT, MODEL_MAP, SUMMARIZE_TYPES} from '../consts/const' import {isDarkMode} from '@kky002/kky-util' import toast from 'react-hot-toast' import {findIndex} from 'lodash-es' diff --git a/src/util/pinyin_util.ts b/src/utils/pinyin_util.ts similarity index 100% rename from src/util/pinyin_util.ts rename to src/utils/pinyin_util.ts diff --git a/src/util/search.ts b/src/utils/search.ts similarity index 100% rename from src/util/search.ts rename to src/utils/search.ts diff --git a/src/util/util.ts b/src/utils/util.ts similarity index 100% rename from src/util/util.ts rename to src/utils/util.ts