From 1f9253253e1914fb09ec0b54201ad934870782d8 Mon Sep 17 00:00:00 2001
From: Jules Laplace <julescarbon@gmail.com>
Date: Thu, 1 Jun 2017 16:40:39 -0400
Subject: very basic print client

---
 lib/awprint/client/components/App.jsx | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 lib/awprint/client/components/App.jsx

(limited to 'lib/awprint/client/components/App.jsx')

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
-- 
cgit v1.2.3-70-g09d2

