@@ -4,23 +4,14 @@ import { Component } from "react";
44import { withTranslation } from "react-i18next" ;
55import { withRouter } from "react-router" ;
66import { Link } from "react-router-dom" ;
7- import { createExportProjectJsonFile } from "../../../Utils/utils " ;
7+ import { Exporter } from "../../Exporter/Exporter " ;
88
99class Navbar extends Component {
1010 constructor ( props ) {
1111 super ( props ) ;
1212 }
1313
14- exportIIIF = ( ) => {
15- this . props . exportIIIF ( )
16- . then ( manifest => {
17- const dataStr = "data:text/json;charset=utf-8," + encodeURIComponent ( JSON . stringify ( manifest , null , 4 ) ) ;
18- const elt = document . getElementById ( 'downloadAnchorElem' ) ;
19- elt . setAttribute ( "href" , dataStr ) ;
20- elt . setAttribute ( "download" , `${ this . props . selectedProject . title } .json` ) ;
21- elt . click ( ) ;
22- } )
23- }
14+
2415 render ( ) {
2516 return (
2617 < div className = "navbar bg-base-300 text-neutral-content" >
@@ -30,7 +21,7 @@ class Navbar extends Component {
3021 } } >
3122 < h1 > ADNO</ h1 >
3223 </ Link >
33-
24+
3425
3526 < strong className = "ms-3 text-neutral" style = { {
3627 maxWidth : 400 ,
@@ -71,54 +62,9 @@ class Navbar extends Component {
7162 }
7263
7364 < div className = "ms-auto flex items-center gap-2" >
74- { /* // Display a modal to download and share the current project */ }
75- < div className = "tooltip tooltip-bottom z-50" data-tip = { this . props . t ( 'navbar.download_project' ) } >
76- < button className = "btn navbar-button btn-neutral" >
77- < label htmlFor = "my-modal" style = { { "background" : "none" , "border" : "none" } } >
78- < FontAwesomeIcon icon = { faDownload } size = "xl" /> </ label >
79- </ button >
80- </ div >
81-
82- < input type = "checkbox" id = "my-modal" className = "modal-toggle" />
83- < div className = "modal" >
84- < div className = "modal-box" style = { { "color" : "initial" } } >
85- < label className = "btn btn-square btn-sm"
86- htmlFor = "my-modal"
87- style = { {
88- position : 'absolute' ,
89- top : 12 ,
90- right : 12
91- } } >
92- < svg xmlns = "http://www.w3.org/2000/svg" className = "h-6 w-6" fill = "none" viewBox = "0 0 24 24" stroke = "currentColor" > < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = "2" d = "M6 18L18 6M6 6l12 12" /> </ svg >
93- </ label >
94- < h3 className = "font-bold text-lg" > { this . props . t ( 'navbar.share_project' ) } </ h3 >
95- < p className = "py-4" > { this . props . t ( 'navbar.share_project_desc1' ) } </ p >
96- < p className = "pb-4" > { this . props . t ( 'navbar.share_project_desc2' ) } </ p >
97- < p className = "pb-4" > { this . props . t ( 'navbar.share_project_desc3' ) }
98- < a className = "adno-link" href = "https://adno.app/" target = "_blank" > < FontAwesomeIcon icon = { faExternalLink } size = "lg" /> </ a >
99- </ p >
100- < p className = "my-3 text-center font-bold" > { this . props . t ( 'navbar.export_project_to' ) } </ p >
101- < div className = "flex gap-3 justify-center items-center" >
102- < label className = "btn btn-success" >
103- { this . props . selectedProject &&
104- this . props . selectedProject . id &&
105- < a id = { "download_btn_" + this . props . selectedProject . id }
106- href = { createExportProjectJsonFile ( this . props . selectedProject . id ) }
107- download = { this . props . selectedProject . title + ".json" }
108- title = { this . props . t ( 'navbar.download_project' ) } >
109- Adno
110- { /* <FontAwesomeIcon icon={faDownload} size="lg" /> */ }
111- </ a > }
112- </ label >
113- ou
114- < label className = "btn btn-success" onClick = { this . exportIIIF } >
115- { this . props . t ( 'navbar.export_project_to_iiif' ) } < span className = "badge badge-md ms-2" > BETA</ span >
116- </ label >
117- </ div >
118- < a id = "downloadAnchorElem" className = "hidden" > </ a >
119- </ div >
120- </ div >
121-
65+ < Exporter translate = { this . props . t }
66+ selectedProject = { this . props . selectedProject }
67+ exportIIIF = { this . props . exportIIIF } />
12268
12369 < div className = "tooltip tooltip-bottom z-50 ms-auto" data-tip = { this . props . editMode ? this . props . t ( 'navbar.edit_project' ) : this . props . t ( 'navbar.show_metadatas' ) } >
12470 < button
0 commit comments