diff --git a/demo/src/index.js b/demo/src/index.js index 6187e3a8916ae50511ff906394f4a32fcc923691..f84bf1b3a8e5881c6b2b053de2330a31d1254685 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), - downloadLocalStorageAnnotations: false, + exportLocalStorageAnnotations: false, }, id: 'demo', window: { diff --git a/src/AnnotationDownloadDialog.js b/src/AnnotationExportDialog.js similarity index 77% rename from src/AnnotationDownloadDialog.js rename to src/AnnotationExportDialog.js index 74cc14eebe79e318159e4418c2341f8a196e378b..605b38e48902cd7392c775c23583807dabd9b056 100644 --- a/src/AnnotationDownloadDialog.js +++ b/src/AnnotationExportDialog.js @@ -11,12 +11,12 @@ import Typography from '@material-ui/core/Typography'; import PropTypes, { bool } from 'prop-types'; /** */ -class AnnotationDownloadDialog extends Component { +class AnnotationExportDialog extends Component { /** */ constructor(props) { super(props); this.state = { - downloadLinks: [], + exportLinks: [], }; this.closeDialog = this.closeDialog.bind(this); } @@ -46,8 +46,8 @@ class AnnotationDownloadDialog extends Component { return resolvedAcc; }; if (canvases && canvases.length > 0) { - canvases.reduce(reducer, []).then((downloadLinks) => { - this.setState({ downloadLinks }); + canvases.reduce(reducer, []).then((exportLinks) => { + this.setState({ exportLinks }); }); } } @@ -56,36 +56,36 @@ class AnnotationDownloadDialog extends Component { /** */ closeDialog() { const { handleClose } = this.props; - this.setState({ downloadLinks: [] }); + this.setState({ exportLinks: [] }); handleClose(); } /** */ render() { const { handleClose, open } = this.props; - const { downloadLinks } = this.state; + const { exportLinks } = this.state; return ( <Dialog - aria-labelledby="annotation-download-dialog-title" - id="annotation-download-dialog" + aria-labelledby="annotation-export-dialog-title" + id="annotation-export-dialog" onClose={handleClose} onEscapeKeyDown={this.closeDialog} open={open} > - <DialogTitle id="annotation-download-dialog-title" disableTypography> - <Typography variant="h2">Download Annotations</Typography> + <DialogTitle id="annotation-export-dialog-title" disableTypography> + <Typography variant="h2">Export Annotations</Typography> </DialogTitle> <DialogContent> - { downloadLinks === undefined || downloadLinks.length === 0 ? ( + { exportLinks === undefined || exportLinks.length === 0 ? ( <Typography variant="body1">No annotations stored yet.</Typography> ) : ( <List> - { downloadLinks.map((dl) => ( + { exportLinks.map((dl) => ( <ListItem button component="a" key={dl.canvasId} - aria-label={`Download annotations for ${dl.label}`} + aria-label={`Export annotations for ${dl.label}`} href={dl.url} download={`${dl.id}.json`} > @@ -93,7 +93,7 @@ class AnnotationDownloadDialog extends Component { <GetAppIcon /> </ListItemIcon> <ListItemText> - {`Download annotations for "${dl.label}"`} + {`Export annotations for "${dl.label}"`} </ListItemText> </ListItem> ))} @@ -105,7 +105,7 @@ class AnnotationDownloadDialog extends Component { } } -AnnotationDownloadDialog.propTypes = { +AnnotationExportDialog.propTypes = { canvases: PropTypes.arrayOf( PropTypes.shape({ id: PropTypes.string, index: PropTypes.number }), ).isRequired, @@ -118,4 +118,4 @@ AnnotationDownloadDialog.propTypes = { open: bool.isRequired, }; -export default AnnotationDownloadDialog; +export default AnnotationExportDialog; diff --git a/src/plugins/miradorAnnotationPlugin.js b/src/plugins/miradorAnnotationPlugin.js index 96a877de66a1234a705f659e04b7fbf5a3ae5804..56201337a95b04c71edc6d061b31e783a15b3091 100644 --- a/src/plugins/miradorAnnotationPlugin.js +++ b/src/plugins/miradorAnnotationPlugin.js @@ -5,7 +5,7 @@ import AddBoxIcon from '@material-ui/icons/AddBox'; 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 AnnotationExportDialog from '../AnnotationExportDialog'; import LocalStorageAdapter from '../LocalStorageAdapter'; /** */ @@ -14,10 +14,10 @@ class MiradorAnnotation extends Component { constructor(props) { super(props); this.state = { - annotationDownloadDialogOpen: false, + annotationExportDialogOpen: false, }; this.openCreateAnnotationCompanionWindow = this.openCreateAnnotationCompanionWindow.bind(this); - this.toggleCanvasDownloadDialog = this.toggleCanvasDownloadDialog.bind(this); + this.toggleCanvasExportDialog = this.toggleCanvasExportDialog.bind(this); } /** */ @@ -32,10 +32,10 @@ class MiradorAnnotation extends Component { } /** */ - toggleCanvasDownloadDialog(e) { - const { annotationDownloadDialogOpen } = this.state; + toggleCanvasExportDialog(e) { + const { annotationExportDialogOpen } = this.state; const newState = { - annotationDownloadDialogOpen: !annotationDownloadDialogOpen, + annotationExportDialogOpen: !annotationExportDialogOpen, }; this.setState(newState); } @@ -45,10 +45,10 @@ class MiradorAnnotation extends Component { const { canvases, config, TargetComponent, targetProps, } = this.props; - const { annotationDownloadDialogOpen } = this.state; + const { annotationExportDialogOpen } = this.state; const storageAdapter = config.annotation && config.annotation.adapter('poke'); - const offerDownloadDialog = config.annotation && storageAdapter instanceof LocalStorageAdapter - && config.annotation.downloadLocalStorageAnnotations; + const offerExportDialog = config.annotation && storageAdapter instanceof LocalStorageAdapter + && config.annotation.exportLocalStorageAnnotations; return ( <div> <TargetComponent @@ -61,21 +61,21 @@ class MiradorAnnotation extends Component { > <AddBoxIcon /> </MiradorMenuButton> - { offerDownloadDialog && ( + { offerExportDialog && ( <MiradorMenuButton - aria-label="Download local annotations for visible items" - onClick={this.toggleCanvasDownloadDialog} + aria-label="Export local annotations for visible items" + onClick={this.toggleCanvasExportDialog} size="small" > <GetAppIcon /> </MiradorMenuButton> )} - { offerDownloadDialog && ( - <AnnotationDownloadDialog + { offerExportDialog && ( + <AnnotationExportDialog canvases={canvases} config={config} - handleClose={this.toggleCanvasDownloadDialog} - open={annotationDownloadDialogOpen} + handleClose={this.toggleCanvasExportDialog} + open={annotationExportDialogOpen} /> )} </div> @@ -91,7 +91,7 @@ MiradorAnnotation.propTypes = { config: PropTypes.shape({ annotation: PropTypes.shape({ adapter: PropTypes.func, - downloadLocalStorageAnnotations: PropTypes.bool, + exportLocalStorageAnnotations: PropTypes.bool, }), }).isRequired, TargetComponent: PropTypes.oneOfType([