@@ -14,11 +14,7 @@ import { IgnoredWordsManager } from "./IgnoredWordsManager";
1414import { ToastContainer } from "./Toast" ;
1515import type { ToastMessage } from "./Toast" ;
1616import type { CheckGranularity , ProofreadError } from "../types" ;
17- import {
18- initNotificationService ,
19- updateProofreadProgress ,
20- sendProofreadCompleteNotification ,
21- } from "../utils/notificationService" ;
17+
2218
2319const ERROR_TYPE_LABELS : Record < string , { icon : keyof typeof Icons ; label : string } > = {
2420 typo : { icon : "typo" , label : "错别字" } ,
@@ -64,7 +60,6 @@ export function ProofreadPanel() {
6460 const [ singleCheckingLine , setSingleCheckingLine ] = useState < number | null > (
6561 null ,
6662 ) ;
67- const [ notificationInit , setNotificationInit ] = useState ( false ) ;
6863 const [ showIgnoredWordsModal , setShowIgnoredWordsModal ] = useState ( false ) ;
6964 const [ toastMessages , setToastMessages ] = useState < ToastMessage [ ] > ( [ ] ) ;
7065 // 动画互斥:防止快速连续点击"采纳"
@@ -159,47 +154,12 @@ export function ProofreadPanel() {
159154 }
160155 } , [ chapter ?. id , paragraphIndexMap , chapter , setResults , setStartLine ] ) ;
161156
162- useEffect ( ( ) => {
163- if ( ! checking || ! chapter ) return ;
164- const chapterId = chapter . id ;
165- const chapterTitle = chapter . title ;
166- const interval = setInterval ( async ( ) => {
167- const currentResults = useProofreadStore . getState ( ) . results [ chapterId ] ?? [ ] ;
168- const totalErrors = currentResults . reduce ( ( sum , r ) => sum + r . errors . length , 0 ) ;
169- const remainingErrors = currentResults . reduce (
170- ( sum , r ) => sum + r . errors . filter ( ( e ) => ! e . applied && ! e . skipped ) . length ,
171- 0 ,
172- ) ;
173- const processedCount = totalErrors - remainingErrors ;
174- if ( totalErrors > 0 ) {
175- await updateProofreadProgress ( {
176- chapterTitle,
177- totalErrors,
178- remainingErrors,
179- processedCount,
180- } ) ;
181- }
182- } , 5000 ) ;
183- return ( ) => clearInterval ( interval ) ;
184- } , [ checking , chapter ] ) ;
157+
185158
186159 const handleStartCheck = async ( ) => {
187- if ( ! notificationInit ) {
188- await initNotificationService ( ) ;
189- setNotificationInit ( true ) ;
190- }
191160 setChecking ( true ) ;
192161 await checkChapter ( granularity , startLine ?? 0 ) ;
193162 setChecking ( false ) ;
194- if ( chapter ) {
195- const finalResults = useProofreadStore . getState ( ) . results [ chapter . id ] ?? [ ] ;
196- const finalTotal = finalResults . reduce ( ( sum , r ) => sum + r . errors . length , 0 ) ;
197- const finalProcessed = finalResults . reduce (
198- ( sum , r ) => sum + r . errors . filter ( ( e ) => e . applied || e . skipped ) . length ,
199- 0 ,
200- ) ;
201- await sendProofreadCompleteNotification ( chapter . title , finalTotal , finalProcessed ) ;
202- }
203163 } ;
204164
205165 const handleSingleLineCheck = async ( originalIndex : number , filteredIndex : number ) => {
0 commit comments