order view responsiveness

This commit is contained in:
Tim Olson
2023-11-10 18:33:33 -04:00
parent 85a17cf7a9
commit 7fd4b96e99
9 changed files with 111 additions and 33 deletions

View File

@@ -0,0 +1,22 @@
<template>
<div>
<span class="">xs&nbsp;</span>
<span class="d-none d-sm-inline">sm&nbsp;</span>
<span class="d-none d-md-inline">md&nbsp;</span>
<span class="d-none d-lg-inline">lg&nbsp;</span>
<span class="d-none d-xl-inline">xl&nbsp;</span>
<span class="d-none d-xxl-inline">xxl&nbsp;</span>
</div>
</template>
<script setup>
import {useStore} from "@/store/store";
const s = useStore()
</script>
<style scoped lang="scss">
@use "src/styles/vars" as *;
</style>

View File

@@ -19,11 +19,40 @@
</v-card-actions>
</phone-card>
<phone-card v-if="walletOk && providerOk && !chainOk">
<!-- todo Alpha Live
<v-card-title><v-icon icon="mdi-reload-alert" color="warning"/> Change Blockchain</v-card-title>
<v-card-text>
Dexorder works only with <blockchain chain-id="42161"/>. Please switch to the
<blockchain chain-id="42161"/> blockchain in your wallet.
</v-card-text>
-->
<v-card-title><v-icon icon="mdi-hand-wave" color="warning"/>&nbsp;Welcome to Dexorder Alpha!</v-card-title>
<v-card-text>
This alpha test runs on a private blockchain, which you need to set up.
</v-card-text>
<v-card-item>
<ol class="ml-6">
<li>Open Metamask</li>
<li>Click in the upper-left to choose a Network</li>
<li>Click the "Add Network" button</li>
<li>Choose "Add a Network Manually"</li>
<li>Choose "Add a network manually"</li>
<li>Enter the following information:
<ul>
<li>Name: Dexorder Alpha</li>
<li>New RPC URL: https://rpc.alpha.dexorder.trade</li>
<li>Chain ID: 31337</li>
<li>Currency Symbol: ETH</li>
</ul>
</li>
<li>
Save the private test network
</li>
<li>
Open Metamask again and select the "Dexorder Alpha" blockchain for use with this website.
</li>
</ol>
</v-card-item>
</phone-card>
</template>

View File

@@ -2,26 +2,28 @@
<v-table>
<thead>
<tr>
<th>#</th>
<th>Buy Token</th>
<th>Sell Token</th>
<th>Amount</th>
<th>Filled</th>
<th>Remaining</th>
<th>Average Price</th>
<th>Status</th>
<th>&nbsp;</th> <!-- actions -->
<th class="num d-none d-md-table-cell">#</th> <!-- todo placement date instead -->
<th class="token d-none d-sm-table-cell">Buy</th>
<th class="token d-none d-sm-table-cell">Sell</th>
<th class="token d-sm-none">Pair</th>
<th class="amount d-none d-md-table-cell">Amount</th>
<th class="amount">Remaining</th>
<th class="amount">Filled</th>
<th class="amount d-none d-md-table-cell">Avg&nbsp;Price</th>
<th class="status">Status</th>
<th class="cancel d-none d-lg-table-cell">&nbsp;</th>
</tr>
</thead>
<tbody>
<tr v-for="[index, inTokenAddr, outTokenAddr, amount, amountTokenAddr, filled, avgPrice, state] in orders">
<td>{{parseInt(index)+1}}</td>
<td>{{tokenSymbol(inTokenAddr)}}</td>
<td>{{tokenSymbol(outTokenAddr)}}</td>
<td>{{tokenAmount(amountTokenAddr, amount)}}</td>
<td>{{tokenAmount(amountTokenAddr, filled)}}</td>
<td>{{tokenAmount(amountTokenAddr, amount-filled)}}</td>
<td>
<td class="d-none d-md-table-cell" style="width: 1em">{{parseInt(index)+1}}</td>
<td class="token d-none d-sm-table-cell">{{tokenSymbol(inTokenAddr)}}</td>
<td class="token d-none d-sm-table-cell">{{tokenSymbol(outTokenAddr)}}</td>
<td class="pair d-sm-none">Buy {{tokenSymbol(inTokenAddr)}}<br/>Sell {{tokenSymbol(outTokenAddr)}}</td>
<td class="amount d-none d-md-table-cell">{{tokenAmount(amountTokenAddr, amount)}}</td>
<td class="amount">{{tokenAmount(amountTokenAddr, amount-filled)}}</td>
<td class="amount">{{tokenAmount(amountTokenAddr, filled)}}</td>
<td class="amount d-none d-md-table-cell">
{{pairPrice(inTokenAddr, outTokenAddr, vaultAddr, index, avgPrice)}}
<btn v-if="pairPrice(inTokenAddr, outTokenAddr, vaultAddr, index, avgPrice)!==''" size="small"
variant="plain"
@@ -29,14 +31,16 @@
{{pair(inTokenAddr, outTokenAddr, vaultAddr,index)}}
</btn>
</td>
<td>
<td class="status">
<v-chip v-if="state===-1" prepend-icon="mdi-signature" color="yellow">Signing</v-chip>
<v-chip v-if="state===0" prepend-icon="mdi-dots-horizontal" color="green">Open</v-chip>
<v-chip v-if="state===0" class="d-none d-lg-inline" prepend-icon="mdi-dots-horizontal" color="green">Open</v-chip>
<btn v-if="state===0" class="d-none d-sm-inline-block d-lg-none" icon="mdi-cancel" color="red" @click="cancelOrder(vaultAddr,index)">Cancel</btn>
<btn v-if="state===0" class="d-sm-none" variant="plain" icon="mdi-cancel" color="red" @click="cancelOrder(vaultAddr,index)"/>
<v-chip v-if="state===1" prepend-icon="mdi-cancel" color="red">Canceled</v-chip>
<v-chip v-if="state===2" prepend-icon="mdi-check-circle-outline" color="green">Completed</v-chip>
<v-chip v-if="state===3" prepend-icon="mdi-progress-check" color="grey-darken-1">Expired</v-chip>
</td>
<td>
<td class="cancel d-none d-lg-table-cell">
<btn v-if="state===0" icon="mdi-cancel" color="red" @click="cancelOrder(vaultAddr,index)">Cancel</btn>
</td>
</tr>
@@ -150,4 +154,27 @@ const orders = computed(()=>{
<style scoped lang="scss">
@use "src/styles/vars" as *;
// columns
.num {
min-width: 1em;
}
.token {
min-width: 3em;
max-width: 5em;
}
.pair {
min-width: 5em;
}
.amount {
min-width: 3em;
max-width: 6em;
overflow-x: hidden;
text-overflow: ellipsis;
}
.status {
max-width: 8em;
}
.cancel {
}
</style>

View File

@@ -6,22 +6,18 @@
<slot/>
</v-card>
<!-- phones use the entire screen -->
<v-container class="d-sm-none">
<slot/>
</v-container>
<div class="d-sm-none pa-0">
<slot class="pa-0"/>
</div>
</div>
</template>
<script setup>
import {useStore} from "@/store/store";
const s = useStore()
</script>
<style scoped lang="scss">
@use "src/styles/vars" as *;
.phone-card {
max-width: $card-maxw;
}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<needs-provider>
<phone-card>
<phone-card class="toecard">
<v-card-title class="big">DCA / TWAP</v-card-title>
<v-card-subtitle>Multiple tranches over a time range</v-card-subtitle>
<v-card-text>
@@ -301,6 +301,9 @@ function placeOrder() {
<style scoped lang="scss">
@use "@/styles/vars" as *;
.toecard {
max-width: $card-maxw;
}
.token-choice {
width: 16em;
}

View File

@@ -1,8 +1,8 @@
<template>
<v-dialog :model-value="modelValue" @update:modelValue="$emit('update:modelValue', $event)">
<v-card>
<v-card style="max-width: 25em" class="mx-auto">
<v-card-title>
<v-icon icon="mdi-down-arrow"/>&nbsp;Withdraw {{ token.symbol }}
<v-icon icon="mdi-arrow-down-bold" color="grey-darken-1"/>&nbsp;Withdraw {{ token.symbol }}
</v-card-title>
<v-card-item>
<v-text-field class="text-end" type="number" variant="outlined" :min="0" :max="balanceFloat"

View File

@@ -1,8 +1,9 @@
<template>
<v-main>
<v-container>
<v-container class="pa-0">
<div>
<Alerts/>
<!-- <Breakpoints/>-->
<router-view/>
<v-skeleton-loader v-if="!store.chainInfo" type="card" class="order-card"/> <!--todo static chainInfo -->
</div>
@@ -15,6 +16,7 @@ import Alerts from "@/components/Alerts.vue";
import {VSkeletonLoader} from "vuetify/labs/VSkeletonLoader";
import {useStore} from "@/store/store.js";
import NeedsProvider from "@/components/NeedsProvider.vue";
import Breakpoints from "@/components/Breakpoints.vue";
const store = useStore()
</script>

View File

@@ -55,5 +55,4 @@ $heading-font-family: 'Orbitron', sans-serif;
//$heading-font-family: 'Quantico', sans-serif;
//$heading-font-family: 'Chakra Petch', sans-serif;
$sm-breakpoint: 600px;
$card-maxw: 34em;

View File

@@ -1,12 +1,12 @@
<template>
<needs-provider>
<needs-signer>
<v-card title="Orders">
<phone-card title="Orders">
<v-card-item>
<btn icon="mdi-plus" color="green" class="mb-6" @click="$router.push('/twap')">New Dexorder</btn>
<orders/>
</v-card-item>
</v-card>
</phone-card>
</needs-signer>
</needs-provider>
</template>