11import React from 'react' ;
2- import { open } from '@tauri-apps/plugin-shell' ;
2+ import { invoke } from '@tauri-apps/api/core' ; // Correct Tauri v2 import
3+
34import {
45 X ,
56 ImageIcon as ImageLucide ,
@@ -42,7 +43,6 @@ export const MediaInfoPanel: React.FC<MediaInfoPanelProps> = ({
4243
4344 const getImageName = ( ) => {
4445 if ( ! currentImage ) return 'Image' ;
45- // Handle both Unix (/) and Windows (\) path separators
4646 return currentImage . path ?. split ( / [ / \\ ] / ) . pop ( ) || 'Image' ;
4747 } ;
4848
@@ -51,7 +51,7 @@ export const MediaInfoPanel: React.FC<MediaInfoPanelProps> = ({
5151 const { latitude, longitude } = currentImage . metadata ;
5252 const url = `https://maps.google.com/?q=${ latitude } ,${ longitude } ` ;
5353 try {
54- await open ( url ) ;
54+ await invoke ( 'open_original_file' , { path : url } ) ;
5555 } catch ( error ) {
5656 console . error ( 'Failed to open map URL:' , error ) ;
5757 }
@@ -74,6 +74,7 @@ export const MediaInfoPanel: React.FC<MediaInfoPanelProps> = ({
7474 </ div >
7575
7676 < div className = "space-y-4 text-sm" >
77+ { /* Name */ }
7778 < div className = "flex items-start gap-3" >
7879 < div className = "rounded-lg bg-white/10 p-2" >
7980 < ImageLucide className = "h-5 w-5 text-blue-400" />
@@ -89,6 +90,7 @@ export const MediaInfoPanel: React.FC<MediaInfoPanelProps> = ({
8990 </ div >
9091 </ div >
9192
93+ { /* Date */ }
9294 < div className = "flex items-start gap-3" >
9395 < div className = "rounded-lg bg-white/10 p-2" >
9496 < Calendar className = "h-5 w-5 text-emerald-400" />
@@ -99,6 +101,7 @@ export const MediaInfoPanel: React.FC<MediaInfoPanelProps> = ({
99101 </ div >
100102 </ div >
101103
104+ { /* Location */ }
102105 < div className = "flex items-start gap-3" >
103106 < div className = "rounded-lg bg-white/10 p-2" >
104107 < MapPin className = "h-5 w-5 text-red-400" />
@@ -122,6 +125,7 @@ export const MediaInfoPanel: React.FC<MediaInfoPanelProps> = ({
122125 </ div >
123126 </ div >
124127
128+ { /* Tags */ }
125129 < div className = "flex items-start gap-3" >
126130 < div className = "rounded-lg bg-white/10 p-2" >
127131 < Tag className = "h-5 w-5 text-purple-400" />
@@ -145,6 +149,7 @@ export const MediaInfoPanel: React.FC<MediaInfoPanelProps> = ({
145149 </ div >
146150 </ div >
147151
152+ { /* Position */ }
148153 < div className = "flex items-start gap-3" >
149154 < div className = "rounded-lg bg-white/10 p-2" >
150155 < Info className = "h-5 w-5 text-amber-400" />
@@ -157,13 +162,17 @@ export const MediaInfoPanel: React.FC<MediaInfoPanelProps> = ({
157162 </ div >
158163 </ div >
159164
165+ { /* OPEN ORIGINAL FILE — FIXED */ }
160166 < div className = "mt-4 border-t border-white/10 pt-3" >
161167 < button
162168 className = "w-full cursor-pointer rounded-lg bg-white/10 py-2 text-white transition-colors hover:bg-white/20"
163169 onClick = { async ( ) => {
164170 if ( currentImage ?. path ) {
165171 try {
166- await open ( currentImage . path ) ;
172+ console . log ( 'Sending path to Tauri:' , currentImage . path ) ;
173+ await invoke ( 'open_original_file' , {
174+ path : currentImage . path ,
175+ } ) ;
167176 } catch ( error ) {
168177 console . error ( 'Failed to open file:' , error ) ;
169178 }
0 commit comments