summaryrefslogtreecommitdiff
path: root/lib/awprint/client/components/App.jsx
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-06-01 16:40:39 -0400
committerJules Laplace <julescarbon@gmail.com>2017-06-01 16:40:39 -0400
commit1f9253253e1914fb09ec0b54201ad934870782d8 (patch)
tree971bfb4fe52f148be562e578f50fd550fc931aab /lib/awprint/client/components/App.jsx
parentfb2bff393b7a5415fcdbeafa6413166be6451342 (diff)
very basic print client
Diffstat (limited to 'lib/awprint/client/components/App.jsx')
-rw-r--r--lib/awprint/client/components/App.jsx35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/awprint/client/components/App.jsx b/lib/awprint/client/components/App.jsx
new file mode 100644
index 0000000..46886a3
--- /dev/null
+++ b/lib/awprint/client/components/App.jsx
@@ -0,0 +1,35 @@
+import React from 'react'
+
+export default class App extends React.Component {
+ constructor(props) {
+ super()
+ this.state = {
+ prints: []
+ }
+ fetch('/_services/awprint/index')
+ .then( res => {
+ return res.json()
+ }).then( prints => {
+ this.setState({ prints })
+ }).catch( e => {
+ console.error(e)
+ })
+ }
+ render() {
+ const prints = this.state.prints.map( (print,i) => {
+ const className = print.printed ? 'print printed' : 'print'
+ const date = print.date.replace(/T/,' - ').replace(/:\d\d\..*/,'')
+ return (
+ <div key={i} className={className} onClick={() => this.print(print)}>
+ <img src={print.url} />
+ <div className='date'>{date}</div>
+ </div>
+ )
+ })
+ return (
+ <div>
+ {prints}
+ </div>
+ )
+ }
+} \ No newline at end of file