@@ -130,7 +130,6 @@ const TranslationSection = () => {
130
130
} ;
131
131
const [ availableTranslationLanguages , setAvailableTranslationLanguages ] = useState < SelectData < string > [ ] > ( [ ] )
132
132
const [ isLoading , setIsLoading ] = useState ( false )
133
- const [ articleContent , setArticleContent ] = useState ( '' ) ;
134
133
const form = useForm < TranslationFormType > ( {
135
134
defaultValues : {
136
135
sourceArticleUrl : '' ,
@@ -147,10 +146,9 @@ const TranslationSection = () => {
147
146
setValue,
148
147
} = form
149
148
150
- /* const onSubmit = useCallback(async (data: TranslationFormType) => {
149
+ const onSubmit = useCallback ( async ( data : TranslationFormType ) => {
151
150
try {
152
151
setIsLoading ( true )
153
-
154
152
const response = await fetchArticle ( {
155
153
translationTool,
156
154
deepLApiKey : APIKey ,
@@ -162,32 +160,13 @@ const TranslationSection = () => {
162
160
Object . entries ( response . data . articleLanguages ) . map ( ( [ key , value ] ) => ( {
163
161
value,
164
162
label : key ,
165
- })))
166
-
163
+ } ) ) )
167
164
} catch ( error ) {
168
165
console . log ( error )
169
166
} finally {
170
167
setIsLoading ( false )
171
168
}
172
- }, [setValue, translationTool, APIKey])*/
173
-
174
- const onSubmit = useCallback ( async ( data : { sourceArticleUrl : string } ) => {
175
- try {
176
- setIsLoading ( true )
177
-
178
- const mockResponse = {
179
- title : 'Pizza' ,
180
- content :
181
- 'Pizza is a popular Italian dish made of flattened bread dough topped with tomatoes, cheese, and other ingredients, baked in an oven.' ,
182
- url : 'https://en.wikipedia.org/wiki/Pizza' ,
183
- }
184
- setArticleContent ( mockResponse . content )
185
- } catch ( error ) {
186
- console . error ( 'Error fetching article:' , error )
187
- } finally {
188
- setIsLoading ( false )
189
- }
190
- } , [ ] )
169
+ } , [ setValue , translationTool , APIKey ] )
191
170
192
171
const onLanguageChange = useCallback ( async ( translateArticleUrl : string ) => {
193
172
try {
@@ -289,20 +268,6 @@ const TranslationSection = () => {
289
268
< TableCell > { text . editing } </ TableCell >
290
269
</ TableRow >
291
270
) ) }
292
- { articleContent ? (
293
- < TableRow >
294
- < TableCell className = "font-medium" > { articleContent } </ TableCell >
295
- < TableCell className = "font-medium" >
296
- Translation functionality is not implemented yet.
297
- </ TableCell >
298
- </ TableRow >
299
- ) : (
300
- < TableRow >
301
- < TableCell className = "font-medium" > No article content yet.</ TableCell >
302
- < TableCell className = "font-medium" > No translation available.</ TableCell >
303
- </ TableRow >
304
- ) }
305
-
306
271
</ TableBody >
307
272
</ Table >
308
273
0 commit comments