From 0a82c70a8b997de5bb3cdfda570c98a576cb149d Mon Sep 17 00:00:00 2001
From: Lutz Helm <helm@ub.uni-leipzig.de>
Date: Thu, 11 Mar 2021 18:47:04 +0100
Subject: [PATCH] Rephrase some localstorage download  terms

---
 demo/src/index.js                      |  2 +-
 src/AnnotationDownloadDialog.js        |  5 ++---
 src/plugins/miradorAnnotationPlugin.js | 13 ++++++++-----
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/demo/src/index.js b/demo/src/index.js
index d501089..6187e3a 100644
--- a/demo/src/index.js
+++ b/demo/src/index.js
@@ -9,7 +9,7 @@ const config = {
   annotation: {
     adapter: (canvasId) => new LocalStorageAdapter(`localStorage://?canvasId=${canvasId}`),
     // adapter: (canvasId) => new AnnototAdapter(canvasId, endpointUrl),
-    // downloadCanvasAnnotations: true,
+    downloadLocalStorageAnnotations: false,
   },
   id: 'demo',
   window: {
diff --git a/src/AnnotationDownloadDialog.js b/src/AnnotationDownloadDialog.js
index bcba956..832a09b 100644
--- a/src/AnnotationDownloadDialog.js
+++ b/src/AnnotationDownloadDialog.js
@@ -86,15 +86,14 @@ export class AnnotationDownloadDialog extends Component {
                   component="a"
                   key={dl.canvasId}
                   aria-label={`Download annotations for ${dl.label}`}
-                  startIcon={<GetAppIcon />}
                   href={dl.url}
-                  download={`annotations-${dl.id}.json`}
+                  download={`${dl.id}.json`}
                 >
                   <ListItemIcon>
                     <GetAppIcon />
                   </ListItemIcon>
                   <ListItemText>
-                    {`Download annotations for canvas "${dl.label}"`}
+                    {`Download annotations for "${dl.label}"`}
                   </ListItemText>
                 </ListItem>
               ))}
diff --git a/src/plugins/miradorAnnotationPlugin.js b/src/plugins/miradorAnnotationPlugin.js
index 4845c87..e8bcf7b 100644
--- a/src/plugins/miradorAnnotationPlugin.js
+++ b/src/plugins/miradorAnnotationPlugin.js
@@ -6,6 +6,7 @@ import GetAppIcon from '@material-ui/icons/GetApp';
 import { MiradorMenuButton } from 'mirador/dist/es/src/components/MiradorMenuButton';
 import { getVisibleCanvases } from 'mirador/dist/es/src/state/selectors/canvases';
 import { AnnotationDownloadDialog } from '../AnnotationDownloadDialog';
+import LocalStorageAdapter from '../LocalStorageAdapter';
 
 /** */
 class MiradorAnnotation extends Component {
@@ -45,7 +46,9 @@ class MiradorAnnotation extends Component {
       canvases, config, TargetComponent, targetProps,
     } = this.props;
     const { annotationDownloadDialogOpen } = this.state;
-    const showDownloadDialog = config.annotation && config.annotation.downloadCanvasAnnotations;
+    const storageAdapter = config.annotation && config.annotation.adapter('poke');
+    const offerDownloadDialog = config.annotation && storageAdapter instanceof LocalStorageAdapter
+      && config.annotation.downloadLocalStorageAnnotations;
     return (
       <div>
         <TargetComponent
@@ -58,16 +61,16 @@ class MiradorAnnotation extends Component {
         >
           <AddBoxIcon />
         </MiradorMenuButton>
-        { showDownloadDialog && (
+        { offerDownloadDialog && (
           <MiradorMenuButton
-            aria-label="Download annotation page for canvas"
+            aria-label="Download local annotations for visible items"
             onClick={this.toggleCanvasDownloadDialog}
             size="small"
           >
             <GetAppIcon />
           </MiradorMenuButton>
         )}
-        { showDownloadDialog && (
+        { offerDownloadDialog && (
           <AnnotationDownloadDialog
             canvases={canvases}
             config={config}
@@ -88,7 +91,7 @@ MiradorAnnotation.propTypes = {
   config: PropTypes.shape({
     annotation: PropTypes.shape({
       adapter: PropTypes.func,
-      downloadCanvasAnnotations: PropTypes.bool,
+      downloadLocalStorageAnnotations: PropTypes.bool,
     }),
   }).isRequired,
   TargetComponent: PropTypes.oneOfType([
-- 
GitLab