@corva/ui 0.34.0-2 → 0.34.0-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Attachment/index.js +1 -1
- package/components/FeedItem/FeedItemEditProvider/FeedItemEditModal.js +1 -1
- package/components/FeedItem/feedItemTypes/CompletionDocumentFeedItem.js +1 -1
- package/components/FeedItem/feedItemTypes/DocumentFeedItem.js +1 -1
- package/components/FeedItem/feedItemTypes/PostFeedItem.js +1 -1
- package/components/FeedItem/feedItemTypes/TracesMemoFeedItem.js +1 -1
- package/components/PostPreviewDialog/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"@babel/runtime/helpers/defineProperty";import"lodash";import"../../constants/completion.js";import"../../constants/alerts.js";import e from"@babel/runtime/helpers/slicedToArray";import"../../constants/goals.js";import"../../constants/segment.js";import"../../constants/apps.js";import"../../constants/drillstring.js";import"../../constants/notifications.js";import"../../constants/feed.js";import"@babel/runtime/regenerator";import"@babel/runtime/helpers/asyncToGenerator";import t from"@material-ui/core/colors/grey";import a from"../../utils/main.js";import{isNativeDetected as i}from"../../utils/mobileDetect.js";import{getIsImage as o,getIsVideo as r}from"../../utils/fileExtension.js";import{jsx as l,jsxs as n,Fragment as s}from"react/jsx-runtime";import{Dialog as m}from"@material-ui/core";import{useState as c,useCallback as d}from"react";import"querystring";import"uuid/v1";import"../../clients/jsonApi/index.js";import"../../clients/subscriptions.js";import p from"../../effects/useSignedURL.js";import h from"prop-types";import{withStyles as u}from"@material-ui/core/styles";import f from"@material-ui/core/Typography";import g from"../FileTypeIcon.js";import v from"react-player";import b from"@material-ui/core/IconButton";import N from"@material-ui/icons/Image";import w from"@material-ui/icons/SaveAlt";import y from"@material-ui/icons/Fullscreen";import x from"../ImageViewer/index.js";import I from"../GoogleDocsViewer/index.js";import A from"./styles.css.js";var j=t[200],P=t[400],L=t[600],U={label:"small",value:135},z={label:"medium",value:300},F={fileImage:function(e,t){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:t===U.label?U.value:z.value,display:e?"initial":"none",cursor:"pointer"}},fileDownloadWrapper:{marginTop:10,padding:"10px 10px 10px 5px",border:"1px solid ".concat(L),borderRadius:3,maxWidth:500,width:"75%"},imagePlaceholder:{position:"relative",backgroundColor:j,borderRadius:3,marginTop:10,height:135,width:135}},W=function(e){return n(s,{children:[n("div",{onClick:e.openLightbox,className:A.cAttachmentImg,children:[l("img",{"data-testid":"".concat("Attachment","_image"),src:e.attachmentUrl,style:F.fileImage(e.imageIsLoaded,e.size),alt:"Attachment",onLoad:e.setImageIsLoaded}),l("div",{"data-testid":"".concat("Attachment","_button"),className:A.cAttachmentImgPreviwBtn,children:l(y,{})})]}),!e.imageIsLoaded&&l("div",{style:F.imagePlaceholder,children:l(N,{"data-testid":"".concat("Attachment","_placeholder"),className:e.classes.imageIconRoot,htmlColor:P,fontSize:"large"})}),e.lightboxIsOpen&&l(x,{mainSrc:e.attachmentUrl,imagePadding:50,onAfterOpen:e.handleLightboxOpen,onCloseRequest:e.handleLightboxClose})]})},R=function(e){return n("div",{className:A.cAttachmentFileWrapper,children:[n("div",{className:A.cAttachmentFileDownloadWrapper,style:F.fileDownloadWrapper,onClick:e.openPreview,children:[l(g,{fileName:e.displayName||e.attachmentUrl,className:A.cAttachmentFileDownloadWrapperFileIcon,size:e.small?25:50}),l("div",{"data-testid":"".concat("Attachment","_name"),className:A.cAttachmentFileDownloadWrapperFileName,children:l(f,{variant:"subtitle2",noWrap:!0,className:e.classes.fileName,children:a.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl)})}),l(m,{open:e.previewIsOpen,onClose:e.closePreview,classes:{root:e.classes.dialogRoot,paper:i?e.classes.nativeDialog:e.classes.dialog},children:l(I,{fileUrl:e.attachmentUrl,fileName:a.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl),fileSize:e.attachmentSize,onClose:e.closePreview,width:"100%",height:"100%"})})]}),l("a",{download:e.displayName,href:e.attachmentUrl,className:A.cAttachmentFileDownloadWrapperForm,children:l(b,{"data-testid":"".concat("Attachment","_downloadButton"),type:"submit",children:l(w,{className:e.classes.downloadIcon})})})]})};function D(t){var a=c(!1),n=e(a,2),s=n[0],m=n[1],h=c(!1),u=e(h,2),f=u[0],g=u[1],b=c(!1),N=e(b,2),w=N[0],y=N[1],x=t.displayName||t.attachmentUrl,I=o(x),j=r(x),P=p(!t.attachmentUrl&&t.fileName),L=t.attachmentUrl||P,F=d((function(e){return e.preventDefault()}),[]);return I?l("div",{className:A.cAttachment,children:l(W,{size:t.size,openLightbox:function(){return g(!0)},attachmentUrl:L,setImageIsLoaded:function(){return m(!0)},imageIsLoaded:s,lightboxIsOpen:f,handleLightboxOpen:function(){i&&document.documentElement.addEventListener("touchmove",F,{passive:!1})},handleLightboxClose:function(){i&&document.documentElement.removeEventListener("touchmove",F),g(!1)},classes:t.classes})}):j&&v.canPlay(L)?l("div",{className:A.cAttachment,children:l(v,{"data-testid":"".concat("Attachment","_player"),className:A.cAttachmentReactPlayer,url:L,config:{file:{attributes:{preload:"metadata"}}},controls:!0,height:t.size===U.label?U.value:z.value,width:null})}):l("div",{className:A.cAttachment,children:l(R,{attachmentUrl:L,attachmentSize:t.attachmentSize,displayName:t.displayName,openPreview:function(){return y(!0)},closePreview:function(e){e.stopPropagation(),y(!1)},previewIsOpen:w,classes:t.classes,small:t.small})})}D.propTypes={attachmentUrl:h.string.isRequired,attachmentSize:h.number,displayName:h.string,fileName:h.string,size:h.oneOf([U.label,z.label]),classes:h.shape({}).isRequired,small:h.bool},D.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:z.label,small:!1};var S=u((function(e){return{imageIconRoot:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},dialog:{width:"95%",height:"95%",maxWidth:"100%",position:"relative"},nativeDialog:{width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",margin:0},dialogRoot:{backgroundColor:"rgba(0, 0, 0, 0.85)"},fileName:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},downloadIcon:{color:L,"&:hover":{color:e.palette.common.white}}}}))(D);export default S;
|
|
1
|
+
import"@babel/runtime/helpers/defineProperty";import"lodash";import"../../constants/completion.js";import"../../constants/alerts.js";import e from"@babel/runtime/helpers/slicedToArray";import"../../constants/goals.js";import"../../constants/segment.js";import"../../constants/apps.js";import"../../constants/drillstring.js";import"../../constants/notifications.js";import"../../constants/feed.js";import"@babel/runtime/regenerator";import"@babel/runtime/helpers/asyncToGenerator";import t from"@material-ui/core/colors/grey";import a from"../../utils/main.js";import{isNativeDetected as i}from"../../utils/mobileDetect.js";import{getIsImage as o,getIsVideo as r}from"../../utils/fileExtension.js";import{jsx as l,jsxs as n,Fragment as s}from"react/jsx-runtime";import{Dialog as m}from"@material-ui/core";import{useState as c,useCallback as d}from"react";import"querystring";import"uuid/v1";import"../../clients/jsonApi/index.js";import"../../clients/subscriptions.js";import p from"../../effects/useSignedURL.js";import h from"prop-types";import{withStyles as u}from"@material-ui/core/styles";import f from"@material-ui/core/Typography";import g from"../FileTypeIcon.js";import v from"react-player";import b from"@material-ui/core/IconButton";import N from"@material-ui/icons/Image";import w from"@material-ui/icons/SaveAlt";import y from"@material-ui/icons/Fullscreen";import x from"../ImageViewer/index.js";import I from"../GoogleDocsViewer/index.js";import A from"./styles.css.js";var j=t[200],P=t[400],L=t[600],U={label:"small",value:135},z={label:"medium",value:300},F={fileImage:function(e,t){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:t===U.label?U.value:z.value,display:e?"initial":"none",cursor:"pointer"}},fileDownloadWrapper:{marginTop:10,padding:"10px 10px 10px 5px",border:"1px solid ".concat(L),borderRadius:3,maxWidth:500,width:"75%"},imagePlaceholder:{position:"relative",backgroundColor:j,borderRadius:3,marginTop:10,height:135,width:135}},W=function(e){return n(s,{children:[n("div",{onClick:e.openLightbox,className:A.cAttachmentImg,children:[l("img",{"data-testid":"".concat("Attachment","_image"),src:e.attachmentUrl,style:F.fileImage(e.imageIsLoaded,e.size),alt:"Attachment",onLoad:e.setImageIsLoaded}),l("div",{"data-testid":"".concat("Attachment","_button"),className:A.cAttachmentImgPreviwBtn,children:l(y,{})})]}),!e.imageIsLoaded&&l("div",{style:F.imagePlaceholder,children:l(N,{"data-testid":"".concat("Attachment","_placeholder"),className:e.classes.imageIconRoot,htmlColor:P,fontSize:"large"})}),e.lightboxIsOpen&&l(x,{mainSrc:e.attachmentUrl,imagePadding:50,onAfterOpen:e.handleLightboxOpen,onCloseRequest:e.handleLightboxClose})]})},R=function(e){return n("div",{className:A.cAttachmentFileWrapper,children:[n("div",{className:A.cAttachmentFileDownloadWrapper,style:F.fileDownloadWrapper,onClick:e.openPreview,children:[l(g,{fileName:e.displayName||e.attachmentUrl,className:A.cAttachmentFileDownloadWrapperFileIcon,size:e.small?25:50}),l("div",{"data-testid":"".concat("Attachment","_name"),className:A.cAttachmentFileDownloadWrapperFileName,children:l(f,{variant:"subtitle2",noWrap:!0,className:e.classes.fileName,children:a.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl)})}),l(m,{open:e.previewIsOpen,onClose:e.closePreview,classes:{root:e.classes.dialogRoot,paper:i?e.classes.nativeDialog:e.classes.dialog},children:l(I,{fileUrl:e.attachmentUrl,fileName:a.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl),fileSize:e.attachmentSize,onClose:e.closePreview,width:"100%",height:"100%"})})]}),l("a",{download:e.displayName,href:e.attachmentUrl,className:A.cAttachmentFileDownloadWrapperForm,children:l(b,{"data-testid":"".concat("Attachment","_downloadButton"),type:"submit",children:l(w,{className:e.classes.downloadIcon})})})]})};function D(t){var a=c(!1),n=e(a,2),s=n[0],m=n[1],h=c(!1),u=e(h,2),f=u[0],g=u[1],b=c(!1),N=e(b,2),w=N[0],y=N[1],x=t.displayName||t.attachmentUrl||t.fileName,I=o(x),j=r(x),P=p(!t.attachmentUrl&&t.fileName),L=t.attachmentUrl||P,F=d((function(e){return e.preventDefault()}),[]);return I?l("div",{className:A.cAttachment,children:l(W,{size:t.size,openLightbox:function(){return g(!0)},attachmentUrl:L,setImageIsLoaded:function(){return m(!0)},imageIsLoaded:s,lightboxIsOpen:f,handleLightboxOpen:function(){i&&document.documentElement.addEventListener("touchmove",F,{passive:!1})},handleLightboxClose:function(){i&&document.documentElement.removeEventListener("touchmove",F),g(!1)},classes:t.classes})}):j&&v.canPlay(L)?l("div",{className:A.cAttachment,children:l(v,{"data-testid":"".concat("Attachment","_player"),className:A.cAttachmentReactPlayer,url:L,config:{file:{attributes:{preload:"metadata"}}},controls:!0,height:t.size===U.label?U.value:z.value,width:null})}):l("div",{className:A.cAttachment,children:l(R,{attachmentUrl:L,attachmentSize:t.attachmentSize,displayName:t.displayName,openPreview:function(){return y(!0)},closePreview:function(e){e.stopPropagation(),y(!1)},previewIsOpen:w,classes:t.classes,small:t.small})})}D.propTypes={attachmentUrl:h.string.isRequired,attachmentSize:h.number,displayName:h.string,fileName:h.string,size:h.oneOf([U.label,z.label]),classes:h.shape({}).isRequired,small:h.bool},D.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:z.label,small:!1};var S=u((function(e){return{imageIconRoot:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},dialog:{width:"95%",height:"95%",maxWidth:"100%",position:"relative"},nativeDialog:{width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",margin:0},dialogRoot:{backgroundColor:"rgba(0, 0, 0, 0.85)"},fileName:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},downloadIcon:{color:L,"&:hover":{color:e.palette.common.white}}}}))(D);export default S;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FEED_ITEM_TYPES as e}from"../../../constants/feed.js";import t from"../../../utils/main.js";import{jsx as o}from"react/jsx-runtime";import n from"prop-types";import a from"../../PostPreviewDialog/index.js";import i from"../../TracesEditModal/TracesEditModalContainer.js";var r=function(n){var r,s,l,d,c,u,m,p,v,f,x,S=n.feedItem,h=n.onClose,y=n.onSave,D=n.tracesMinDateSec,M=n.tracesMaxDateSec,T=n.tracesAssetId;return S.type===e.POST?o(a,{open:!0,title:"Edit",fileUrl:null===(r=S.context)||void 0===r||null===(s=r.post)||void 0===s||null===(l=s.attachment)||void 0===l?void 0:l.url,fileName:(null===(d=S.context)||void 0===d||null===(c=d.post)||void 0===c||null===(u=c.attachment)||void 0===u?void 0:u.url)&&t.getFileNameWithExtensionFromPath(null===(m=S.context)||void 0===m||null===(p=m.post)||void 0===p||null===(v=p.attachment)||void 0===v?void 0:v.url),handleClose:h,handleShare:function(e,t,o){return y({context:{post:{body:e,attachment:{url:t,size:o}}}})},message:null===(f=S.context)||void 0===f||null===(x=f.post)||void 0===x?void 0:x.body,okButtonText:"Save",cancelButtonText:"Discard changes",companyId:S.company_id}):S.type===e.TRACES_MEMO?D&&M&&T&&o(i,{feedItem:S,onSave:y,onClose:h,minDateSec:D,maxDateSec:M,assetId:T}):null};r.propTypes={feedItem:n.shape().isRequired,onClose:n.func.isRequired,onSave:n.func.isRequired,tracesMinDateSec:n.oneOfType([n.string,n.number]),tracesMaxDateSec:n.oneOfType([n.string,n.number]),tracesAssetId:n.oneOfType([n.string,n.number])},r.defaultProps={tracesMinDateSec:void 0,tracesMaxDateSec:void 0,tracesAssetId:void 0};export default r;
|
|
1
|
+
import{FEED_ITEM_TYPES as e}from"../../../constants/feed.js";import t from"../../../utils/main.js";import{jsx as o}from"react/jsx-runtime";import n from"prop-types";import a from"../../PostPreviewDialog/index.js";import i from"../../TracesEditModal/TracesEditModalContainer.js";var r=function(n){var r,s,l,d,c,u,m,p,v,f,x,S=n.feedItem,h=n.onClose,y=n.onSave,D=n.tracesMinDateSec,M=n.tracesMaxDateSec,T=n.tracesAssetId;return S.type===e.POST?o(a,{open:!0,title:"Edit",fileUrl:null===(r=S.context)||void 0===r||null===(s=r.post)||void 0===s||null===(l=s.attachment)||void 0===l?void 0:l.url,fileName:(null===(d=S.context)||void 0===d||null===(c=d.post)||void 0===c||null===(u=c.attachment)||void 0===u?void 0:u.url)&&t.getFileNameWithExtensionFromPath(null===(m=S.context)||void 0===m||null===(p=m.post)||void 0===p||null===(v=p.attachment)||void 0===v?void 0:v.url),handleClose:h,handleShare:function(e,t,o,n){return y({context:{post:{body:e,attachment:{test:1,file_name:n,url:t,size:o}}}})},message:null===(f=S.context)||void 0===f||null===(x=f.post)||void 0===x?void 0:x.body,okButtonText:"Save",cancelButtonText:"Discard changes",companyId:S.company_id}):S.type===e.TRACES_MEMO?D&&M&&T&&o(i,{feedItem:S,onSave:y,onClose:h,minDateSec:D,maxDateSec:M,assetId:T}):null};r.propTypes={feedItem:n.shape().isRequired,onClose:n.func.isRequired,onSave:n.func.isRequired,tracesMinDateSec:n.oneOfType([n.string,n.number]),tracesMaxDateSec:n.oneOfType([n.string,n.number]),tracesAssetId:n.oneOfType([n.string,n.number])},r.defaultProps={tracesMinDateSec:void 0,tracesMaxDateSec:void 0,tracesAssetId:void 0};export default r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import{jsx as t}from"react/jsx-runtime";import r from"prop-types";import i from"../../Attachment/index.js";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function o(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?n(Object(i),!0).forEach((function(r){e(t,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var p=function(e){var r=e.feedItem.context.completion_document.data,n=r.display_name,p=r.file_name,s=r.size,a=r.signed_url;return t(i,o(o({},a?{attachmentUrl:a}:{fileName:p}),{},{attachmentSize:s,displayName:n,size:"medium"}))};p.propTypes={feedItem:r.shape({context:r.shape({completion_document:r.shape({data:r.shape({display_name:r.string.isRequired,file_name:r.string.isRequired,size:r.number,signed_url:r.string}).isRequired}).isRequired}).isRequired}).isRequired};export default p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import{jsx as t}from"react/jsx-runtime";import r from"prop-types";import i from"../../Attachment/index.js";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function o(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?n(Object(i),!0).forEach((function(r){e(t,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var s=function(e){var r=e.feedItem.context.document.data,n=r.display_name,s=r.file_name,a=r.size,p=r.signed_url;return t(i,o(o({},p?{attachmentUrl:p}:{fileName:s}),{},{attachmentSize:a,displayName:n,size:"medium"}))};s.propTypes={feedItem:r.shape({context:r.shape({document:r.shape({data:r.shape({display_name:r.string.isRequired,file_name:r.string.isRequired,size:r.number,signed_url:r.string}).isRequired}).isRequired}).isRequired}).isRequired};export default s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isNativeDetected as
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import{isNativeDetected as t}from"../../../utils/mobileDetect.js";import{jsxs as r,jsx as i}from"react/jsx-runtime";import{makeStyles as o,Typography as n}from"@material-ui/core";import s from"prop-types";import{formatMentionText as a}from"../../UserMention/utils/index.js";import p from"../../Attachment/index.js";import m from"../../CollapsibleContent.js";function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function u(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?c(Object(i),!0).forEach((function(r){e(t,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):c(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var f=o({wrapper:{whiteSpace:"pre-wrap"}}),l=function(e){var o=e.feedItem,s=o.context.post,c=s.body,l=s.attachment,d=void 0===l?{}:l,b=o.mentioned_users,h=f(),y={attachmentSize:d.size,size:"medium"};return d.file_name?y.fileName=d.file_name:y.attachmentUrl=d.url,r("div",{className:h.wrapper,children:[c&&i(m,{children:i(n,{"data-testid":"".concat("PostFeedItem","_message"),variant:"body1",gutterBottom:!0,children:a(c,b,t)})}),(d.file_name||d.url)&&i(p,u({},y))]})};l.propTypes={feedItem:s.shape({context:s.shape({post:s.shape({body:s.string.isRequired,attachment:s.shape({url:s.string,size:s.number})}).isRequired}).isRequired,mentioned_users:s.arrayOf(s.shape({}))}).isRequired};export default l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/defineProperty";import
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import r from"moment";import{FEED_ITEM_TYPES as t}from"../../../constants/feed.js";import{isNativeDetected as i}from"../../../utils/mobileDetect.js";import{jsxs as m,jsx as n}from"react/jsx-runtime";import{makeStyles as a,Box as o,Typography as s}from"@material-ui/core";import p from"prop-types";import{formatMentionText as l}from"../../UserMention/utils/index.js";import c from"../../Attachment/index.js";import{Regular14 as d}from"../../Typography.js";import h from"../../CollapsibleContent.js";var u=a({label:{color:"#bbbbbb"},container:{marginRight:16}}),f=function(e){var a=e.feedItem,p=a.context[t.TRACES_MEMO],f=p.body,b=p.attachment,y=void 0===b?{}:b,R=p.bitDepth,g=p.holeDepth,D=p.timestamp,T=a.mentioned_users,j=u();return m(o,{whiteSpace:"pre-wrap",children:[f&&n(h,{children:n(s,{variant:"body1",gutterBottom:!0,children:l(f,T,i)})}),y&&y.url&&n(c,{fileName:y.name,attachmentSize:y.size,size:"medium"}),m(o,{display:"flex",mt:2,children:[m(d,{className:j.container,children:[n("span",{className:j.label,children:"Time: "}),r(1e3*D).format("MM.DD.YYYY, HH:mm")]}),m(d,{className:j.container,children:[n("span",{className:j.label,children:"Hole Depth: "}),g,"’"]}),m(d,{className:j.container,children:[n("span",{className:j.label,children:"Bit Depth: "}),R,"’"]})]})]})};f.propTypes={feedItem:p.shape({context:p.shape(e({},t.TRACES_MEMO,p.shape({body:p.string.isRequired,attachment:p.shape({url:p.string,size:p.number}),bitDepth:p.oneOfType([p.string,p.number]).isRequired,holeDepth:p.oneOfType([p.string,p.number]).isRequired,timestamp:p.oneOfType([p.string,p.number]).isRequired}).isRequired)).isRequired,mentioned_users:p.arrayOf(p.shape({}))}).isRequired};export default f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/classCallCheck";import i from"@material-ui/core/colors/grey";import{isNativeDetected as o}from"../../utils/mobileDetect.js";import{getIsImage as l}from"../../utils/fileExtension.js";import{jsx as r,jsxs as a}from"react/jsx-runtime";import{Dialog as n}from"@material-ui/core";import{createRef as s,PureComponent as c}from"react";import p from"@babel/runtime/helpers/createClass";import d from"prop-types";import{withStyles as m}from"@material-ui/core/styles";import f from"@babel/runtime/helpers/assertThisInitialized";import h from"@babel/runtime/helpers/inherits";import u from"@babel/runtime/helpers/possibleConstructorReturn";import g from"@babel/runtime/helpers/getPrototypeOf";import U from"@material-ui/core/Button";import y from"@material-ui/core/Typography";import F from"../UserMention/index.js";import
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/classCallCheck";import i from"@material-ui/core/colors/grey";import{isNativeDetected as o}from"../../utils/mobileDetect.js";import{getIsImage as l}from"../../utils/fileExtension.js";import{jsx as r,jsxs as a}from"react/jsx-runtime";import{Dialog as n}from"@material-ui/core";import{createRef as s,PureComponent as c}from"react";import p from"@babel/runtime/helpers/createClass";import d from"prop-types";import{withStyles as m}from"@material-ui/core/styles";import f from"@babel/runtime/helpers/assertThisInitialized";import h from"@babel/runtime/helpers/inherits";import u from"@babel/runtime/helpers/possibleConstructorReturn";import g from"@babel/runtime/helpers/getPrototypeOf";import U from"@material-ui/core/Button";import y from"@material-ui/core/Typography";import F from"../UserMention/index.js";import N from"../EmojiIconButton.js";import v from"@material-ui/core/Paper";import S from"@material-ui/core/DialogActions";import b from"@material-ui/core/DialogContent";import D from"@material-ui/core/DialogTitle";import C from"@material-ui/core/Input";import E from"@material-ui/core/RootRef";import P from"@material-ui/icons/Delete";import R from"../FileTypeIcon.js";import x from"../FailedFileUploading.js";import B from"./styles.css.js";import w from"../FileUploadIconButton.js";function I(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,o=g(e);if(t){var l=g(this).constructor;i=Reflect.construct(o,arguments,l)}else i=o.apply(this,arguments);return u(this,i)}}var j="PostPreviewDialog",k=i[200],T=i[300],z=i[400],A=function(e){return a(v,{className:e.classes.messageWrapper,children:[r(C,{"data-testid":"".concat(j,"_messageInput"),inputRef:e.inputEl,inputComponent:F,inputProps:{onChange:e.handleMessageChange,companyId:e.companyId,suggestionsPortalHost:e.rootRef.current},placeholder:"Add a message about the file...",fullWidth:!0,disableUnderline:!0,multiline:!0,rows:"3",className:e.classes.textFieldRoot,value:e.comment,onKeyDown:e.handleKeyDown}),a("div",{className:B.cPostPreviewDialogMessageAdditionalFieldsWrapper,children:[r("div",{children:e.additionalFields}),a("div",{className:B.cPostPreviewDialogMessageActionFields,children:[!e.fileUrl&&r(w,{htmlColor:i[400],openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:e.handleFileUpload,onError:e.handleFileUploadingError,inputId:"preview-dialog-file-upload"}),r(N,{handleSelectEmoji:e.handleSelectEmoji,emojiIconClassName:e.classes.additionalActionButton,htmlColor:i[400],disableRipple:!0})]})]})]})},M=function(e){var t=l(e.fileName);return a("div",t?{children:[a("div",{className:B.cPostPreviewDialogFileName,children:[r(y,{"data-testid":"".concat(j,"_fileName"),variant:"subtitle2",noWrap:!0,gutterBottom:!0,children:e.fileName}),r(P,{"data-testid":"".concat(j,"_deleteButton"),color:"action",onClick:e.handleFileDelete,className:e.classes.deleteButton})]}),r("div",{className:B.cPostPreviewDialogFileImageFileWrapper,style:{backgroundColor:k,border:"1px solid ".concat(T)},children:r("img",{"data-testid":"".concat(j,"_previewImage"),className:B.cPostPreviewDialogFileImage,src:e.fileUrl,alt:"Uploaded file"})})]}:{className:B.cPostPreviewDialogFileDownload,style:{backgroundColor:k,border:"1px solid ".concat(z)},children:[r(R,{fileName:e.fileName}),a("div",{className:B.cPostPreviewDialogFileDownloadText,children:[r(y,{"data-testid":"".concat(j,"_fileName"),variant:"subtitle2",noWrap:!0,children:e.fileName}),r(P,{"data-testid":"".concat(j,"_deleteButton"),color:"action",onClick:e.handleFileDelete,className:e.classes.deleteButton})]})]})},W=function(i){h(d,c);var l=I(d);function d(i){var o;return t(this,d),o=l.call(this,i),e(f(o),"focusOnInput",(function(){return o.inputEl.current.focus()})),e(f(o),"handleKeyDown",(function(e){"Enter"===e.key&&o.handleShare()})),e(f(o),"handleMessageChange",(function(e){return o.setState({comment:e})})),e(f(o),"handleSelectEmoji",(function(e){return o.setState((function(t){var i=t.comment;return{comment:"".concat(i).concat(e.native)}}))})),e(f(o),"handleShare",(function(){o.props.handleShare(o.state.comment,o.state.fileUrl,o.state.fileSize,o.state.fileName)})),e(f(o),"handleFileDelete",(function(){o.setState({fileUrl:"",fileSize:null,fileName:""})})),e(f(o),"handleFileUpload",(function(e,t,i){o.setState({fileUrl:e,fileName:t,fileSize:i,fileUploadingError:null})})),e(f(o),"handleFileUploadingError",(function(e){o.setState({fileUrl:null,fileName:null,fileSize:null,fileUploadingError:e})})),o.state={comment:i.message,fileUrl:i.fileUrl,fileSize:i.fileSize,fileName:i.fileName,fileUploadingError:null},o.inputEl=s(),o.rootRef=s(),o}return p(d,[{key:"componentDidUpdate",value:function(e){!e.open&&this.props.open&&!this.state.comment&&this.props.message&&this.setState({comment:this.props.message}),this.props.fileUrl===e.fileUrl&&this.props.fileSize===e.fileSize&&this.props.fileName===e.fileName||this.setState({fileUrl:this.props.fileUrl,fileSize:this.props.fileSize,fileName:this.props.fileName})}},{key:"render",value:function(){return r(E,{rootRef:this.rootRef,children:a(n,{fullScreen:o,open:this.props.open,onClose:this.props.handleClose,onBackdropClick:this.props.handleClose,onEntered:this.focusOnInput,children:[r(D,{children:this.props.title}),a(b,{classes:{root:!o&&this.props.classes.dialogContentRoot},children:[r(A,{inputEl:this.inputEl,comment:this.state.comment,handleMessageChange:this.handleMessageChange,handleKeyDown:this.handleKeyDown,handleFileUpload:this.handleFileUpload,handleSelectEmoji:this.handleSelectEmoji,handleFileUploadingError:this.handleFileUploadingError,additionalFields:this.props.additionalFields,fileUrl:this.state.fileUrl,classes:this.props.classes,companyId:this.props.companyId,rootRef:this.rootRef}),this.state.fileUploadingError&&r(x,{errorMessage:this.state.fileUploadingError,className:this.props.classes.fileUploadingError}),this.state.fileUrl&&r(M,{fileName:this.state.fileName,fileUrl:this.state.fileUrl,handleFileDelete:this.handleFileDelete,handleFileUploadingError:this.handleFileUploadingError,classes:this.props.classes})]}),a(S,{className:this.props.classes.dialogActions,children:[r(U,{"data-testid":"".concat(j,"_cancelButton"),color:"primary",onClick:this.props.handleClose,children:this.props.cancelButtonText}),r(U,{"data-testid":"".concat(j,"_okButton"),color:"primary",variant:"contained",disabled:!this.state.fileUrl&&!this.state.comment||!this.props.requiredFields.every(Boolean),onClick:this.handleShare,children:this.props.okButtonText})]})]})})}}]),d}();W.propTypes={title:d.string,open:d.bool.isRequired,fileUrl:d.string,fileName:d.string,fileSize:d.number,handleShare:d.func.isRequired,handleClose:d.func.isRequired,classes:d.shape({}).isRequired,additionalFields:d.arrayOf(d.node),requiredFields:d.arrayOf(d.string),message:d.string,companyId:d.number,okButtonText:d.string,cancelButtonText:d.string},W.defaultProps={title:"Share a file",fileUrl:"",fileName:"",fileSize:null,additionalFields:[],requiredFields:[],message:"",companyId:null,okButtonText:"Post",cancelButtonText:"Cancel"};var _=m((function(e){return{dialogContentRoot:{minWidth:500},textFieldRoot:{marginBottom:20},textInput:{paddingTop:2},messageWrapper:{padding:"18.5px 14px",border:"solid 1px ".concat(e.palette.primary.main),boxShadow:"none"},dialogActions:{padding:"24px 24px",margin:0},deleteButton:{color:"#DADADA",cursor:"pointer"},fileUploadingError:{marginTop:10}}}))(W);export default _;
|