more UI updates

This commit is contained in:
Tim
2024-03-12 18:48:07 -04:00
parent 9071cf1ef3
commit 82a150df2b
9 changed files with 108 additions and 82 deletions

View File

@@ -9,7 +9,7 @@
:label="order.amountIsTokenA ? 'Amount':('Value in '+co.selectedSymbol.quote.s)"
>
<template v-slot:prepend>
<v-btn variant="tonal" :color="color" class="ml-3"
<v-btn variant="outlined" :color="color" class="ml-3"
:text="(order.buy ? 'Buy ' : 'Sell ') + co.selectedSymbol.base.s"
@click="order.buy=!order.buy"/>
</template>
@@ -50,6 +50,7 @@ import {lightenColor, lightenColor2} from "@/misc.js";
import {useTheme} from "vuetify";
import RowBar from "@/components/chart/RowBar.vue";
import ColorBand from "@/components/chart/ColorBand.vue";
import Color from "color";
const props = defineProps(['order'])
const co = useChartOrderStore()
@@ -66,7 +67,7 @@ function builders(order) {
}
const theme = useTheme().current
const color = computed(()=>props.order.buy?theme.value.colors.success:theme.value.colors.error)
const color = computed(()=>new Color(props.order.buy?theme.value.colors.success:theme.value.colors.error).darken(0.2).string())
const lightColor = computed(() => lightenColor(color.value))
const faintColor = computed(() => lightenColor2(color.value))
const colorStyle = computed(() => { return {'color': color.value} })

View File

@@ -1,18 +1,10 @@
<template>
<div class="d-flex flex-column h-100">
<div class="d-flex mb-1">
<span class="arrow align-self-start"><v-icon icon="mdi-arrow-up-bold" color="green"/></span>
<span class="logo">dexorder</span>
<v-chip text="ALPHA" size='x-small' color="red" class="align-self-start pr-6" variant="text"/>
<v-btn variant="flat" prepend-icon="mdi-plus" @click="co.newOrder" v-if="co.orders.length===0">New Order</v-btn>
<!-- <v-btn variant="flat" prepend-icon="mdi-question" @click="build('Test')">Test</v-btn>-->
<v-btn variant="tonal" prepend-icon="mdi-send" :color="orderColor" v-if="co.orders.length>0">Place Order</v-btn>
<v-btn variant="text" prepend-icon="mdi-cancel" v-if="co.orders.length>0" @click="cancelOrder">Cancel</v-btn>
<div class="w-100 d-flex justify-end">
<v-btn variant="text" icon="mdi-safe-square" color="grey-darken-2" text="Vault" @click="$router.push('/vault')"></v-btn>
<v-btn variant="text" icon="mdi-information-outline" text="Order Status" @click="$router.push('/orders')"></v-btn>
</div>
<toolbar>
<v-btn variant="flat" prepend-icon="mdi-plus" @click="co.newOrder" v-if="co.orders.length===0">New Order</v-btn>
<v-btn variant="text" prepend-icon="mdi-send" :color="orderColor" v-if="co.orders.length>0">Place Order</v-btn>
<v-btn variant="flat" prepend-icon="mdi-cancel" v-if="co.orders.length>0" @click="cancelOrder">Cancel</v-btn>
</toolbar>
<v-dialog v-model="showCancel" max-width="300">
<v-card title="Cancel Order?" text="Do you want to cancel this order and create a new one?">
<v-card-actions>
@@ -22,7 +14,6 @@
</v-card-actions>
</v-card>
</v-dialog>
</div>
<!-- <div v-for="b in co.builderList">{{JSON.stringify(b)}}</div>-->
<div class="overflow-y-auto">
<template v-for="o in co.orders">
@@ -41,6 +32,7 @@ import {useOrderStore, useStore} from "@/store/store.js";
import {routeFinder} from "@/blockchain/route.js";
import ChartOrder from "@/components/chart/ChartOrder.vue";
import {useTheme} from "vuetify";
import Toolbar from "@/components/chart/Toolbar.vue";
const s = useStore()
const co = useChartOrderStore()

View File

@@ -7,7 +7,6 @@ import {computed} from "vue";
const props = defineProps(['color'])
const computedStyle = computed(() => {
console.log('computing bar color')
return {
'background-color': props.color,
'border-color': props.color,

View File

@@ -65,7 +65,7 @@ import {chart} from "@/charts/chart.js";
import {useChartOrderStore} from "@/orderbuild.js";
import Color from "color";
import {HLine} from "@/charts/shape.js";
import {builderDefaults, lightenColor2} from "@/misc.js";
import {builderDefaults, lightenColor2, lineColor} from "@/misc.js";
import {useTheme} from "vuetify";
import {useOrderStore} from "@/store/store.js";
import RowBar from "@/components/chart/RowBar.vue";
@@ -77,6 +77,12 @@ const theme = useTheme().current
const props = defineProps(['order', 'builder'])
const emit = defineEmits(['update:builder'])
function computeDefaultColor() {
const index = props.order.builders.indexOf(props.builder)
return lineColor(props.order.buy, index)
}
const defaultColor = computeDefaultColor()
// Fields must be defined in order to be reactive
builderDefaults(props, emit, {
@@ -87,7 +93,7 @@ builderDefaults(props, emit, {
priceB: null,
rungs: 1,
skew: 0,
color: null,
color: defaultColor,
})
const skew100 = computed( {
@@ -106,7 +112,7 @@ const lineAPrice = computed({
})
const lineA = new HLine(
{price:null,color:null},
{price:null,color:defaultColor},
function (line) {props.builder.priceA = line.price; props.builder.color = line.color; adjustShapes()},
deleteBuilder
)
@@ -120,7 +126,7 @@ const lineBPrice = computed({
})
const lineB = new HLine(
{price:null,color:null},
{price:null,color:props.builder.color.value},
(line)=>{props.builder.priceB = line.price; props.builder.color = line.color; adjustShapes()},
deleteBuilder
)

View File

@@ -1,5 +1,5 @@
<template>
<v-sheet dense class="d-flex align-content-stretch" style="overflow-y: hidden; background-color: inherit !important;">
<row-bar :color="builder.color">
<div class="bg-grey-lighten-1" style="width:1em">&nbsp;</div>
<div style="min-width: 3em; font-size: larger" class="align-self-start ma-3">Market Order</div>
<div>
@@ -12,7 +12,7 @@
<template v-slot:append-inner>%</template>
</v-text-field>
</div>
</v-sheet>
</row-bar>
</template>
<script setup>
@@ -20,6 +20,7 @@ import {useChartOrderStore} from "@/orderbuild.js";
import {builderDefaults} from "@/misc.js";
import {useOrderStore} from "@/store/store.js";
import {computed} from "vue";
import RowBar from "@/components/chart/RowBar.vue";
const co = useChartOrderStore()
const props = defineProps(['order', 'builder'])

View File

@@ -12,9 +12,8 @@ import {computed} from "vue";
import {lightenColor2} from "@/misc.js";
const props = defineProps(['color'])
const faintColor = computed(() => lightenColor2(props.color))
const faintColor = computed(() => lightenColor2(props.color,.70))
const computedStyle = computed(() => {
console.log('computing bar color')
return {
'background-color': props.color,
'border-color': props.color,

View File

@@ -1,28 +1,14 @@
<template>
<div class="d-flex mb-1">
<span class="arrow align-self-start"><v-icon icon="mdi-arrow-up-bold" color="green"/></span>
<span class="arrow align-self-start"><v-icon icon="mdi-arrow-up-bold" :color="theme.colors.success"/></span>
<span class="logo">dexorder</span>
<v-chip text="ALPHA" size='x-small' color="red" class="align-self-start pr-6" variant="text"/>
<v-btn variant="flat" prepend-icon="mdi-plus" @click="co.newOrder" v-if="co.orders.length===0">New Order</v-btn>
<!-- <v-btn variant="flat" prepend-icon="mdi-question" @click="build('Test')">Test</v-btn>-->
<v-btn variant="tonal" prepend-icon="mdi-send" :color="orderColor" v-if="co.orders.length>0">Place Order</v-btn>
<v-btn variant="text" prepend-icon="mdi-cancel" v-if="co.orders.length>0" @click="cancelOrder">Cancel</v-btn>
<slot/>
<div class="w-100 d-flex justify-end">
<v-btn variant="text" icon="mdi-safe-square" color="grey-darken-2" text="Vault" @click="$router.push('/vault')"></v-btn>
<v-btn variant="text" icon="mdi-information-outline" text="Order Status" @click="$router.push('/orders')"></v-btn>
</div>
<v-dialog v-model="showCancel" max-width="300">
<v-card title="Cancel Order?" text="Do you want to cancel this order and create a new one?">
<v-card-actions>
<v-spacer/>
<v-btn @click="()=>showCancel=false">Keep Existing</v-btn>
<v-btn @click="()=>{co.orders.shift(); showCancel=false}" color="red">Cancel Order</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
<script setup>
@@ -40,7 +26,6 @@ const co = useChartOrderStore()
const showCancel = ref(false)
const theme = useTheme().current
const orderColor = computed(()=>co.orders.length===0?null : co.orders[0].buy ? theme.value.colors.success:theme.value.colors.error)
function cancelOrder() {
showCancel.value = true