order page updates
This commit is contained in:
@@ -4,15 +4,30 @@
|
||||
item-selectable="selectable" :show-select="false" :show-expand="true">
|
||||
<template v-slot:item.start="{ value }">{{ dateString(value) }}</template>
|
||||
<template v-slot:item.input="{ item }">
|
||||
<suspense>
|
||||
<token-amount :addr="item.order.tokenIn" :amount="item.order.amountIsInput ? item.order.amount : null"/>
|
||||
<suspense v-if="item.order.amountIsInput">
|
||||
<span>
|
||||
<token-amount :addr="item.order.tokenIn" :amount="item.filled" :raw="true"/>
|
||||
/
|
||||
<token-amount :addr="item.order.tokenIn" :amount="item.order.amount"/>
|
||||
</span>
|
||||
</suspense>
|
||||
<suspense v-if="!item.order.amountIsInput">
|
||||
<token-symbol :addr="item.order.tokenIn"/>
|
||||
</suspense>
|
||||
</template>
|
||||
<template v-slot:item.output="{ item }">
|
||||
<suspense>
|
||||
<token-amount :addr="item.order.tokenOut" :amount="!item.order.amountIsInput ? item.order.amount : null"/>
|
||||
<suspense v-if="!item.order.amountIsInput">
|
||||
<span>
|
||||
<token-amount :addr="item.order.tokenOut" :amount="item.filled" :raw="true"/>
|
||||
/
|
||||
<token-amount :addr="item.order.tokenOut" :amount="item.order.amount"/>
|
||||
</span>
|
||||
</suspense>
|
||||
<suspense v-if="item.order.amountIsInput">
|
||||
<token-symbol :addr="item.order.tokenOut"/>
|
||||
</suspense>
|
||||
</template>
|
||||
<!--
|
||||
<template v-slot:item.remaining="{ item }">
|
||||
<suspense>
|
||||
<token-amount :addr="item.amountToken" :amount="item.remaining"/>
|
||||
@@ -23,6 +38,7 @@
|
||||
<token-amount :addr="item.amountToken" :amount="item.filled"/>
|
||||
</suspense>
|
||||
</template>
|
||||
-->
|
||||
<template v-slot:item.avg="{ item }">
|
||||
<pair-price :base-addr="item.order.tokenIn" :quote-addr="item.order.tokenOut" :value="item.avg" :show-btn="true"/>
|
||||
</template>
|
||||
@@ -43,11 +59,11 @@
|
||||
</v-chip>
|
||||
<v-chip v-if="item.state===OrderState.Underfunded" prepend-icon="mdi-alert" color="warning">Underfunded</v-chip>
|
||||
</template>
|
||||
<template v-slot:item.action="{item}">
|
||||
<btn v-if="item.state===OrderState.Open" icon="mdi-cancel" color="red"
|
||||
@click="cancelOrder(vaultAddr,item.index)">Cancel
|
||||
</btn>
|
||||
</template>
|
||||
<!-- <template v-slot:item.action="{item}">-->
|
||||
<!-- <btn v-if="item.state===OrderState.Open" icon="mdi-cancel" color="red"-->
|
||||
<!-- @click="cancelOrder(vaultAddr,item.index)">Cancel-->
|
||||
<!-- </btn>-->
|
||||
<!-- </template>-->
|
||||
<template v-slot:expanded-row="{item}">
|
||||
<tr>
|
||||
<td> </td>
|
||||
@@ -104,6 +120,7 @@ import NewOrder from "@/components/NewOrder.vue";
|
||||
import PairPrice from "@/components/PairPrice.vue";
|
||||
|
||||
const TokenAmount = defineAsyncComponent(()=>import('./TokenAmount.vue'))
|
||||
const TokenSymbol = defineAsyncComponent(()=>import('./TokenSymbol.vue'))
|
||||
|
||||
const s = useStore()
|
||||
const props = defineProps(['vault'])
|
||||
@@ -127,11 +144,11 @@ const datatableHeaders = [
|
||||
{title: 'Date', align: 'start', key: 'start'},
|
||||
{title: 'Input', align: 'end', key: 'input'},
|
||||
{title: 'Output', align: 'end', key: 'output'},
|
||||
{title: 'Remaining', align: 'end', key: 'remaining'},
|
||||
{title: 'Filled', align: 'end', key: 'filled'},
|
||||
// {title: 'Remaining', align: 'end', key: 'remaining'},
|
||||
// {title: 'Filled', align: 'end', key: 'filled'},
|
||||
{title: 'Avg Price', align: 'end', key: 'avg'},
|
||||
{title: 'Status', align: 'end', key: 'status'},
|
||||
{title: '', align: 'end', key: 'action'},
|
||||
// {title: '', align: 'end', key: 'action'},
|
||||
];
|
||||
|
||||
const orders = computed(()=>{
|
||||
@@ -236,16 +253,17 @@ function describeTrancheTime(st, isStart, t) {
|
||||
function describeTrancheLine(st, isMin, b, m) {
|
||||
// todo make this a PairPrice
|
||||
if( b===0 && m===0 ) return ''
|
||||
const chainId = useStore().chainId
|
||||
console.log('tranche line', isMin, b, m)
|
||||
const inverted = st.order.tokenIn > st.order.tokenOut
|
||||
const t0 = inverted ? st.order.tokenIn : st.order.tokenOut
|
||||
const t1 = !inverted ? st.order.tokenIn : st.order.tokenOut
|
||||
if( m !== 0 ) {
|
||||
const limit = b + m * s.clock
|
||||
const price = pairPriceAddr(t0, t1, limit);
|
||||
const price = pairPriceAddr(chainId, t0, t1, limit);
|
||||
return 'diagonal ' + (price === null ? null : price.toPrecision(5))
|
||||
}
|
||||
const price = pairPriceAddr(t0, t1, b)
|
||||
const price = pairPriceAddr(chainId, t0, t1, b)
|
||||
return (isMin === st.order.amountIsInput ? 'dont-chase ' : 'limit ') + (price === null ? null : price.toPrecision(5))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user