Skip to content

Commit 3363268

Browse files
Enhance image name handling and accessibility
Updated getImageName function to handle both Unix and Windows path separators. Modified the image name display to include a title attribute for better accessibility.
1 parent a3c7297 commit 3363268

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

frontend/src/components/Media/MediaInfoPanel.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export const MediaInfoPanel: React.FC<MediaInfoPanelProps> = ({
3434

3535
const getImageName = () => {
3636
if (!currentImage) return 'Image';
37-
return currentImage.path?.split('/').pop() || 'Image';
37+
// Handle both Unix (/) and Windows (\) path separators
38+
return currentImage.path?.split(/[/\\]/).pop() || 'Image';
3839
};
3940

4041
if (!show) return null;
@@ -57,9 +58,14 @@ export const MediaInfoPanel: React.FC<MediaInfoPanelProps> = ({
5758
<div className="rounded-lg bg-white/10 p-2">
5859
<ImageLucide className="h-5 w-5 text-blue-400" />
5960
</div>
60-
<div className='min-w-0 flex-1'>
61+
<div className="min-w-0 flex-1">
6162
<p className="text-xs text-white/50">Name</p>
62-
<p className="truncate font-medium text-white">{getImageName()}</p>
63+
<p
64+
className="truncate font-medium text-white"
65+
title={getImageName()}
66+
>
67+
{getImageName()}
68+
</p>
6369
</div>
6470
</div>
6571

@@ -77,7 +83,7 @@ export const MediaInfoPanel: React.FC<MediaInfoPanelProps> = ({
7783
<div className="rounded-lg bg-white/10 p-2">
7884
<MapPin className="h-5 w-5 text-red-400" />
7985
</div>
80-
<div className='min-w-0 flex-1'>
86+
<div className="min-w-0 flex-1">
8187
<p className="text-xs text-white/50">Location</p>
8288
<p className="font-medium text-white">
8389
{currentImage?.metadata || 'No location data'}

0 commit comments

Comments
 (0)