@backtest-kit/ui 5.3.0 → 5.5.0
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/build/modules/frontend/build/assets/{Background-Cy1oK_A0.js → Background-CXtJK64T.js} +1 -1
- package/build/modules/frontend/build/assets/{IconPhoto-B4TZ_YW8.js → IconPhoto-C9wHHM_Y.js} +1 -1
- package/build/modules/frontend/build/assets/{KeyboardArrowLeft-CyFQKXDf.js → KeyboardArrowLeft-CxKFPg-8.js} +1 -1
- package/build/modules/frontend/build/assets/{Refresh-Bps_3kBG.js → Refresh-BPgxPLp0.js} +1 -1
- package/build/modules/frontend/build/assets/{index-Cvnmi7o2.js → index-B-Bv8GD6.js} +1 -1
- package/build/modules/frontend/build/assets/index-BNF_SvU2.js +1 -0
- package/build/modules/frontend/build/assets/{index-DQJ9PMu0.js → index-BlPN7ZqU.js} +1 -1
- package/build/modules/frontend/build/assets/{index-BOoD89aC.js → index-CG1pUhl3.js} +1 -1
- package/build/modules/frontend/build/assets/{index-CeyuVkFA.js → index-CZCYDmpG.js} +12 -12
- package/build/modules/frontend/build/assets/{index-Pzk4ws48.js → index-DTEf9UBH.js} +1 -1
- package/build/modules/frontend/build/assets/{index-DyFxSCGd.js → index-IXDsO3Ai.js} +1 -1
- package/build/modules/frontend/build/assets/{markdownit-D7gOrFrx.js → markdownit-Dxjq0iuu.js} +1 -1
- package/build/modules/frontend/build/index.html +1 -1
- package/package.json +3 -3
- package/build/modules/frontend/build/assets/index-CNFhuCkl.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as a,ar as t,as as e,at as o,n as s,f as i,q as n,Z as r,m as l,M as c,I as d,T as p,au as u,b as m,B as b,F as y,C as h,e as g,S,a as v,d as f,l as L,g as w,h as k,av as x,aw as A,X as C,j as N,D as $,ax as j,ay as R}from"./index-
|
|
1
|
+
import{i as a,ar as t,as as e,at as o,n as s,f as i,q as n,Z as r,m as l,M as c,I as d,T as p,au as u,b as m,B as b,F as y,C as h,e as g,S,a as v,d as f,l as L,g as w,h as k,av as x,aw as A,X as C,j as N,D as $,ax as j,ay as R}from"./index-CZCYDmpG.js";import{I as F}from"./IconPhoto-C9wHHM_Y.js";import{C as B,R as E}from"./Refresh-BPgxPLp0.js";import{K as H}from"./KeyboardArrowLeft-CxKFPg-8.js";import{B as M}from"./Background-CXtJK64T.js";const _=(o,s=a.routerService.location.pathname)=>!!t(e.filter(({path:a})=>o.includes(a)),s),G="trade-gpt__groupHeader",I="trade-gpt__groupRoot",V="trade-gpt__symbolImage",O=l()({root:{[`& .${I}:hover .${G}`]:{opacity:"1 !important"}}});function z(a){return k(a,"#000000")>k(a,"#FFFFFF")}const D=[{type:r.Link,action:"back-action",label:i(H,{sx:{display:"block"}})},{type:r.Link,action:"back-action",label:"Main"},{type:r.Link,action:"back-action",label:"Status"}],U=[{action:"update-now",label:"Refresh",icon:()=>i(d,{icon:E,color:"#4caf50"})}],K=(t,e)=>({type:c.Group,className:I,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:c.Component,className:G,style:{transition:"opacity 500ms",opacity:.5},element:()=>i(S,{direction:"row",children:[i(h,{variant:"outlined",size:"small",color:"info",label:`${g.bullet} ${t}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),i(b,{flex:1})]})},{type:c.Group,fields:e.map(({symbol:t,label:e,to:o,color:s})=>((t,e,o,s)=>({type:c.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>i(w,{component:v,onClick:()=>{a.routerService.push(`/status/${e}`)},sx:{width:"100%",background:s,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${V}`]:{transition:"filter 500ms"},"&:hover":{background:()=>z(s)?f(s,.33):L(s,.33),[`& .${V}`]:{transition:"filter 500ms",filter:z(s)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:i(F,{className:V,symbol:t}),children:o})}))(t,o,e,s))}]}),P=[{type:r.Link,action:"back-action",label:i(H,{sx:{display:"block"}})},{type:r.Link,action:"back-action",label:"Main"},{type:r.Link,action:"back-action",label:"Status"},{type:r.Link,action:"back-action",compute:a=>a?`${String(a.symbol).toUpperCase()} (${a.strategyName})`:"Live"}],T=[{action:"download-action",label:"Download",icon:()=>i(d,{icon:$,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>i(d,{icon:E,color:"#4caf50"})}],W=new N,q=[{id:"status",element:({params:t})=>{const[e]=s(async()=>{const e=await a.statusViewService.getStatusMap();return x.get(e,t.id,null)},{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[t.id]}),[o,{loading:r,execute:l}]=s(async()=>await a.statusViewService.getStatusOne(t.id),{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[t.id]}),c=A(async()=>{if(!o)return;const t=new Blob([JSON.stringify(o,null,2)],{type:"application/json"}),e=URL.createObjectURL(t);a.layoutService.downloadFile(e,`status_${Date.now()}.json`)});C(()=>W.subscribe(l));return i(B,{children:[i(n,{items:P,actions:T,payload:e,onAction:async t=>{"back-action"===t&&((async()=>{1!==(await a.statusViewService.getStatusList()).length?a.routerService.push("/status"):a.routerService.push("/")})(),a.routerService.push("/")),"update-now"===t&&await W.next(),"download-action"===t&&await c()}}),r?i(u,{children:i(p,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):o?i(y,{children:[i(m,{handler:o,fields:j}),i(b,{paddingBottom:"24px"})]}):i(u,{children:i(p,{variant:"h6",sx:{opacity:.5},children:"No pending signal"})}),i(M,{})]})},isActive:a=>_(["/status/:id"],a),isAvailable:()=>!1},{id:"main",element:()=>{const{classes:t}=O(),{reloadTrigger:e,doReload:r}=o();s(async()=>{const t=await a.statusViewService.getStatusList();if(1===t.length){const[{id:e}]=t;a.routerService.push(`/status/${e}`)}},{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[e]});const[l,{loading:d}]=s(async()=>await(async()=>{const[t,e]=await Promise.all([a.symbolGlobalService.getSymbolMap(),a.statusViewService.getStatusList()]),o={};e.forEach(a=>{const e=t[a.symbol],s=a.strategyName;o[s]||(o[s]=[]),o[s].push({symbol:a.symbol,label:(null==e?void 0:e.displayName)||a.symbol,color:(null==e?void 0:e.color)||"#ccc",to:a.id})});const s=Object.entries(o).sort(([,a],[,t])=>t.length-a.length),i=[],n=[],r=[];return s.forEach(([a,t],e)=>{const o=K(a,t);e%2==0?i.push(o):n.push(o),r.push(o)}),[{type:c.Group,columns:"6",className:"tabletLeftColumn",phoneHidden:!0,desktopHidden:!0,fields:i},{type:c.Group,columns:"6",className:"tabletRightColumn",phoneHidden:!0,desktopHidden:!0,fields:n},{type:c.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:r}]})(),{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[e]});return i(B,{children:[i(n,{items:D,actions:U,onAction:t=>{"back-action"===t&&a.routerService.push("/"),"update-now"===t&&r()}}),d||!l?i(u,{children:i(p,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):l.length?i(y,{children:[i(m,{className:t.root,fields:l},e),i(b,{paddingBottom:"24px"})]}):i(u,{children:i(p,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:a=>_(["/status"],a),isAvailable:()=>!1}],J=({id:t})=>i(R,{history:a.routerService,onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),routes:q,params:{id:t}});export{J as StatusPage,J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a,f as e,an as t,B as o,S as r,a8 as n,T as i,G as c,C as s,F as l,a9 as d,P as h,ac as p,ap as u,aq as w,a1 as v,j as b,i as f,a2 as x,z as g,a7 as y,q as m,Z as S,ao as L,D as k,I as z}from"./index-
|
|
1
|
+
import{c as a,f as e,an as t,B as o,S as r,a8 as n,T as i,G as c,C as s,F as l,a9 as d,P as h,ac as p,ap as u,aq as w,a1 as v,j as b,i as f,a2 as x,z as g,a7 as y,q as m,Z as S,ao as L,D as k,I as z}from"./index-CZCYDmpG.js";import{C as H,R as j}from"./Refresh-BPgxPLp0.js";import{K as C}from"./KeyboardArrowLeft-CxKFPg-8.js";const A=a(e("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}),"Article"),R=a(e("path",{d:"M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"}),"BugReport"),M=a(e("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),"Search"),B=a=>{const t={color:"white",fontSize:28};switch(a.type){case"debug":return e(R,{sx:t});case"info":return e(u,{sx:t});case"warn":return e(p,{sx:t});default:return e(A,{sx:t})}},D=t.virtualize(({data:a,sx:t})=>{const p=(a=>{switch(a.type){case"debug":default:return"#9E9E9E";case"info":return"#2196F3";case"warn":return"#FF9800";case"log":return"#4CAF50"}})(a);return e(h,{variant:"outlined",sx:{display:"flex",alignItems:"stretch",justifyContent:"stretch",...t},children:e(o,{sx:{flex:1,position:"relative",overflow:"hidden",height:"100%",width:"100%",borderRadius:"12px"},children:[e(r,{direction:"row",spacing:2,sx:{p:2},children:[e(n,{sx:{width:56,height:56,background:p},children:B(a)}),e(r,{flex:1,spacing:1,children:[e(r,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[e(i,{variant:"h6",sx:{fontWeight:600,wordBreak:"break-all"},children:a.topic}),e(i,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:c(a.createdAt).format("HH:mm DD/MM/YYYY")})]}),e(r,{direction:"row",spacing:1,flexWrap:"wrap",children:e(s,{size:"small",label:a.type.toUpperCase(),sx:{background:p,color:"white",fontWeight:500}})}),a.args.length>0&&e(l,{children:[e(d,{sx:{my:1}}),e(o,{component:"pre",sx:{m:0,fontSize:"0.75rem",whiteSpace:"pre-wrap",wordBreak:"break-all",color:"text.secondary"},children:JSON.stringify(1===a.args.length?a.args[0]:a.args,null,2)})]})]})]}),e(o,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:p}})]})})}),E=[{action:"download-action",label:"Download",icon:()=>e(z,{icon:k,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh manually",icon:()=>e(z,{icon:j,color:"#4caf50"})}],F=[{type:S.Link,action:"back-action",label:e(C,{sx:{display:"block"}})},{type:S.Link,action:"back-action",label:"Main"},{type:S.Link,action:"back-action",label:"Logs"},{type:S.Button,icon:M,action:"search-action",label:"Search"}],I=new b,V=()=>{const[a,o]=w(""),{data:r,hasMore:n,loading:i,onSkip:c}=v({handler:async(e,t)=>{const o=await f.logViewService.getList(),r=x(e,t);for(const n of o)if(new RegExp(a.current,"i").test(n.topic)&&r([n]).done)break;return r().rows},onLoadStart:()=>f.layoutService.setAppbarLoader(!0),onLoadEnd:()=>f.layoutService.setAppbarLoader(!1),reloadSubject:I}),s=g(r),{execute:l}=y(async()=>{const a=new Blob([JSON.stringify(s.current,null,2)],{type:"application/json"}),e=URL.createObjectURL(a);f.layoutService.downloadFile(e,`logs_${Date.now()}.json`)},{onLoadStart:()=>f.layoutService.setAppbarLoader(!0),onLoadEnd:()=>f.layoutService.setAppbarLoader(!1)});return e(H,{children:[e(m,{items:F,actions:E,onAction:async a=>{"back-action"===a&&f.routerService.push("/"),"download-action"===a&&l(),"update-now"===a&&(o(""),await I.next()),"search-action"===a&&(async()=>{const a=await f.layoutService.prompt("Search keyword");if(a)return o(a),void I.next();o(""),I.next()})()}}),e(t,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:i,onDataRequest:c,bufferSize:L,hasMore:n,children:r.map(a=>e(D,{data:a,sx:{mb:1}},a.id))})]})};export{V as LogPage,V as default};
|
package/build/modules/frontend/build/assets/{markdownit-D7gOrFrx.js → markdownit-Dxjq0iuu.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aL as e,aM as t}from"./index-
|
|
1
|
+
import{aL as e,aM as t}from"./index-CZCYDmpG.js";function r(e,t){for(var r=0;r<t.length;r++){const o=t[r];if("string"!=typeof o&&!Array.isArray(o))for(const t in o)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(o,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var o=t();const n=r({__proto__:null,default:e(o)},[o]);export{n as m};
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
|
|
141
141
|
rel="stylesheet"
|
|
142
142
|
/>
|
|
143
|
-
<script type="module" crossorigin src="/assets/index-
|
|
143
|
+
<script type="module" crossorigin src="/assets/index-CZCYDmpG.js"></script>
|
|
144
144
|
<link rel="stylesheet" crossorigin href="/assets/index-DrRm3Jka.css">
|
|
145
145
|
</head>
|
|
146
146
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backtest-kit/ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"description": "Full-stack UI framework for visualizing cryptocurrency trading signals, backtests, and real-time market data. React dashboard with candlestick charts, signal tracking, and risk analysis.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Petr Tripolsky",
|
|
@@ -92,11 +92,11 @@
|
|
|
92
92
|
"ccxt": "4.5.24",
|
|
93
93
|
"touch": "3.1.1",
|
|
94
94
|
"worker-testbed": "1.0.12",
|
|
95
|
-
"backtest-kit": "5.
|
|
95
|
+
"backtest-kit": "5.5.0",
|
|
96
96
|
"markdown-it": "14.1.0"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"backtest-kit": "^5.
|
|
99
|
+
"backtest-kit": "^5.5.0",
|
|
100
100
|
"markdown-it": "^14.1.0",
|
|
101
101
|
"ccxt": "^4.5.24",
|
|
102
102
|
"typescript": "^5.0.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,f as a,P as i,B as r,S as n,a8 as t,T as s,G as l,C as o,_ as c,F as p,a9 as d,aa as m,ab as u,ac as b,ad as v,ae as y,af as g,a6 as h,ag as k,ah as $,ai as f,aj as x,ak as S,al as _,am as C,i as P,a1 as w,j as L,a2 as A,q as z,Z as O,an as j,ao as E,I as F}from"./index-CeyuVkFA.js";import{C as T,R}from"./Refresh-Bps_3kBG.js";import{K as B}from"./KeyboardArrowLeft-CyFQKXDf.js";const U=e=>{const i={color:"white",fontSize:28};switch(e.type){case"signal.opened":case"partial_profit.available":case"partial_profit.commit":return a(S,{sx:i});case"signal.closed":case"signal_sync.close":return a(h,{sx:i});case"signal.scheduled":return a(C,{sx:i});case"signal.cancelled":return a(_,{sx:i});case"partial_loss.available":case"partial_loss.commit":case"average_buy.commit":return a(f,{sx:i});case"breakeven.available":case"breakeven.commit":return a(x,{sx:i});case"activate_scheduled.commit":case"signal_sync.open":return a(k,{sx:i});case"trailing_stop.commit":case"trailing_take.commit":return a($,{sx:i});case"risk.rejection":return a(g,{sx:i});case"error.info":case"error.validation":return a(y,{sx:i});case"error.critical":return a(v,{sx:i});default:return a(b,{sx:i})}},D=e=>{switch(e.type){case"signal.opened":return`${c("Opened")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.closed":return`${c("Closed")} ${e.symbol} (${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%)`;case"signal.scheduled":return`${c("Scheduled")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.cancelled":return`${c("Cancelled")} ${e.symbol}`;case"partial_profit.available":return`${c("Partial profit")} ${e.level}% ${e.symbol}`;case"partial_profit.commit":return`${c("Profit fixed")} ${e.percentToClose}% ${e.symbol}`;case"partial_loss.available":return`${c("Partial loss")} ${e.level}% ${e.symbol}`;case"partial_loss.commit":return`${c("Loss fixed")} ${e.percentToClose}% ${e.symbol}`;case"breakeven.available":return`${c("Breakeven available")} ${e.symbol}`;case"breakeven.commit":return`${c("Breakeven set")} ${e.symbol}`;case"activate_scheduled.commit":return`${c("Activated")} ${e.position.toUpperCase()} ${e.symbol}`;case"average_buy.commit":return`${c("Average Buy")} ${e.symbol}`;case"trailing_stop.commit":return`${c("Trailing stop")} ${e.symbol}`;case"trailing_take.commit":return`${c("Trailing take")} ${e.symbol}`;case"signal_sync.open":return`${c("Sync Open")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal_sync.close":return`${c("Sync Close")} ${e.symbol} (${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%)`;case"risk.rejection":return`${c("Rejected")} ${e.position.toUpperCase()} ${e.symbol}`;case"error.info":return`${c("Error")}: ${e.message}`;case"error.validation":return`${c("Validation")}: ${e.message}`;case"error.critical":return`${c("Critical")}: ${e.message}`;default:return c("Unknown")}},W=e=>{switch(e.type){case"signal.opened":return c("Signal Opened");case"signal.closed":return c("Signal Closed");case"signal.scheduled":return c("Signal Scheduled");case"signal.cancelled":return c("Signal Cancelled");case"partial_profit.available":return c("Partial Profit Available");case"partial_profit.commit":return c("Partial Profit Commit");case"partial_loss.available":return c("Partial Loss Available");case"partial_loss.commit":return c("Partial Loss Commit");case"breakeven.available":return c("Breakeven Available");case"breakeven.commit":return c("Breakeven Commit");case"activate_scheduled.commit":return c("Activated Scheduled");case"average_buy.commit":return c("Average Buy");case"trailing_stop.commit":return c("Trailing Stop");case"trailing_take.commit":return c("Trailing Take");case"signal_sync.open":return c("Signal Sync Open");case"signal_sync.close":return c("Signal Sync Close");case"risk.rejection":return c("Risk Rejection");case"error.info":return c("Info Error");case"error.validation":return c("Validation Error");case"error.critical":return c("Critical Error");default:return c("Unknown")}},I=e=>"symbol"in e,M=e=>"position"in e,N=e=>"priceOpen"in e&&"priceTakeProfit"in e&&"priceStopLoss"in e,Y=e=>"pnlPercentage"in e,H=e=>"level"in e,V=e=>"percentToClose"in e,q=e=>"currentPrice"in e,K=e=>"duration"in e,G=e=>"closeReason"in e,Z=e=>"cancelReason"in e,J=e=>"priceClose"in e,Q=e=>"percentShift"in e,X=e=>"note"in e&&!!e.note,ee=e=>"message"in e,ae=e=>"rejectionNote"in e,ie=e=>"activePositionCount"in e,re=e=>"effectivePriceOpen"in e,ne=e=>"totalEntries"in e&&e.totalEntries>1,te=e=>"originalPriceOpen"in e&&"priceOpen"in e&&e.originalPriceOpen!==e.priceOpen,se=e=>"totalPartials"in e&&e.totalPartials>0,le=e=>"cost"in e,oe=e=>"pnlPriceOpen"in e&&"pnlPriceClose"in e&&"pnlCost"in e&&"pnlEntries"in e,ce=e.forwardRef(({item:e,className:b,style:v,sx:y},g)=>{const h=(e=>{switch(e.type){case"signal.opened":case"activate_scheduled.commit":case"signal_sync.open":return"#4CAF50";case"signal.closed":case"signal_sync.close":return"#2196F3";case"signal.scheduled":case"average_buy.commit":case"error.info":case"error.validation":return"#FF9800";case"signal.cancelled":default:return"#9E9E9E";case"partial_profit.available":case"partial_profit.commit":return"#8BC34A";case"partial_loss.available":case"partial_loss.commit":return"#FF5722";case"breakeven.available":case"breakeven.commit":return"#00BCD4";case"trailing_stop.commit":case"trailing_take.commit":return"#673AB7";case"risk.rejection":return"#F44336";case"error.critical":return"#D32F2F"}})(e),k=(e=>"timestamp"in e)(e)?e.timestamp:Date.now();return a("div",{className:b,style:v,ref:g,children:a(i,{variant:"outlined",onClick:()=>(e=>{switch(e.type){case"risk.rejection":P.layoutService.pickRisk(e.id);break;case"signal.opened":P.layoutService.pickSignalOpened(e.id);break;case"signal.closed":P.layoutService.pickSignalClosed(e.id);break;case"signal.scheduled":P.layoutService.pickSignalScheduled(e.id);break;case"signal.cancelled":P.layoutService.pickSignalCancelled(e.id);break;case"partial_profit.available":P.layoutService.pickPartialProfitAvailable(e.id);break;case"partial_profit.commit":P.layoutService.pickPartialProfitCommit(e.id);break;case"partial_loss.available":P.layoutService.pickPartialLossAvailable(e.id);break;case"partial_loss.commit":P.layoutService.pickPartialLossCommit(e.id);break;case"breakeven.available":P.layoutService.pickBreakevenAvailable(e.id);break;case"breakeven.commit":P.layoutService.pickBreakevenCommit(e.id);break;case"trailing_stop.commit":P.layoutService.pickTrailingStop(e.id);break;case"trailing_take.commit":P.layoutService.pickTrailingTake(e.id);break;case"activate_scheduled.commit":P.layoutService.pickActivateScheduled(e.id);break;case"average_buy.commit":P.layoutService.pickAverageBuyCommit(e.id);break;case"signal_sync.open":P.layoutService.pickSignalSyncOpen(e.id);break;case"signal_sync.close":P.layoutService.pickSignalSyncClose(e.id)}})(e),sx:{transition:"box-shadow 0.2s ease",cursor:"pointer",display:"flex",alignItems:"stretch",justifyContent:"stretch","&:hover":{boxShadow:4},...y},children:a(r,{sx:{flex:1,position:"relative",overflow:"hidden",height:"100%",width:"100%",borderRadius:"12px"},children:[a(n,{direction:"row",spacing:2,sx:{p:2},children:[a(t,{sx:{width:56,height:56,background:h},children:U(e)}),a(n,{flex:1,spacing:1,children:[a(n,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[a(s,{variant:"h6",sx:{fontWeight:600},children:D(e)}),a(s,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:l(k).format("HH:mm DD/MM/YYYY")})]}),a(n,{direction:"row",spacing:1,flexWrap:"wrap",children:[a(o,{size:"small",label:W(e),sx:{background:h,color:"white",fontWeight:500}}),I(e)&&a(o,{size:"small",label:e.symbol,variant:"outlined"}),M(e)&&a(o,{size:"small",label:e.position.toUpperCase(),variant:"outlined",color:"long"===e.position?"success":"error"}),Y(e)&&a(o,{size:"small",label:`PnL: ${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`,color:e.pnlPercentage>=0?"success":"error",variant:"outlined"}),H(e)&&a(o,{size:"small",label:`${c("Level")}: ${e.level}%`,variant:"outlined"}),V(e)&&a(o,{size:"small",label:`${c("Close")}: ${e.percentToClose}%`,variant:"outlined"}),K(e)&&a(o,{size:"small",label:`${c("Duration")}: ${e.duration} ${c("min")}`,variant:"outlined"}),G(e)&&a(o,{size:"small",label:e.closeReason,variant:"outlined",color:"info"}),Z(e)&&a(o,{size:"small",label:e.cancelReason,variant:"outlined",color:"info"}),Q(e)&&a(o,{size:"small",label:`${c("Shift")}: ${e.percentShift>0?"+":""}${e.percentShift}%`,variant:"outlined"}),ie(e)&&a(o,{size:"small",label:`${c("Active")}: ${e.activePositionCount}`,variant:"outlined"}),ne(e)&&a(o,{size:"small",label:`${c("Entries")}: ${e.totalEntries}`,variant:"outlined"}),se(e)&&a(o,{size:"small",label:`${c("Partials")}: ${e.totalPartials}`,variant:"outlined"}),le(e)&&a(o,{size:"small",label:`${c("Cost")}: ${e.cost.toFixed(2)}$`,variant:"outlined"}),re(e)&&a(o,{size:"small",label:`${c("Avg entry")}: ${e.effectivePriceOpen}`,variant:"outlined",color:"warning"}),te(e)&&a(o,{size:"small",label:`${c("Orig entry")}: ${e.originalPriceOpen}`,variant:"outlined"})]}),N(e)&&a(p,{children:[a(d,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(s,{variant:"body2",children:[a(s,{component:"span",color:"text.secondary",children:[c("Entry"),":"," "]}),e.priceOpen]}),J(e)&&a(s,{variant:"body2",children:[a(s,{component:"span",color:"text.secondary",children:[c("Close"),":"," "]}),e.priceClose]}),q(e)&&a(s,{variant:"body2",children:[a(s,{component:"span",color:"text.secondary",children:[c("Current"),":"," "]}),e.currentPrice]}),a(s,{variant:"body2",children:[a(s,{component:"span",color:"text.secondary",children:[c("Take Profit"),":"," "]}),e.priceTakeProfit]}),a(s,{variant:"body2",children:[a(s,{component:"span",color:"text.secondary",children:[c("Stop Loss"),":"," "]}),e.priceStopLoss]})]})]}),oe(e)&&a(p,{children:[a(d,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(s,{variant:"body2",children:[a(s,{component:"span",color:"text.secondary",children:[c("PnL Entry"),":"," "]}),e.pnlPriceOpen]}),a(s,{variant:"body2",children:[a(s,{component:"span",color:"text.secondary",children:[c("PnL Exit"),":"," "]}),e.pnlPriceClose]}),a(s,{variant:"body2",children:[a(s,{component:"span",color:"text.secondary",children:[c("PnL"),":"," "]}),a(s,{component:"span",color:e.pnlCost>=0?"success.main":"error.main",children:[e.pnlCost>=0?"+":"",e.pnlCost.toFixed(2),"$"]})]}),a(s,{variant:"body2",children:[a(s,{component:"span",color:"text.secondary",children:[c("Invested"),":"," "]}),e.pnlEntries.toFixed(2),"$"]})]})]})]})]}),X(e)&&a(r,{sx:{px:2,pb:2},children:[a(d,{sx:{mb:1.5}}),a(r,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordWrap:"break-word"},children:a(m,{style:{textWrap:"wrap"},config:u,handler:()=>e.note})})]}),ae(e)&&a(r,{sx:{px:2,pb:2},children:[a(d,{sx:{mb:1.5}}),a(s,{variant:"body2",color:"error",children:e.rejectionNote})]}),ee(e)&&!X(e)&&a(r,{sx:{px:2,pb:2},children:[a(d,{sx:{mb:1.5}}),a(s,{variant:"body2",color:"text.secondary",children:e.message})]}),a(r,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:h}})]})})})}),pe=[{action:"update-now",label:"Refresh manually",icon:()=>a(F,{icon:R,color:"#4caf50"})}],de=[{type:O.Link,action:"back-action",label:a(B,{sx:{display:"block"}})},{type:O.Link,action:"back-action",label:"Main"},{type:O.Link,action:"back-action",label:"Notifications"}],me=new L,ue=()=>{const{data:e,hasMore:i,loading:r,onSkip:n}=w({handler:async(e,a)=>{const i=await P.notificationViewService.getList(),r=A(e,a);for(const n of i)if(r([n]).done)break;return r().rows},onLoadStart:()=>P.layoutService.setAppbarLoader(!0),onLoadEnd:()=>P.layoutService.setAppbarLoader(!1),reloadSubject:me});return a(T,{children:[a(z,{items:de,actions:pe,onAction:async e=>{"back-action"===e&&P.routerService.push("/"),"update-now"===e&&await me.next()}}),a(j,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:r,onDataRequest:n,bufferSize:E,hasMore:i,children:e.map(e=>a(ce,{item:e,sx:{mb:1}},e.id))})]})};export{ue as NotificationPage,ue as default};
|