@cocalc/static
Version:
CoCalc's static frontend Webpack-based build system and framework
1 lines • 5.44 kB
JavaScript
"use strict";(self.webpackChunk_cocalc_static=self.webpackChunk_cocalc_static||[]).push([[872],{872:(t,e,r)=>{r.r(e),r.d(e,{User:()=>j,recreate_users_table:()=>_});var n=r(36414),o=r(84087),a=r(32295),i=r(99261);function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function s(t,e){return!e||"object"!==l(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function p(t,e){return p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},p(t,e)}var l=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&p(t,e)}(f,t);var e,i,l=(e=f,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=u(e);if(i){var n=u(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return s(this,t)});function f(){return c(this,f),l.apply(this,arguments)}var _=f.prototype;return _.query=function(){var t=a.redux.getStore("page").get("kiosk_project_id");if(t){var e=r(22797).parse_query("collaborators_one_project");return e.collaborators_one_project[0].project_id=t,e}return"collaborators"},_.no_changefeed=function(){return null!=a.redux.getStore("page").get("kiosk_project_id")},_._change=function(t,e){var r=t.get(),a=o.h.get("user_map");if(null==a)return n.N.setState({user_map:r});t.get().map((function(t,e){return t!==a.get(e)&&(a=a.set(e,t)),!1})),n.N.setState({user_map:a})},f}(a.Table);function _(){a.redux.removeTable("users"),a.redux.createTable("users",f)}i.s&&null==a.redux.getStore("page").get("kiosk_project_id")||a.redux.createTable("users",f);var h=r(19990),m=r(24620),d=r(85733),y=r(63505);function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function b(t){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},b(t)}function g(t,e){return!e||"object"!==O(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function w(t,e){return w=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},w(t,e)}var O=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};var j=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&w(t,e)}(a,t);var e,r,o=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=b(e);if(r){var o=b(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return g(this,t)});function a(){return v(this,a),o.apply(this,arguments)}var i=a.prototype;return i.shouldComponentUpdate=function(t){if(this.props.account_id!==t.account_id)return!0;var e=null!=t.user_map?t.user_map.get(this.props.account_id):void 0;return null==e||!e.equals(null!=this.props.user_map?this.props.user_map.get(this.props.account_id):void 0)||this.props.last_active!==t.last_active||this.props.show_original!==t.show_original||this.props.name!==t.name},i.render_last_active=function(){if(this.props.last_active)return y.createElement("span",null," ","(",y.createElement(h.TimeAgo,{date:this.props.last_active}),")")},i.render_original=function(t){var e;if(e=t.first_name&&t.last_name?t.first_name+" "+t.last_name:t.first_name?t.first_name:t.last_name?t.last_name:"No Name",this.props.show_original&&e!==this.props.name)return y.createElement(h.Tip,{placement:"top",title:"User Name",tip:"The name this user has given their account."},y.createElement("span",{style:{color:"#666"}}," (",e,")"))},i.name=function(t){return(0,m.trunc_middle)(null!=this.props.name?this.props.name:"".concat(t.first_name," ").concat(t.last_name),50).trim()||"No Name"},i.render=function(){if(null==this.props.user_map||0===this.props.user_map.size)return y.createElement("span",null,"Loading...");var t=null!=this.props.user_map?this.props.user_map.get(this.props.account_id):void 0;if(null==t)return(0,m.is_valid_uuid_string)(this.props.account_id)?(n.N.fetch_non_collaborator(this.props.account_id),y.createElement("span",null,"Loading...")):y.createElement("span",null,"Unknown User ",this.props.account_id);t=t.toJS();var e=this.name(t);return y.createElement("span",null,this.props.show_avatar&&y.createElement(y.Fragment,null,y.createElement(d.q,{account_id:this.props.account_id,first_name:e}),y.createElement(h.Space,null)),e,this.render_original(t),this.render_last_active())},a}(a.Component)}}]);