Prefixed JSON filenames with the image UUID #6469

This commit is contained in:
jstnlowe 2024-06-04 19:10:04 -04:00 committed by psychedelicious
parent ff01ceae99
commit 52aac954c0
2 changed files with 4 additions and 3 deletions

View File

@ -32,8 +32,9 @@ const DataViewer = (props: Props) => {
const handleDownload = useCallback(() => {
const blob = new Blob([dataString]);
const a = document.createElement('a');
const imageName = fileName ? fileName.replace('.png', '') : null;
a.href = URL.createObjectURL(blob);
a.download = `${fileName || label}.json`;
a.download = imageName ? `${ imageName }_${ label }.json` : `${ label }.json`;
document.body.appendChild(a);
a.click();
a.remove();

View File

@ -68,14 +68,14 @@ const ImageMetadataViewer = ({ image }: ImageMetadataViewerProps) => {
</TabPanel>
<TabPanel>
{metadata ? (
<DataViewer data={metadata} label={t('metadata.metadata')} />
<DataViewer fileName={image.image_name} data={metadata} label={t('metadata.metadata')} />
) : (
<IAINoContentFallback label={t('metadata.noMetaData')} />
)}
</TabPanel>
<TabPanel>
{image ? (
<DataViewer data={image} label={t('metadata.imageDetails')} />
<DataViewer fileName={image.image_name} data={image} label={t('metadata.imageDetails')} />
) : (
<IAINoContentFallback label={t('metadata.noImageDetails')} />
)}