import t from"prop-types";import e from"moment";import{makeStyles as a,Grid as i,Typography as n}from"@material-ui/core";import r from"@material-ui/core/colors/blue";import{convertValue as o,getUnitDisplay as s}from"../../../utils/convert.js";import{jsxs as c,jsx as m}from"react/jsx-runtime";var d=a((function(t){return{columnWithMargin:{marginRight:40},highlightedText:{color:r[300],textTransform:"capitalize"},valueWrapper:{display:"flex",alignItems:"baseline"},unit:{color:t.palette.grey[400],marginLeft:5},text:{color:t.palette.grey[400],marginRight:5}}})),p=function(t){var a=t.feedItem.context.npt_event.data,r=a.comment,p=void 0===r?"":r,l=a.depth,u=a.end_time,h=a.start_time,v=a.type,y=void 0===v?"":v,g=d(),f=h?e.unix(h):e(),x=u?e.unix(u):void 0,b=x&&e.duration(x-f).asHours(),N=o(l,"length","ft");return c(i,{spacing:8,justify:"flex-start",container:!0,children:[c(i,{item:!0,className:g.columnWithMargin,children:[c(n,{variant:"body2",className:g.valueWrapper,children:["Type: ",m(n,{variant:"body2","data-testid":"".concat("nptActivity","_type"),component:"span",className:g.highlightedText,children:y})]}),m(n,{variant:"body2",children:"Duration:"}),c(n,{variant:"body2",className:g.valueWrapper,children:[m(n,{"data-testid":"".concat("nptActivity","_duration"),component:"span",variant:"h6",className:g.highlightedText,children:Number.isFinite(b)&&b.toFixed(2)||"-"}),b&&m(n,{"data-testid":"".concat("nptActivity","_durationUnits"),component:"span",variant:"caption",className:g.unit,children:"(hrs)"})]})]}),c(i,{item:!0,children:[c(n,{variant:"body2","data-testid":"".concat("nptActivity","_startTime"),className:g.valueWrapper,children:[m(n,{variant:"body2",component:"span",className:g.text,children:"Start Time:"}),f.format("MM/DD/YYYY HH:mm")]}),c(n,{variant:"body2","data-testid":"".concat("nptActivity","_depth"),className:g.valueWrapper,children:[m(n,{variant:"body2",component:"span",className:g.text,children:"Depth:"}),null==N?void 0:N.formatNumeral("0,0.00"),c(n,{component:"span",variant:"caption",className:g.unit,children:["(",s("length"),")"]})]}),p&&c(n,{variant:"body2","data-testid":"".concat("nptActivity","_comment"),className:g.valueWrapper,children:[m(n,{variant:"body2",component:"span",className:g.text,children:"Comment:"}),p]})]})]})},l=t.shape({comment:t.string.isRequired,depth:t.number.isRequired,end_time:t.number.isRequired,start_time:t.number.isRequired,type:t.string.isRequired}).isRequired;p.propTypes={feedItem:t.shape({context:t.shape({completion_npt_event:t.shape({data:l}).isRequired,npt_event:t.shape({data:l}).isRequired}).isRequired}).isRequired};export{p as default};
