@@ -4,46 +4,51 @@ import React, { useEffect } from "react";
44import mirador from "mirador" ;
55import miradorAnnotationPlugin from "mirador-annotations" ;
66import LocalStorageAdapter from "mirador-annotations/lib/LocalStorageAdapter" ;
7+ import { VisualizationConfigOut } from "../../../openapi/v2" ;
78
89type WSIProps = {
9- fileId ?: string ;
10- visualizationId ?: string ;
11- publicView ?: boolean ;
10+ visConfigEntry ?: VisualizationConfigOut ;
1211} ;
1312
1413export default function WSI ( props : WSIProps ) {
15- const { fileId, visualizationId, publicView } = props ;
16-
17- const config = {
18- annotation : {
19- adapter : ( canvasId ) =>
20- new LocalStorageAdapter ( `localStorage://?canvasId=${ canvasId } ` ) ,
21- } ,
22- id : "mirador-container" ,
23- window : {
24- sideBarOpen : true ,
25- defaultSideBarPanel : "annotations" ,
26- } ,
27- workspace : {
28- type : "mosaic" ,
29- height : 1000 ,
30- } ,
31- workspaceControlPanel : {
32- enabled : false ,
33- } ,
34- windows : [
35- {
36- manifestId :
37- "http://localhost:8002/iiif-presentation-server/manifest.json" ,
38- allowClose : true ,
39- } ,
40- ] ,
41- } ;
42- const plugins = [ miradorAnnotationPlugin ] ;
14+ const { visConfigEntry } = props ;
4315
4416 useEffect ( ( ) => {
45- mirador . viewer ( config , plugins ) ;
46- } , [ visualizationId , fileId , publicView , config , plugins ] ) ;
17+ if ( visConfigEntry !== undefined ) {
18+ if (
19+ visConfigEntry . parameters &&
20+ visConfigEntry . parameters [ "manifestId" ]
21+ ) {
22+
23+ const config = {
24+ annotation : {
25+ adapter : ( canvasId ) =>
26+ new LocalStorageAdapter ( `localStorage://?canvasId=${ canvasId } ` ) ,
27+ } ,
28+ id : "mirador-container" ,
29+ window : {
30+ allowFullscreen : true ,
31+ } ,
32+ workspace : {
33+ type : "mosaic" ,
34+ height : 400 ,
35+ } ,
36+ workspaceControlPanel : {
37+ enabled : false ,
38+ } ,
39+ windows : [
40+ {
41+ manifestId : visConfigEntry . parameters [ "manifestId" ] ,
42+ allowClose : true ,
43+ } ,
44+ ] ,
45+ } ;
46+ const plugins = [ miradorAnnotationPlugin ] ;
47+
48+ mirador . viewer ( config , plugins ) ;
49+ }
50+ }
51+ } , [ visConfigEntry ] ) ;
4752
48- return < div id = "mirador-container" /> ;
53+ return < div id = "mirador-container" style = { { width : "450px" , height : "400px" , position : "relative" } } /> ;
4954}
0 commit comments