import e from"@babel/runtime/helpers/defineProperty";import{memo as t,useMemo as i}from"react";import a from"prop-types";import{makeStyles as r}from"@material-ui/core";import n from"./icons/Critical.js";import s from"./icons/Major.js";import l from"./icons/Minor.js";import c from"../../../Attachment/index.js";import{convertValue as o}from"../../../../utils/convert.js";import{jsxs as m,jsx as d}from"react/jsx-runtime";function p(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,a)}return i}function u(t){for(var i=1;i<arguments.length;i++){var a=null!=arguments[i]?arguments[i]:{};i%2?p(Object(a),!0).forEach((function(i){e(t,i,a[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):p(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}var v="LessonsLearnedFeedItem",h=r({item:{marginTop:"4px"},itemLabel:{fontWeight:"normal",fontSize:"14px",color:"#BDBDBD",marginRight:"8px"},itemValue:{fontSize:"14px",color:"#FFFFFF"},attachment:{paddingTop:10,width:300}});function f(e){var t,a=e.feedItem,r=h(),p=i((function(){var e,t,i=(null===(e=a.context)||void 0===e||null===(t=e.lessons_learned)||void 0===t?void 0:t.data)||{};return u(u({},i),{},{md_start:o(i.md_start,"length","ft"),tvd_start:o(i.tvd_start,"length","ft")})}),[a]),f=null===(t=a.context)||void 0===t?void 0:t.lessons_learned.attachment,b=(null==f?void 0:f.signed_url)||(null==f?void 0:f.url),y=(null==f?void 0:f.file_name)||(null==f?void 0:f.name);return m("div",{children:[d("div",{className:r.item,children:d("span",{"data-testid":"".concat(v,"_topic"),className:r.itemLabel,children:p.topic})}),m("div",{className:r.item,children:[d("span",{className:r.itemLabel,children:"Event Cause:"}),d("span",{"data-testid":"".concat(v,"_Cause"),className:r.itemValue,children:p.cause})]}),m("div",{className:r.item,style:{display:"flex",alignItems:"center"},children:[d("span",{className:r.itemLabel,children:"Event Severity:"}),d("span",{"data-testid":"".concat(v,"_severityIcon"),children:"Major"===p.severity?d(s,{}):"Critical"===p.severity?d(n,{}):"Minor"===p.severity?d(l,{}):null}),d("span",{"data-testid":"".concat(v,"_Severity"),className:r.itemValue,children:p.severity})]}),m("div",{className:r.item,children:[d("span",{className:r.itemLabel,children:"MD/TVD:"}),m("span",{"data-testid":"".concat(v,"_MD/TVD"),className:r.itemValue,children:[Number.isFinite(p.md_start)?p.md_start.fixFloat(2):"-","/",Number.isFinite(p.tvd_start)?p.tvd_start.fixFloat(2):"-"]})]}),m("div",{className:r.item,children:[d("span",{className:r.itemLabel,children:"Hole Section:"}),d("span",{"data-testid":"".concat(v,"_HoleSection"),className:r.itemValue,children:p.section})]}),m("div",{className:r.item,children:[d("span",{className:r.itemLabel,children:"Operation:"}),d("span",{"data-testid":"".concat(v,"_Operation"),className:r.itemValue,children:p.activity})]}),m("div",{className:r.item,children:[d("span",{className:r.itemLabel,children:"Description:"}),d("div",{"data-testid":"".concat(v,"_Description"),className:r.itemValue,children:p.description})]}),f&&(b||y)&&d("div",{className:r.attachment,children:d(c,{small:!0,attachmentUrl:b,fileName:y,displayName:y})})]})}f.propTypes={feedItem:a.shape().isRequired};var b=t(f);export{b as default};
//# sourceMappingURL=index.js.map
