@@ -281,38 +281,38 @@ export const FileManagementPage = () => {
281281 } ;
282282
283283 // Open file
284- // const handleOpenFile = async (file: FileData) => {
285- // try {
286- // // First save the file to a temporary location
287- // if (!window.electron || !window.electron.saveFile || !window.electron.openFile) {
288- // console.error("Electron API not available");
289- // return;
290- // }
284+ const handleOpenFile = async ( file : FileData ) => {
285+ try {
286+ // First save the file to a temporary location
287+ if ( ! window . electron || ! window . electron . saveFile || ! window . electron . openFile ) {
288+ console . error ( "Electron API not available" ) ;
289+ return ;
290+ }
291291
292- // // Save file to temp location and then open it
293- // const saveResult = await window.electron.saveFile(
294- // file.data,
295- // file.name,
296- // file.type || 'application/octet-stream'
297- // );
292+ // Save file to temp location and then open it
293+ const saveResult = await window . electron . saveFile (
294+ file . data ,
295+ file . name ,
296+ file . type || 'application/octet-stream'
297+ ) ;
298298
299- // if (!saveResult.success || !saveResult.filePath) {
300- // if (!saveResult.canceled) {
301- // console.error("Error saving file:", saveResult.error);
302- // }
303- // return;
304- // }
299+ if ( ! saveResult . success || ! saveResult . filePath ) {
300+ if ( ! saveResult . canceled ) {
301+ console . error ( "Error saving file:" , saveResult . error ) ;
302+ }
303+ return ;
304+ }
305305
306- // // Now open the file with the default application
307- // const openResult = await window.electron.openFile(saveResult.filePath);
306+ // Now open the file with the default application
307+ const openResult = await window . electron . openFile ( saveResult . filePath ) ;
308308
309- // if (!openResult.success) {
310- // console.error("Error opening file:", openResult.error);
311- // }
312- // } catch (error) {
313- // console.error("Error opening file:", error);
314- // }
315- // };
309+ if ( ! openResult . success ) {
310+ console . error ( "Error opening file:" , openResult . error ) ;
311+ }
312+ } catch ( error ) {
313+ console . error ( "Error opening file:" , error ) ;
314+ }
315+ } ;
316316
317317 // Format file size
318318 const formatFileSize = ( bytes : number ) : string => {
@@ -672,13 +672,13 @@ export const FileManagementPage = () => {
672672 </ td >
673673 < td className = "px-4 py-3" >
674674 < div className = "flex items-center justify-center space-x-2" >
675- { /* <button
675+ < button
676676 onClick = { ( ) => handleOpenFile ( file ) }
677677 className = "p-2 rounded-md message-icon-btn"
678678 title = { t ( "fileManagement.open" ) }
679679 >
680680 < FolderOpen size = { 16 } />
681- </button> */ }
681+ </ button >
682682 < button
683683 onClick = { ( ) => {
684684 setSelectedFile ( file ) ;
0 commit comments