Compare commits

..

4 Commits

Author SHA1 Message Date
tim
7d04d23a89 drag zoom bugfix 2025-03-26 17:10:18 -04:00
tim
dabf6dd60f land on Order page; ui fixes 2025-03-26 16:59:22 -04:00
tim
b1a864ce31 DCABuilder UI tweak 2025-03-20 17:50:34 -04:00
tim
75a197947f new DCABuilder bugfix 2025-03-20 17:02:47 -04:00
7 changed files with 43 additions and 41 deletions

View File

@@ -153,7 +153,16 @@ export async function connectWallet(chainId) {
await updateAccounts(chainId, p) await updateAccounts(chainId, p)
} }
catch (e) { catch (e) {
if (e.reason!=='rejected') { console.log('connectWallet error', e.reason, e)
if (e.reason==='rejected') {
const ws = useWalletStore();
const tx = ws.transaction
if (tx) {
tx.state = TransactionState.Rejected
ws.transaction = null
}
}
else {
console.error(e, e.reason) console.error(e, e.reason)
throw e throw e
} }

View File

@@ -184,7 +184,8 @@ function initChart() {
chart.onIntervalChanged().subscribe(null, changeInterval) chart.onIntervalChanged().subscribe(null, changeInterval)
chart.onDataLoaded().subscribe(null, dataLoaded) chart.onDataLoaded().subscribe(null, dataLoaded)
const tzapi = chart.getTimezoneApi(); const tzapi = chart.getTimezoneApi();
tzapi.onTimezoneChanged().subscribe(null, (tz)=>{if (tz==='exchange') tz='Etc/UTC'; prefs.timezone=tz;}) tzapi.onTimezoneChanged().subscribe(null, (tz)=>{if (tz==='exchange') tz='Etc/UTC'; s.timeZone=tz})
s.timeZone = tzapi.getTimezone().id
// chart.onHoveredSourceChanged().subscribe(null, ()=>console.log('hovered source changed', arguments)) // chart.onHoveredSourceChanged().subscribe(null, ()=>console.log('hovered source changed', arguments))
// chart.selection().onChanged().subscribe(null, s => console.log('selection', chart.selection().allSources())); // chart.selection().onChanged().subscribe(null, s => console.log('selection', chart.selection().allSources()));
const symbolExt = chart.symbolExt(); const symbolExt = chart.symbolExt();
@@ -357,8 +358,8 @@ function doHandleCrosshairMovement(point) {
} }
const points = structuredClone(shape.getPoints()); const points = structuredClone(shape.getPoints());
const lpbe = shape._model._linePointBeingEdited const lpbe = shape._model._linePointBeingEdited
points[lpbe] = point points[lpbe===null?0:lpbe] = point
// console.log('drag calling onPoints', points, shape, lpbe) // console.log('calling onDrag', points, shape)
invokeCallbacks(shapeCallbacks[shapeId], 'onDrag', shapeId, shape, points) invokeCallbacks(shapeCallbacks[shapeId], 'onDrag', shapeId, shape, points)
} }
} }

View File

@@ -157,6 +157,7 @@ async function placeOrder() {
async function doPlaceOrder() { async function doPlaceOrder() {
console.log('place orders') console.log('place orders')
showWarnings.value = false
if (ws.transaction!==null) { if (ws.transaction!==null) {
console.error('Transaction already in progress') console.error('Transaction already in progress')
} }

View File

@@ -2,6 +2,8 @@
<builder-panel :order="order" :builder="builder" :build-tranches="buildTranches" <builder-panel :order="order" :builder="builder" :build-tranches="buildTranches"
:adjust-shapes="adjustShapes" :delete-shapes="deleteShapes"> :adjust-shapes="adjustShapes" :delete-shapes="deleteShapes">
<div class="d-flex flex-column" style="width: 100%;"> <div class="d-flex flex-column" style="width: 100%;">
<h3>DCA</h3>
<div class="d-flex flex-row"> <div class="d-flex flex-row">
<div class="align-self-center">Start:</div> <div class="align-self-center">Start:</div>
<absolute-time-entry v-model="startTime"/> <absolute-time-entry v-model="startTime"/>
@@ -110,12 +112,8 @@ const parts = computed({
v = Number(v) v = Number(v)
v = Math.max(1, Math.min(1000,v)) v = Math.max(1, Math.min(1000,v))
props.builder.tranches = v props.builder.tranches = v
let interval = (props.builder.endTime-props.builder.startTime) / v props.builder.endTime = props.builder.startTime + props.builder.interval * v
if (interval < 60) { setPoints(null, true)
interval = 60
props.builder.endTime = props.builder.startTime + interval * v
setPoints(null, true)
}
} }
}) })
@@ -153,7 +151,14 @@ const displayedInterval = computed({
}) })
const timeUnits = [['minutes', 60], ['hours', 3600], ['days', 86400]] const timeUnits = [['minutes', 60], ['hours', 3600], ['days', 86400]]
const _timeUnitIndex = ref(0); function defaultTimeUnit() {
let i=1
while( i < timeUnits.length && props.builder.interval >= timeUnits[i][1] )
i++
console.log('defaultTimeUnit', props.builder.interval, i-1)
return i-1
}
const _timeUnitIndex = ref(defaultTimeUnit());
const timeUnitIndex = computed({ const timeUnitIndex = computed({
get() {return _timeUnitIndex.value}, get() {return _timeUnitIndex.value},
set(v) {_timeUnitIndex.value = v % timeUnits.length} set(v) {_timeUnitIndex.value = v % timeUnits.length}

View File

@@ -6,7 +6,7 @@
:set-values="setLines" :set-weights="setWeights" :set-values="setLines" :set-weights="setWeights"
:set-shapes="setShapes" :set-shapes="setShapes"
:std-width="stdWidth" :build-tranches="buildTranches"> :std-width="stdWidth" :build-tranches="buildTranches">
<table> <table v-if="!co.drawing">
<tbody> <tbody>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>

View File

@@ -23,16 +23,18 @@
<v-icon icon="mdi-chat-alert-outline" color="grey" class="mr-1"/> <v-icon icon="mdi-chat-alert-outline" color="grey" class="mr-1"/>
Click the chart! Click the chart!
</div> </div>
<div v-if="rungs>1" class="mx-2 d-flex align-center"> <div v-if="rungs>1" class="mx-2 d-flex align-start">
<v-slider v-if="rungs>1" :direction="orientation?'vertical':'horizontal'" min="-100" max="100" v-model="skew100" <div class="d-flex align-center mt-2">
class="no-slider-bg ml-2 mr-4" hide-details/> <v-slider v-if="rungs>1" :direction="orientation?'vertical':'horizontal'" min="-100" max="100" v-model="skew100"
<v-text-field type="number" v-model="skew100" min="-100" max="100" class="no-slider-bg ml-2 mr-4" hide-details/>
density="compact" hide-details variant="outlined" label="Skew" step="5" <v-text-field type="number" v-model="skew100" min="-100" max="100"
:color="color" :base-color="color" class="skew"> density="compact" hide-details variant="outlined" label="Skew" step="5"
<template v-slot:prepend> :color="color" :base-color="color" class="skew">
<v-btn icon="mdi-scale-balance" variant="plain" @click="builder.skew=0" :color="color"/> <template v-slot:prepend>
</template> <v-btn icon="mdi-scale-balance" variant="plain" @click="builder.skew=0" :color="color"/>
</v-text-field> </template>
</v-text-field>
</div>
</div> </div>
</builder-panel> </builder-panel>
</template> </template>
@@ -259,9 +261,9 @@ function translateOnModel(shape) {
if (!this.beingDragged()) if (!this.beingDragged())
return return
const prev = getModelValue(oldModel) const prev = getModelValue(oldModel)
const cur = vectorize(getModelValue(this.model)) const cur = vectorize(getModelValue(model))
const delta = vectorSub(cur, prev) const delta = vectorSub(cur, prev)
// console.log('delta', shape.id, prev, cur, delta) // console.log('translateOnModel delta', shape.id, prev, cur, delta)
let [a, b] = endpoints.value let [a, b] = endpoints.value
a = vectorize(a) a = vectorize(a)
if (!vectorIsZero(delta)) { if (!vectorIsZero(delta)) {

View File

@@ -2,22 +2,6 @@
import { createRouter, createWebHistory } from 'vue-router' import { createRouter, createWebHistory } from 'vue-router'
const routes = [ const routes = [
{
component: () => import('@/corp/CorpLayout.vue'),
path:'/home',
children: [
{
name: 'Home',
path: '/home',
component: () => import('@/corp/Home.vue'),
},
{
name: 'HowItWorks',
path: '/home/how-it-works',
component: () => import('@/corp/HowItWorks.vue'),
},
]
},
{ {
path: '/', path: '/',
component: () => import('@/layouts/chart/ChartLayout.vue'), component: () => import('@/layouts/chart/ChartLayout.vue'),
@@ -28,7 +12,7 @@ const routes = [
// route level code-splitting // route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route // this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited. // which is lazy-loaded when the route is visited.
component: () => import('@/components/chart/ChartVault.vue'), component: () => import('@/components/chart/ChartPlaceOrder.vue'),
}, },
{ {
name: 'Order', name: 'Order',