@@ -15,14 +15,14 @@ import {
1515 ShareURL ,
1616 ShareURLActions ,
1717} from "@/components/Work/ActionsDialog/DownloadAndShare.styled" ;
18-
1918import { Label , Thumbnail } from "@samvera/nectar-iiif" ;
2019import React , { useEffect , useState } from "react" ;
2120import {
2221 getAnnotationBodyType ,
2322 getInfoResponse ,
2423} from "@/lib/iiif/manifest-helpers" ;
2524import { makeBlob , mimicDownload } from "@samvera/image-downloader" ;
25+
2626import ActionsDialogAside from "@/components/Work/ActionsDialog/Aside" ;
2727import Announcement from "@/components/Shared/Announcement" ;
2828import CopyText from "@/components/Shared/CopyText" ;
@@ -37,13 +37,32 @@ import { useWorkState } from "@/context/work-context";
3737const embedWarningMessage =
3838 "Embed is not available for works restricted to the Northwestern University community" ;
3939
40+ function MiradorLink ( {
41+ showWarning,
42+ manifestId,
43+ } : {
44+ showWarning : boolean ;
45+ manifestId : string ;
46+ } ) {
47+ return showWarning ? (
48+ < span > View in Mirador</ span >
49+ ) : (
50+ < a
51+ href = { `https://projectmirador.org/embed/?iiif-content=${ manifestId } ` }
52+ target = "_blank"
53+ >
54+ View in Mirador
55+ </ a >
56+ ) ;
57+ }
58+
4059const DownloadAndShare : React . FC = ( ) => {
4160 const { workState } = useWorkState ( ) ;
4261 const { manifest, work } = workState ;
4362 const [ imageCanvases , setImageCanvases ] = useState < Canvas [ ] > ( [ ] ) ;
4463 const router = useRouter ( ) ;
4564 const isSharedLinkPage = router . pathname . includes ( "/shared" ) ;
46- const { isUserLoggedIn, isWorkInstitution, isWorkRestricted } =
65+ const { isUserLoggedIn, isWorkInstitution, isWorkPrivate , isWorkRestricted } =
4766 useWorkAuth ( work ) ;
4867
4968 const showEmbedWarning = Boolean (
@@ -98,13 +117,22 @@ const DownloadAndShare: React.FC = () => {
98117 < a href = "https://iiif.io/get-started/why-iiif/" target = "_blank" >
99118 What is IIIF?
100119 </ a >
101- < a
102- href = { `https://projectmirador.org/embed/?iiif-content=${ manifest . id } ` }
103- target = "_blank"
104- >
105- View in Mirador
106- </ a >
120+ < MiradorLink
121+ showWarning = { isWorkInstitution || isWorkPrivate }
122+ manifestId = { manifest . id }
123+ />
107124 </ ShareURLActions >
125+ { ( isWorkInstitution || isWorkPrivate ) && (
126+ < Announcement
127+ css = { {
128+ marginTop : "1rem" ,
129+ } }
130+ data-testid = "mirador-announcement"
131+ >
132+ Opening in external tools like Mirador is not supported for works
133+ that require authentication.
134+ </ Announcement >
135+ ) }
108136 </ ShareURL >
109137 </ >
110138 ) }
0 commit comments