Skip to content
Snippets Groups Projects
Commit 0a82c70a authored by Lutz Helm's avatar Lutz Helm
Browse files

Rephrase some localstorage download terms

parent 38ccf333
Branches
No related tags found
No related merge requests found
......@@ -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: {
......
......@@ -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>
))}
......
......@@ -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([
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment