Skip to content

Commit d94c588

Browse files
authored
Fix: "Open Folder" button functionality (#976)
1 parent 5f61cb4 commit d94c588

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

frontend/src/components/Media/MediaView.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState, useCallback, useMemo, useRef } from 'react';
22
import { useSelector, useDispatch } from 'react-redux';
3-
// import { revealItemInDir } from '@tauri-apps/plugin-opener';
3+
import { revealItemInDir } from '@tauri-apps/plugin-opener';
44
import { MediaViewProps } from '@/types/Media';
55
import { selectCurrentViewIndex } from '@/features/imageSelectors';
66
import { setCurrentViewIndex, closeImageView } from '@/features/imageSlice';
@@ -87,14 +87,13 @@ export function MediaView({
8787
handleNextImage,
8888
);
8989

90-
// Folder Open functionality
90+
/** Opens the system file explorer at the current image's location. */
9191
const handleOpenFolder = async () => {
9292
if (!currentImage?.path) return;
9393
try {
94-
// await revealItemInDir(currentImage.path);
94+
await revealItemInDir(currentImage.path);
9595
} catch (err) {
96-
console.log(err);
97-
console.error('Failed to open folder.');
96+
console.error('Failed to open folder:', err);
9897
}
9998
};
10099

frontend/src/components/Media/MediaViewControls.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Info, Folder, Heart, Play, Pause, X } from 'lucide-react';
2+
import { Info, Heart, Play, Pause, X, Folder } from 'lucide-react';
33

44
interface MediaViewControlsProps {
55
showInfo: boolean;
@@ -13,6 +13,7 @@ interface MediaViewControlsProps {
1313
type?: string;
1414
}
1515

16+
/** Control buttons for the full-screen media viewer. */
1617
export const MediaViewControls: React.FC<MediaViewControlsProps> = ({
1718
showInfo,
1819
onToggleInfo,
@@ -45,6 +46,7 @@ export const MediaViewControls: React.FC<MediaViewControlsProps> = ({
4546
>
4647
<Folder className="h-5 w-5" />
4748
</button>
49+
4850
<button
4951
onClick={onToggleFavourite}
5052
className={`cursor-pointer rounded-full p-2.5 text-white transition-all duration-300 ${

0 commit comments

Comments
 (0)