(window.webpackJsonp=window.webpackJsonp||[]).push([[58],{"To4/":function(e,r,t){"use strict";t.r(r);var n=t("q1tI"),s=t.n(n),a=t("yE/o"),o=t("gaPq"),l=t("KQm4"),u=t("rePB"),i=t("h4VS"),c=t("eHHv"),f=t("lTCR"),d=t.n(f),p=t("0dmp"),h=t("ikXu"),w=t("QetY"),b=t("D1pA"),g=t("NrgV"),m=t("MqQV"),O=t("RotF"),y=t.n(O),j=t("YFqc"),v=t.n(j),G=s.a.createElement;function S(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function P(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?S(Object(t),!0).forEach((function(r){Object(u.a)(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):S(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function M(){var e=Object(i.a)(["\n  query users($offset: Int, $limit: Int, $includeGuests: Boolean) {\n    users(offset: $offset, limit: $limit, includeGuests: $includeGuests) {\n      _id\n      isGuest\n      primaryEmail {\n        address\n        verified\n      }\n      tags\n      name\n    }\n  }\n"]);return M=function(){return e},e}var E=d()(M()),_=Object(c.a)(Object(c.h)("hasMore","updateHasMore",!0),Object(c.h)("isShowGuests","setShowGuests",!1),Object(c.f)({toggleShowGuests:function(e){var r=e.isShowGuests,t=e.updateHasMore,n=e.setShowGuests;return function(){n(!r),t(!0)}}}),Object(p.a)(E,{options:function(e){return{variables:{includeGuests:e.isShowGuests,offset:0,limit:10}}},props:function(e){var r=e.data,t=r.loading,n=r.users,s=r.fetchMore,a=e.ownProps,o=a.updateHasMore,u=a.isShowGuests;return{loading:t,users:n,loadMoreEntries:function(){return s({variables:{includeGuests:u,offset:10*Math.floor(n.length/10),limit:10},updateQuery:function(e,r){var t=r.fetchMoreResult;if(!t||0===t.users.length)return o(!1),e;var n=t.users[0]._id;return e.users.reduce((function(e,r){return r._id===n||e}),!1)?(o(!1),e):P(P({},e),{},{users:[].concat(Object(l.a)(e.users),Object(l.a)(t.users))})}})}}}}))((function(e){var r=e.users,t=e.loadMoreEntries,n=e.hasMore,s=e.isShowGuests,a=e.toggleShowGuests;return G(h.a,{celled:!0},G(h.a.Header,null,G(h.a.Row,null,G(h.a.HeaderCell,{colSpan:3},"Show guests? \xa0",G("input",{type:"checkbox",checked:s,onChange:a}),G(v.a,{href:"/users/new"},G(w.a,{floated:"right",icon:!0,labelPosition:"left",primary:!0,size:"small",href:"/users/new"},G(b.a,{name:"plus"}),"New User")))),G(h.a.Row,null,G(h.a.HeaderCell,null,"E-Mail Address"),G(h.a.HeaderCell,null,"Name"),G(h.a.HeaderCell,null,"User Type"))),r&&G(y.a,{pageStart:0,element:"tbody",loadMore:t,hasMore:n,loader:G(h.a.Row,{key:"user-loader"},G(h.a.Cell,{colSpan:"4"},G(g.a,{active:!0,inline:"centered"})))},r.map((function(e){var r=e.name,t=e._id,n=e.tags,s=e.primaryEmail,a=e.isGuest;return G(h.a.Row,{key:t},G(h.a.Cell,null,G(v.a,{href:"/users/edit?_id=".concat(t)},G("a",{href:"/users/edit?_id=".concat(t)},s&&s.address))),G(h.a.Cell,null,r,"\xa0",n&&n.length>0&&n.map((function(e){return G(m.a,{key:e,color:"grey",horizontal:!0},e)}))),G(h.a.Cell,null,a?G(m.a,{color:"orange",horizontal:!0},"Guest"):G(m.a,{color:s&&s.verified?"green":"red",horizontal:!0},s&&s.verified?"Verified":"Unverified")))}))),G(h.a.Footer,{fullWidth:!0},G(h.a.Row,null,G(h.a.HeaderCell,{colSpan:"4"},G(v.a,{href:"/users/new"},G(w.a,{floated:"right",icon:!0,labelPosition:"left",primary:!0,size:"small",href:"/users/new"},G(b.a,{name:"plus"}),"New User"))))))})),C=t("PZVx"),H=s.a.createElement;r.default=Object(C.a)((function(e){return H(o.a,e,H(a.a,null,H("h1",null,"All users"),H(_,null)))}))},bucJ:function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/users",function(){return t("To4/")}])}},[["bucJ",0,2,5,1,3,4,7]]]);