@@ -219,18 +219,53 @@ async function processFiles() {
219219}
220220
221221// process one
222- async function processOne (){
223- if (files .value .length === 0 ) return ;
224- isProcessing .value = true
225- processedFiles .value = []
226- try {
227-
228- } catch (error) {
229-
230- }finally {
231- isProcessing .value = false
232- }
233- }
222+ // async function processOne(index){
223+ // try {
224+ // processedFiles.value=[index]
225+ // isProcessing.value = true
226+ // // Ask user for save directory
227+ // const savePath = await ipcRenderer.invoke('dialog:selectDirectory')
228+ // if (!savePath) {
229+ // isProcessing.value = false
230+ // return // User cancelled
231+ // }
232+ // const file = files.value[index]
233+ // const filepath = files.value[index].path
234+ // const options = fileOptions.value[index]
235+ // const preview = previewUrls.value[index]
236+ // if (!file.type.startsWith('image/')) {
237+ // processedFiles.value.push({
238+ // name: file.name,
239+ // success: false,
240+ // message: 'Only image files can be processed'
241+ // })
242+ // }
243+ // // console.log(filepath)
244+ // // Send to main process for processing with Sharp
245+ // const result = await ipcRenderer.invoke('process:image', {
246+ // filepath,
247+ // name: file.name,
248+ // options: {
249+ // width: options.width,
250+ // height: options.height,
251+ // quality: options.quality,
252+ // format: options.format
253+ // },
254+ // savePath
255+ // });
256+ // console.log(result)
257+ // processedFiles.value[index] = {
258+ // name: file.name,
259+ // success: result.success,
260+ // message: result.message,
261+ // outputPath: result.outputPath
262+ // }
263+ // } catch (error) {
264+ // console.error('Error processing files:', error)
265+ // } finally {
266+ // isProcessing.value = false
267+ // }
268+ // }
234269onMounted (() => {
235270 const dropArea = document .querySelector (' .drop-area' )
236271 const folderIcon = document .querySelector (' .folder-icon' )
@@ -332,7 +367,7 @@ onMounted(() => {
332367 < div
333368 v- for = " (preview, index) in previewUrls"
334369 : key= " index"
335- class = " p-4 flex relative m-4 items-center gap-4 border-5 border-midnight rounded-lg hover:border-indigo-500"
370+ class = " p-4 flex relative m-4 items-center gap-4 border-5 border-midnight rounded-lg hover:border-indigo-500 group "
336371 >
337372 <!-- Image preview -->
338373 < div class = " flex-shrink-0" >
@@ -424,7 +459,10 @@ onMounted(() => {
424459 </div>
425460</div>
426461 <!-- Buttons -->
427- <div class="flex-shrink-0 flex flex-col gap-5 ml-auto">
462+ <button class="hidden group-hover:flex btn btn-sm btn-circle absolute right-2 top-0.5 text-gray-400 hover:bg-transparent hover:text-red-400 hover:border-red-400"
463+ @click="removeFile(index)"
464+ >✕</button>
465+ <div class="flex-shrink-0 flex flex-col gap-5 ml-auto pt-2">
428466 <button
429467 class="btn btn-sm btn-primary"
430468 :onclick="`document.getElementById(' options_modal_${index}' ).showModal()`"
@@ -462,12 +500,10 @@ onMounted(() => {
462500 <option value="jpeg">JPEG</option>
463501 <option value="avif">AVIF</option>
464502 <option value="gif">GIF</option>
465- <option value="jp2">JP2</option>
466503 <option value="tiff">TIFF</option>
467504 <option value="heif">HEIF</option>
468505 <option value="jxl">JXL</option>
469506 <option value="tile">Tile</option>
470- <option value="raw">Raw (base64)</option>
471507 </select>
472508 </div>
473509
0 commit comments