Skip to content

Commit 0e2004c

Browse files
committed
Merge branch 'dev' into fix/failed-tx-status
# Conflicts: # src/components/transactions/TransactionTemplate.vue
2 parents 30080f5 + 141160e commit 0e2004c

File tree

11 files changed

+334
-354
lines changed

11 files changed

+334
-354
lines changed

commitlint.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

commitlint.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { UserConfig } from '@commitlint/types'
2+
3+
const config: UserConfig = {
4+
extends: ['@commitlint/config-conventional']
5+
}
6+
7+
export default config

package-lock.json

Lines changed: 252 additions & 302 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "adamant-im",
33
"version": "4.9.2",
4+
"type": "module",
45
"author": "ADAMANT Foundation <devs@adamant.im>",
56
"license": "GPLv3",
67
"description": "Decentralized Messenger",
@@ -120,8 +121,9 @@
120121
"devDependencies": {
121122
"@capacitor/assets": "^3.0.5",
122123
"@capacitor/cli": "^6.1.2",
123-
"@commitlint/cli": "^19.7.1",
124+
"@commitlint/cli": "^19.8.0",
124125
"@commitlint/config-conventional": "^19.7.1",
126+
"@commitlint/types": "^19.8.0",
125127
"@electron/notarize": "^2.5.0",
126128
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
127129
"@openapitools/openapi-generator-cli": "^2.16.3",
@@ -170,7 +172,7 @@
170172
"vite-plugin-pwa": "^0.20.1",
171173
"vite-plugin-top-level-await": "^1.4.4",
172174
"vite-plugin-wasm": "^3.3.0",
173-
"vitest": "^2.0.5",
175+
"vitest": "^3.0.9",
174176
"vue-cli-plugin-i18n": "^2.3.2",
175177
"vue-cli-plugin-vuetify": "~2.5.8",
176178
"vue-eslint-parser": "^9.4.3",

src/components/AppToolbarCentered.vue

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
<v-row justify="center" no-gutters>
44
<container>
55
<v-toolbar ref="toolbar" :flat="flat" :height="height">
6-
<v-btn v-if="showBack" icon size="small" @click="goBack">
7-
<v-icon :icon="mdiArrowLeft" size="x-large" />
8-
</v-btn>
9-
6+
<back-button v-if="showBack" @click="goBack" />
107
<v-toolbar-title v-if="title" class="a-text-regular-enlarged">
118
<div>{{ title }}</div>
129
<div v-if="subtitle" class="body-1">
@@ -21,8 +18,10 @@
2118

2219
<script>
2320
import { mdiArrowLeft } from '@mdi/js'
21+
import BackButton from '@/components/common/BackButton/BackButton.vue'
2422
2523
export default {
24+
components: { BackButton },
2625
props: {
2726
title: {
2827
type: String,
@@ -96,16 +95,6 @@ export default {
9695
:deep(.v-toolbar-title:not(:first-child)) {
9796
margin-inline-start: 0;
9897
}
99-
100-
:deep(.v-toolbar__content > .v-btn:first-child) {
101-
margin-inline-start: 4px;
102-
}
103-
104-
:deep(.v-btn:hover) {
105-
> .v-btn__overlay {
106-
opacity: 0;
107-
}
108-
}
10998
}
11099
111100
.app-toolbar--fixed {

src/components/Chat/ChatToolbar.vue

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<v-toolbar flat height="56" :class="`${className}`" color="transparent">
3-
<v-btn icon @click="goBack">
3+
<back-button @click="goBack">
44
<v-badge
55
v-if="numOfNewMessages > 0"
66
:value="numOfNewMessages"
@@ -9,8 +9,7 @@
99
:content="numOfNewMessages > 99 ? '99+' : numOfNewMessages"
1010
>
1111
</v-badge>
12-
<v-icon :icon="mdiArrowLeft" />
13-
</v-btn>
12+
</back-button>
1413
<div v-if="!isWelcomeChat(partnerId)">
1514
<slot name="avatar-toolbar" />
1615
</div>
@@ -44,8 +43,10 @@
4443
import partnerName from '@/mixins/partnerName'
4544
import { isAdamantChat, isWelcomeChat } from '@/lib/chat/meta/utils'
4645
import { mdiArrowLeft } from '@mdi/js'
46+
import BackButton from '@/components/common/BackButton/BackButton.vue'
4747
4848
export default {
49+
components: { BackButton },
4950
mixins: [partnerName],
5051
props: {
5152
partnerId: {
@@ -140,13 +141,6 @@ export default {
140141
}
141142
}
142143
143-
:deep(.v-toolbar__content > .v-btn:first-child) {
144-
width: 36px;
145-
height: 36px;
146-
margin: 0 12px;
147-
border-radius: 50%;
148-
}
149-
150144
:deep(.v-text-field) {
151145
@include mixins.a-text-regular-enlarged-bold();
152146
@@ -181,13 +175,6 @@ export default {
181175
margin-bottom: 0;
182176
}
183177
}
184-
185-
:deep(.v-btn) {
186-
&:hover > .v-btn__overlay {
187-
opacity: 0.2;
188-
transition: all 0.4s ease;
189-
}
190-
}
191178
}
192179
193180
/** Themes **/

src/components/LoginForm.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<slot>
55
<!-- Todo: check src/components/PasswordSetDialog.vue component and consider the possibility to move common code to new component -->
66
<v-text-field
7+
ref="passphraseInput"
78
v-model="passphrase"
89
:label="$t('login.password_label')"
910
autocomplete="current-password"
@@ -54,14 +55,14 @@
5455

5556
<script>
5657
import { validateMnemonic } from 'bip39'
57-
import { computed, ref, defineComponent } from 'vue'
58+
import { computed, ref, defineComponent, useTemplateRef } from 'vue'
5859
import { useI18n } from 'vue-i18n'
5960
import { useStore } from 'vuex'
6061
import { useRouter } from 'vue-router'
6162
import { isAxiosError } from 'axios'
6263
import { isAllNodesOfflineError, isAllNodesDisabledError } from '@/lib/nodes/utils/errors'
6364
import { mdiEye, mdiEyeOff } from '@mdi/js'
64-
65+
import { useSaveCursor } from '@/hooks/useSaveCursor'
6566
6667
const className = 'login-form'
6768
const classes = {
@@ -83,10 +84,14 @@ export default defineComponent({
8384
const { t } = useI18n()
8485
const showSpinner = ref(false)
8586
const showPassphrase = ref(false)
87+
const passphraseInput = useTemplateRef('passphraseInput')
88+
8689
const togglePassphraseVisibility = () => {
8790
showPassphrase.value = !showPassphrase.value
8891
}
8992
93+
useSaveCursor(passphraseInput, showPassphrase)
94+
9095
const passphrase = computed({
9196
get() {
9297
return props.modelValue
@@ -143,6 +148,7 @@ export default defineComponent({
143148
return {
144149
showSpinner,
145150
passphrase,
151+
passphraseInput,
146152
showPassphrase,
147153
classes,
148154
mdiEye,
@@ -174,5 +180,4 @@ export default defineComponent({
174180
}
175181
}
176182
}
177-
178183
</style>

src/components/LoginPasswordForm.vue

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<v-form ref="form" class="login-form" @submit.prevent="submit">
33
<v-row no-gutters>
44
<v-text-field
5-
ref="passwordField"
5+
ref="passwordInput"
66
v-model="password"
77
autofocus
88
autocomplete="new-password"
@@ -13,13 +13,7 @@
1313
variant="underlined"
1414
>
1515
<template #append-inner>
16-
<v-btn
17-
@click="togglePasswordVisibility"
18-
icon
19-
:ripple="false"
20-
:size="28"
21-
variant="plain"
22-
>
16+
<v-btn @click="togglePasswordVisibility" icon :ripple="false" :size="28" variant="plain">
2317
<v-icon :icon="showPassword ? mdiEye : mdiEyeOff" :size="24" />
2418
</v-btn>
2519
</template>
@@ -55,14 +49,15 @@
5549

5650
<script>
5751
import { isAxiosError } from 'axios'
58-
import { computed, defineComponent, ref } from 'vue'
52+
import { computed, defineComponent, ref, useTemplateRef } from 'vue'
5953
import { useRouter } from 'vue-router'
6054
import { useStore } from 'vuex'
6155
import { useI18n } from 'vue-i18n'
6256
6357
import { clearDb } from '@/lib/idb'
6458
import { isAllNodesDisabledError, isAllNodesOfflineError } from '@/lib/nodes/utils/errors'
6559
import { mdiEye, mdiEyeOff } from '@mdi/js'
60+
import { useSaveCursor } from '@/hooks/useSaveCursor'
6661
6762
export default defineComponent({
6863
props: {
@@ -76,13 +71,15 @@ export default defineComponent({
7671
const router = useRouter()
7772
const store = useStore()
7873
const { t } = useI18n()
79-
const passwordField = ref(null)
74+
const passwordInput = useTemplateRef('passwordInput')
8075
const showSpinner = ref(false)
8176
const showPassword = ref(false)
8277
const togglePasswordVisibility = () => {
8378
showPassword.value = !showPassword.value
8479
}
8580
81+
useSaveCursor(passwordInput, showPassword)
82+
8683
const password = computed({
8784
get() {
8885
return props.modelValue
@@ -132,7 +129,7 @@ export default defineComponent({
132129
}
133130
134131
return {
135-
passwordField,
132+
passwordInput,
136133
showSpinner,
137134
password,
138135
showPassword,
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<template>
2+
<v-btn :class="className" icon>
3+
<slot />
4+
<v-icon :icon="mdiArrowLeft" />
5+
</v-btn>
6+
</template>
7+
8+
<script setup lang="ts">
9+
import { mdiArrowLeft } from '@mdi/js'
10+
11+
const className = 'back-button'
12+
</script>
13+
14+
<style lang="scss">
15+
.back-button {
16+
&:first-child {
17+
width: 36px;
18+
height: 36px;
19+
margin: 0 12px !important;
20+
border-radius: 50%;
21+
}
22+
23+
&:hover > .v-btn__overlay {
24+
opacity: 0.2;
25+
transition: all 0.4s ease;
26+
}
27+
}
28+
</style>

src/components/transactions/TransactionTemplate.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ export default defineComponent({
290290
)
291291
})
292292
const rate = computed(() => {
293-
if (!transaction.value) return
293+
if (!transaction.value) return Symbols.HOURGLASS
294294
295295
return store.getters['rate/rate'](transaction.value.amount, props.crypto)
296296
})
@@ -309,7 +309,7 @@ export default defineComponent({
309309
const { cryptoTransferDecimals, decimals } = CryptosInfo[commissionTokenLabel]
310310
311311
const tokenFee =
312-
typeof props.fee === 'number'
312+
props.queryStatus === 'success' && typeof props.fee === 'number'
313313
? `${formatAmount(props.fee, cryptoTransferDecimals ?? decimals)} ${commissionTokenLabel}`
314314
: placeholder.value
315315

src/hooks/useSaveCursor.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { watch, type Ref, type ShallowRef } from 'vue'
2+
3+
export function useSaveCursor(
4+
inputRef: Readonly<ShallowRef<HTMLInputElement | null>>,
5+
trigger: Ref<boolean>
6+
) {
7+
watch(trigger, () => {
8+
const inputElement = inputRef.value
9+
if (inputElement) {
10+
const cursorPosition = inputElement.selectionStart || 0
11+
12+
requestAnimationFrame(() => {
13+
inputElement.setSelectionRange(cursorPosition, cursorPosition)
14+
inputElement.focus()
15+
})
16+
}
17+
})
18+
}

0 commit comments

Comments
 (0)