import React from 'react'; import './App.css'; class Album extends React.Component { constructor(props) { super(props); this.state = { error: null, media_items: null, }; } componentDidMount() { let {album} = this.props; fetch(process.env.PUBLIC_URL + `/photosync/${album}/album.json`) .then(res => res.json()) .then( (result) => this.setState({media_items: result}), (error) => this.setState({error}), ); } render() { let {album} = this.props; let {error, media_items} = this.state; console.log(this.state); if (error !== null) { return

Error: {JSON.stringify(error)}

; } else if (media_items !== null) { console.log(media_items); return media_items.map((mi) => { // TODO(wathiede): use coverPhotoMediaItemId and fetch from a // locally cached image. return
{

{ mi.filename}

}); } else { return

Loading...

; } } } class AlbumIndex extends React.Component { constructor(props) { super(props); this.state = { error: null, albums: null, }; } componentDidMount() { fetch(process.env.PUBLIC_URL + "/photosync/albums.json") .then(res => res.json()) .then( (result) => this.setState({albums: result}), (error) => this.setState({error}), ); } render() { let {error, albums} = this.state; if (error !== null) { return

Error: {JSON.stringify(error)}

; } else if (albums !== null) { console.log(albums); return albums.map((a) => { let img = unset; if (a.coverPhotoBaseUrl !== undefined) { img = {; } let figure =
{img}
{ a.title || "No title" } - { a.mediaItemsCount || 0 } photos
; return { figure } }); } else { return

Loading...

; } } } class App extends React.Component { constructor(props) { super(props); this.state = { curAlbum: window.location.hash, }; } render() { let {curAlbum} = this.state; console.log(this.state); let content; if (curAlbum) { content = } else { content = ; } return (
{ content }
); } } export default App;