fix: await openPath fallback and other review fixes
- Fix IPC handler to properly await shell.openPath() promise - Export dialog now shows file name below the button for better UX - Toast message now generic (works for both video and GIF exports) - Fixed formatting in electron type definitions
This commit is contained in:
Vendored
+1
-1
@@ -39,7 +39,7 @@ interface Window {
|
||||
setCurrentVideoPath: (path: string) => Promise<{ success: boolean }>
|
||||
getCurrentVideoPath: () => Promise<{ success: boolean; path?: string }>
|
||||
clearCurrentVideoPath: () => Promise<{ success: boolean }>
|
||||
getPlatform: () => Promise<string>,
|
||||
getPlatform: () => Promise<string>
|
||||
revealInFolder: (filePath: string) => Promise<{ success: boolean; error?: string; message?: string }>,
|
||||
hudOverlayHide: () => void;
|
||||
hudOverlayClose: () => void;
|
||||
|
||||
@@ -209,7 +209,11 @@ export function registerIpcHandlers(
|
||||
// This might happen if the file was moved or deleted after export,
|
||||
// or if the path is somehow invalid for showItemInFolder
|
||||
try {
|
||||
shell.openPath(path.dirname(filePath));
|
||||
const openPathResult = await shell.openPath(path.dirname(filePath));
|
||||
if (openPathResult) {
|
||||
// openPath returned an error message
|
||||
return { success: false, error: openPathResult };
|
||||
}
|
||||
return { success: true, message: 'Could not reveal item, but opened directory.' };
|
||||
} catch (openError) {
|
||||
console.error(`Error opening directory: ${path.dirname(filePath)}`, openError);
|
||||
|
||||
@@ -112,13 +112,10 @@ export function ExportDialog({
|
||||
<div className="w-12 h-12 rounded-full bg-[#34B27B]/20 flex items-center justify-center ring-1 ring-[#34B27B]/50">
|
||||
<Download className="w-6 h-6 text-[#34B27B]" />
|
||||
</div>
|
||||
<div className="w-12 h-12 rounded-full bg-[#34B27B]/20 flex items-center justify-center ring-1 ring-[#34B27B]/50">
|
||||
<Download className="w-6 h-6 text-[#34B27B]" />
|
||||
</div>
|
||||
<div className="flex flex-col gap-2"> {/* Added flex container */}
|
||||
<div className="flex flex-col gap-2">
|
||||
<span className="text-xl font-bold text-slate-200 block">Export Complete</span>
|
||||
<span className="text-sm text-slate-400">Your {formatLabel.toLowerCase()} is ready</span>
|
||||
{exportedFilePath && ( // Only show button if path exists
|
||||
{exportedFilePath && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={handleClickShowInFolder}
|
||||
@@ -127,6 +124,11 @@ export function ExportDialog({
|
||||
Show in Folder
|
||||
</Button>
|
||||
)}
|
||||
{exportedFilePath && (
|
||||
<span className="text-xs text-slate-500 break-all max-w-xs mt-1">
|
||||
{exportedFilePath.split('/').pop()}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
|
||||
@@ -722,7 +722,7 @@ export default function VideoEditor() {
|
||||
}, []);
|
||||
|
||||
const showExportSuccessToast = useCallback((filePath: string) => {
|
||||
toast.success(`Video exported successfully to ${filePath}`, {
|
||||
toast.success(`Exported successfully to ${filePath}`, {
|
||||
action: {
|
||||
label: 'Show in Folder',
|
||||
onClick: async () => {
|
||||
|
||||
Reference in New Issue
Block a user