()
| 222 | } |
| 223 | |
| 224 | render() { |
| 225 | const theme = this.state.darkTheme ? 'dark-theme' : ''; |
| 226 | const dataSourceProps: DataSourceProps = { |
| 227 | dataSource: this.state.dataSource, |
| 228 | dataSources: this.props.dataSources, |
| 229 | changeDataSource: (dataSource: DataSource) => { |
| 230 | document.location.hash = ''; |
| 231 | return this.load(dataSource).then(() => { |
| 232 | if (this.postLoad) { |
| 233 | this.postLoad(dataSource); |
| 234 | this.postLoad = null; |
| 235 | } |
| 236 | }).catch(() => this.loadError(dataSource)); |
| 237 | }, |
| 238 | }; |
| 239 | return ( |
| 240 | <section className="sanddance-app"> |
| 241 | <Explorer |
| 242 | logoClickTarget="_self" |
| 243 | logoClickUrl="/SandDance/" |
| 244 | theme={theme} |
| 245 | snapshotProps={{ |
| 246 | modifySnapShot: (snapshot: DataSourceSnapshot) => { |
| 247 | snapshot.dataSource = this.state.dataSource; |
| 248 | }, |
| 249 | getTopActions: snapshots => { |
| 250 | const items: FluentUITypes.IContextualMenuItem[] = [ |
| 251 | { |
| 252 | key: 'import', |
| 253 | text: strings.menuSnapshotsImport, |
| 254 | subMenuProps: { |
| 255 | items: [ |
| 256 | { |
| 257 | key: 'import-local', |
| 258 | text: strings.menuLocal, |
| 259 | onClick: () => this.setState({ dialogMode: 'import-local' }), |
| 260 | }, |
| 261 | { |
| 262 | key: 'import-remote', |
| 263 | text: strings.menuUrl, |
| 264 | onClick: () => this.setState({ dialogMode: 'import-remote' }), |
| 265 | }, |
| 266 | ], |
| 267 | }, |
| 268 | }, |
| 269 | { |
| 270 | key: 'export', |
| 271 | text: strings.menuSnapshotsExportAsJSON, |
| 272 | disabled: snapshots.length === 0, |
| 273 | onClick: () => downloadSnapshotsJSON(snapshots, `${this.state.dataSource.displayName}.snapshots`), |
| 274 | }, |
| 275 | { |
| 276 | key: 'export-as', |
| 277 | text: strings.menuSnapshotsExportAs, |
| 278 | disabled: snapshots.length === 0, |
| 279 | onClick: () => this.setState({ dialogMode: 'export' }), |
| 280 | }, |
| 281 | ]; |
no test coverage detected