_N_E=(window.webpackJsonp_N_E=window.webpackJsonp_N_E||[]).push([[50],{Kpik:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/products",function(){return r("q2dU")}])},q2dU:function(e,t,r){"use strict";r.r(t);var n=r("q1tI"),a=r.n(n),o=r("yE/o"),l=r("gaPq"),u=r("KQm4"),c=r("rePB"),i=r("h4VS"),s=r("eHHv"),d=r("lTCR"),p=r.n(d),f=r("0dmp"),h=r("nOHt"),b=r("ikXu"),g=r("QetY"),w=r("D1pA"),O=r("NrgV"),m=r("MqQV"),y=r("RotF"),_=r.n(y),j=r("YFqc"),P=r.n(j),v=r("RzSe"),E=a.a.createElement;function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function k(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach((function(t){Object(c.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function H(){var e=Object(i.a)(["\n  query getAllProducts($offset: Int, $limit: Int) {\n    products(offset: $offset, limit: $limit, includeDrafts: true) {\n      _id\n      tags\n      status\n      texts {\n        _id\n        slug\n        title\n      }\n    }\n  }\n"]);return H=function(){return e},e}var M=p()(H()),R=Object(s.a)(Object(s.h)("hasMore","updateHasMore",!0),h.withRouter,Object(f.a)(M,{options:function(){return{variables:{offset:0,limit:10}}},props:function(e){var t=e.data,r=t.loading,n=t.products,a=t.fetchMore,o=e.ownProps.updateHasMore;return{loading:r,products:n,loadMoreEntries:function(){return a({variables:{offset:n.length,limit:10},updateQuery:function(e,t){var r=t.fetchMoreResult;if(!r||0===r.products.length)return o(!1),e;var n=r.products[0]._id;return e.products.reduce((function(e,t){return t._id===n||e}),!1)?(o(!1),e):k(k({},e),{},{products:[].concat(Object(u.a)(e.products),Object(u.a)(r.products))})}})}}}}),s.e)((function(e){var t=e.products,r=e.loadMoreEntries,n=e.hasMore,a=e.router;return E(b.a,{celled:!0},E(b.a.Header,null,E(b.a.Row,null,E(b.a.HeaderCell,{colSpan:"3"},E(v.a,{onChange:function(e,t){a.push({pathname:"/products/edit",query:{_id:t.value}})}}),E(P.a,{href:"/products/new"},E(g.a,{floated:"right",icon:!0,labelPosition:"left",primary:!0,size:"small",href:"/products/new"},E(w.a,{name:"plus"}),"Add")))),E(b.a.Row,null,E(b.a.HeaderCell,null,"Name"),E(b.a.HeaderCell,null,"Active"),E(b.a.HeaderCell,null,"Tags"))),t&&E(_.a,{element:"tbody",loadMore:r,hasMore:n,loader:E(b.a.Row,{key:"product-loader"},E(b.a.Cell,{colSpan:"4"},E(O.a,{active:!0,inline:"centered"})))},t.map((function(e){return E(b.a.Row,{key:e._id},E(b.a.Cell,null,E(P.a,{href:"/products/edit?_id=".concat(e._id)},E("a",{href:"/products/edit?_id=".concat(e._id)},e.texts.title))),E(b.a.Cell,null,"ACTIVE"===e.status&&E(w.a,{color:"green",name:"checkmark",size:"large"})),E(b.a.Cell,null,e.tags&&e.tags.length>0&&e.tags.map((function(e){return E(m.a,{key:e,color:"grey",horizontal:!0},e)}))))}))),E(b.a.Footer,{fullWidth:!0},E(b.a.Row,null,E(b.a.HeaderCell,{colSpan:"3"},E(P.a,{href:"/products/new"},E(g.a,{floated:"right",icon:!0,labelPosition:"left",primary:!0,size:"small",href:"/products/new"},E(w.a,{name:"plus"}),"Add"))))))})),q=r("PZVx"),N=a.a.createElement;t.default=Object(q.a)((function(e){return N(l.a,e,N(o.a,null,N("h2",null,"Products"),N(R,null)))}))}},[["Kpik",0,2,5,12,1,3,4,7,13]]]);