(props: ExportProps)
| 265 | } |
| 266 | |
| 267 | export function SnapshotExport(props: ExportProps) { |
| 268 | return ( |
| 269 | <controls.Dialog |
| 270 | hidden={false} |
| 271 | onDismiss={props.onDismiss} |
| 272 | dialogContentProps={{ |
| 273 | className: `sanddance-dialog ${props.theme} sanddance-export`, |
| 274 | type: base.fluentUI.DialogType.normal, |
| 275 | title: strings.dialogTitleSnapshotsExport, |
| 276 | }} |
| 277 | > |
| 278 | <ul> |
| 279 | <li> |
| 280 | <strong>{strings.labelSnapshotsExportHTMLTitle}</strong> |
| 281 | <div> |
| 282 | {strings.labelSnapshotsExportHTMLDescription} |
| 283 | </div> |
| 284 | <base.fluentUI.PrimaryButton |
| 285 | iconProps={{ iconName: 'Download' }} |
| 286 | text={`${strings.buttonExport} ${strings.labelSnapshotsExportHTMLTitle}`} |
| 287 | onClick={e => { |
| 288 | const clean = cleanSnapshots(props.snapshots); |
| 289 | const html = getEmbedHTML(props.explorer.state.dataContent.data, props.dataSource.displayName, clean); |
| 290 | downloadData(html, `${props.dataSource.displayName}.html`); |
| 291 | }} |
| 292 | /> |
| 293 | </li> |
| 294 | <li> |
| 295 | <strong>{strings.labelSnapshotsExportMarkdownTitle}</strong> |
| 296 | <div> |
| 297 | {strings.labelSnapshotsExportMarkdownDescription} |
| 298 | </div> |
| 299 | <base.fluentUI.PrimaryButton |
| 300 | iconProps={{ iconName: 'Download' }} |
| 301 | text={`${strings.buttonExport} ${strings.labelSnapshotsExportMarkdownTitle}`} |
| 302 | onClick={e => { |
| 303 | const sections = props.snapshots.map(snapshot => { |
| 304 | const section = [`## ${snapshot.title}`]; |
| 305 | section.push(snapshot.description); |
| 306 | section.push('\n'); |
| 307 | const url = `${location.origin}/#${encodeURIComponent(serializeSnapshot(snapshot))}`; |
| 308 | section.push(markdownImageLink(snapshot.title, snapshot.image, url)); |
| 309 | return section.join('\n'); |
| 310 | }); |
| 311 | sections.unshift(`# ${props.dataSource.displayName}`); |
| 312 | downloadData(sections.join('\n\n'), `${props.dataSource.displayName}.snapshots.md`); |
| 313 | }} |
| 314 | /> |
| 315 | </li> |
| 316 | </ul> |
| 317 | </controls.Dialog> |
| 318 | ); |
| 319 | } |
nothing calls this directly
no test coverage detected