diff --git a/apollo.config.js b/apollo.config.js index e94457b..5ffdca3 100644 --- a/apollo.config.js +++ b/apollo.config.js @@ -6,7 +6,7 @@ module.exports = { client: { service: { name: 'my-service', - url: 'http://127.0.0.1:9696/graphql' + url: 'https://yat.vit.ooo/graphql' }, // Files processed by the extension includes: ['src/**/*.vue', 'src/**/*.js', 'src/**/*.ts'] diff --git a/package-lock.json b/package-lock.json index 3fcc88a..437a346 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,12 +20,13 @@ "lodash.clonedeep": "^4.5.0", "pinia": "^2.1.7", "qrcode": "^1.5.3", + "qrcode.vue": "^3.4.1", "quasar": "^2.14.3", "tweetnacl": "^1.0.3", "vue": "^3.4.15", "vue-i18n": "^9.9.0", - "vue-router": "^4.2.5", - "vue3-qrcode-reader": "^0.0.1" + "vue-qrcode-reader": "^5.5.3", + "vue-router": "^4.2.5" }, "devDependencies": { "@intlify/vite-plugin-vue-i18n": "^3.4.0", @@ -3601,6 +3602,16 @@ "integrity": "sha512-rkiiTuf/z2wTd4RxFOb+clE7PF4AEJU0hsczbUdkHHBtkUmpWQpEddynNfJYKYtZFJKbq4F+brfekt1kx85IZA==", "dev": true }, + "node_modules/@types/dom-webcodecs": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/@types/dom-webcodecs/-/dom-webcodecs-0.1.11.tgz", + "integrity": "sha512-yPEZ3z7EohrmOxbk/QTAa0yonMFkNkjnVXqbGb7D4rMr+F1dGQ8ZUFxXkyLLJuiICPejZ0AZE9Rrk9wUCczx4A==" + }, + "node_modules/@types/emscripten": { + "version": "1.39.10", + "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.39.10.tgz", + "integrity": "sha512-TB/6hBkYQJxsZHSqyeuO1Jt0AB/bW6G7rHt9g7lML7SOF6lbgcHvw/Lr+69iqN0qxgXLhWKScAon73JNnptuDw==" + }, "node_modules/@types/eslint": { "version": "8.56.2", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.2.tgz", @@ -5081,6 +5092,15 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/barcode-detector": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/barcode-detector/-/barcode-detector-2.2.2.tgz", + "integrity": "sha512-JcSekql+EV93evfzF9zBr+Y6aRfkR+QFvgyzbwQ0dbymZXoAI9+WgT7H1E429f+3RKNncHz2CW98VQtaaKpmfQ==", + "dependencies": { + "@types/dom-webcodecs": "^0.1.11", + "zxing-wasm": "1.1.3" + } + }, "node_modules/base64-arraybuffer-es6": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/base64-arraybuffer-es6/-/base64-arraybuffer-es6-0.7.0.tgz", @@ -5332,11 +5352,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/callforth": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/callforth/-/callforth-0.3.1.tgz", - "integrity": "sha512-Q2zPfqnwoKsb1DTVCr4lmhe49wKNBsMmNlbudjleu3/co+Nw1pOqFHYJHrW3VZ253ou9AAr+xauQR0C55NPdzA==" - }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -5772,6 +5787,7 @@ "version": "3.35.1", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.35.1.tgz", "integrity": "sha512-IgdsbxNyMskrTFxa9lWHyMwAJU5gXOPP+1yO+K59d50VLVAIDAbs7gIv705KzALModfK3ZrSZTPNpC0PQgIZuw==", + "dev": true, "hasInstallScript": true, "funding": { "type": "opencollective", @@ -11100,6 +11116,14 @@ "node": ">=10.13.0" } }, + "node_modules/qrcode.vue": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/qrcode.vue/-/qrcode.vue-3.4.1.tgz", + "integrity": "sha512-wq/zHsifH4FJ1GXQi8/wNxD1KfQkckIpjK1KPTc/qwYU5/Bkd4me0w4xZSg6EXk6xLBkVDE0zxVagewv5EMAVA==", + "peerDependencies": { + "vue": "^3.0.0" + } + }, "node_modules/qrcode/node_modules/cliui": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", @@ -11761,18 +11785,6 @@ "node": ">= 8" } }, - "node_modules/rtcpeerconnection-shim": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/rtcpeerconnection-shim/-/rtcpeerconnection-shim-1.2.15.tgz", - "integrity": "sha512-C6DxhXt7bssQ1nHb154lqeL0SXz5Dx4RczXZu2Aa/L1NJFnEVDxFwCBo3fqtuljhHIGceg5JKBV4XJ0gW5JKyw==", - "dependencies": { - "sdp": "^2.6.0" - }, - "engines": { - "node": ">=6.0.0", - "npm": ">=3.10.0" - } - }, "node_modules/run-async": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", @@ -11937,11 +11949,6 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true }, - "node_modules/sdp": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/sdp/-/sdp-2.12.0.tgz", - "integrity": "sha512-jhXqQAQVM+8Xj5EjJGVweuEzgtGWb3tmEEpl3CLP3cStInSbVHSg0QWOGQzNq8pSID4JkpeV2mPqlMDLrm0/Vw==" - }, "node_modules/semver": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", @@ -13357,6 +13364,35 @@ "vue": "^3.0.0" } }, + "node_modules/vue-qrcode-reader": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/vue-qrcode-reader/-/vue-qrcode-reader-5.5.3.tgz", + "integrity": "sha512-ZR+3axFuW1rxrBZXhkmH+4x6c7JqYLkrYuBmwKLve2eEVZb3LiuYJdW7HZaWqvuuOo1uMjqFe3MqyFOf4/BGyA==", + "dependencies": { + "barcode-detector": "2.2.2", + "webrtc-adapter": "8.2.3" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/vue-qrcode-reader/node_modules/sdp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/sdp/-/sdp-3.2.0.tgz", + "integrity": "sha512-d7wDPgDV3DDiqulJjKiV2865wKsJ34YI+NDREbm+FySq6WuKOikwyNQcm+doLAZ1O6ltdO0SeKle2xMpN3Brgw==" + }, + "node_modules/vue-qrcode-reader/node_modules/webrtc-adapter": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/webrtc-adapter/-/webrtc-adapter-8.2.3.tgz", + "integrity": "sha512-gnmRz++suzmvxtp3ehQts6s2JtAGPuDPjA1F3a9ckNpG1kYdYuHWYpazoAnL9FS5/B21tKlhkorbdCXat0+4xQ==", + "dependencies": { + "sdp": "^3.2.0" + }, + "engines": { + "node": ">=6.0.0", + "npm": ">=3.10.0" + } + }, "node_modules/vue-router": { "version": "4.2.5", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.2.5.tgz", @@ -13371,17 +13407,6 @@ "vue": "^3.2.0" } }, - "node_modules/vue3-qrcode-reader": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/vue3-qrcode-reader/-/vue3-qrcode-reader-0.0.1.tgz", - "integrity": "sha512-rTZRO2WiBrGRT6pYGMkySNMnEwD9sVlzl9kwPxQ4C0n7I4SXVu60eq8ZQHQTMJAbDTTkbuuW/5reSf+TYFJ5pQ==", - "dependencies": { - "callforth": "^0.3.1", - "core-js": "^3.6.5", - "vue": "^3.0.0", - "webrtc-adapter": "7.7.0" - } - }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -13541,19 +13566,6 @@ "node": ">=10.13.0" } }, - "node_modules/webrtc-adapter": { - "version": "7.7.0", - "resolved": "https://registry.npmjs.org/webrtc-adapter/-/webrtc-adapter-7.7.0.tgz", - "integrity": "sha512-7Bp9OBnx642oJRkom1tNAbeJjUadAq2rh5xLL9YXPw5hVyt2h4hHr5bcoPYDs1stp/mZHSPSQA34YISdnr0DBQ==", - "dependencies": { - "rtcpeerconnection-shim": "^1.2.15", - "sdp": "^2.12.0" - }, - "engines": { - "node": ">=6.0.0", - "npm": ">=3.10.0" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -14072,6 +14084,14 @@ "engines": { "node": ">= 10" } + }, + "node_modules/zxing-wasm": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/zxing-wasm/-/zxing-wasm-1.1.3.tgz", + "integrity": "sha512-MYm9k/5YVs4ZOTIFwlRjfFKD0crhefgbnt1+6TEpmKUDFp3E2uwqGSKwQOd2hOIsta/7Usq4hnpNRYTLoljnfA==", + "dependencies": { + "@types/emscripten": "^1.39.10" + } } } } diff --git a/package.json b/package.json index 72049dd..a6f7b7c 100644 --- a/package.json +++ b/package.json @@ -18,24 +18,25 @@ "concurrently:dev:jest": "concurrently \"quasar dev\" \"jest --watch\"" }, "dependencies": { + "@apollo/client": "^3.8.6", "@chenfengyuan/vue-qrcode": "^2.0.0", "@quasar/extras": "^1.16.9", "@scure/base": "^1.1.5", "@scure/bip39": "^1.2.2", + "@vue/apollo-composable": "^4.0.0", "check-password-strength": "^2.0.7", + "graphql": "^16.8.1", "idb": "^7.1.1", "lodash.clonedeep": "^4.5.0", "pinia": "^2.1.7", "qrcode": "^1.5.3", + "qrcode.vue": "^3.4.1", "quasar": "^2.14.3", "tweetnacl": "^1.0.3", "vue": "^3.4.15", "vue-i18n": "^9.9.0", - "vue-router": "^4.2.5", - "vue3-qrcode-reader": "^0.0.1", - "@apollo/client": "^3.8.6", - "@vue/apollo-composable": "^4.0.0", - "graphql": "^16.8.1" + "vue-qrcode-reader": "^5.5.3", + "vue-router": "^4.2.5" }, "devDependencies": { "@intlify/vite-plugin-vue-i18n": "^3.4.0", @@ -70,4 +71,4 @@ "npm": ">= 6.13.4", "yarn": ">= 1.21.1" } -} \ No newline at end of file +} diff --git a/public/avatars/Rectangle 30.svg b/public/avatars/Rectangle 30.svg new file mode 100644 index 0000000..1ea0e2c --- /dev/null +++ b/public/avatars/Rectangle 30.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/avatars/default-avatar.png b/public/avatars/default-avatar.png new file mode 100644 index 0000000..cd01860 Binary files /dev/null and b/public/avatars/default-avatar.png differ diff --git a/quasar.config.js b/quasar.config.js index 4e9b6d2..ad742ec 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -31,7 +31,11 @@ module.exports = configure(function (/* ctx */) { // https://v2.quasar.dev/quasar-cli/boot-files boot: [ 'i18n', - 'apollo' + 'apollo', + 'db', + 'crypt', + 'utils', + 'fetch' ], // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css @@ -67,7 +71,7 @@ module.exports = configure(function (/* ctx */) { // rebuildCache: true, // rebuilds Vite/linter/etc cache on startup - // publicPath: '/', + publicPath: '/', // analyze: true, // env: {}, // rawDefine: {} diff --git a/src/App.vue b/src/App.vue index 25e7a7b..74baa34 100644 --- a/src/App.vue +++ b/src/App.vue @@ -13,6 +13,24 @@ diff --git a/src/pages/ContactsPage.vue b/src/pages/ContactsPage.vue index cfcfcfe..3ea629c 100644 --- a/src/pages/ContactsPage.vue +++ b/src/pages/ContactsPage.vue @@ -4,53 +4,180 @@ {{ $t('titles.contacts') }} - + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + +

{{ contact.name }}

+ +

{{ contact.addr }}

+
- + +
+ + +
+
+ + +
+
- - diff --git a/src/pages/HelpPage.vue b/src/pages/HelpPage.vue index 1cec4cf..728554d 100644 --- a/src/pages/HelpPage.vue +++ b/src/pages/HelpPage.vue @@ -1,7 +1,82 @@ + + diff --git a/src/pages/IndexPage.vue b/src/pages/IndexPage.vue index dd3b7a6..5284546 100644 --- a/src/pages/IndexPage.vue +++ b/src/pages/IndexPage.vue @@ -8,6 +8,26 @@ const user = userStore() const enter = ref(true) const balance = ref(0) const userLink = ref('yat.li/user/' + user.pk) + +window.addEventListener('resize', function () { + const screenWidth = window.innerWidth + let scaleFactor = 1 + (screenWidth / 500) + scaleFactor = screenWidth < 668 ? scaleFactor / 1.2 : scaleFactor * 1.2 + const circleText = document.querySelector('.circleText') + circleText.style.animation = 'rotateAnimation 30s linear infinite' + + const styleSheet = document.styleSheets[0] + styleSheet.insertRule(` + @keyframes rotateAnimation { + from { + transform: translate(-50%, -50%) scale(${scaleFactor}) rotate(0deg); + } + to { + transform: translate(-50%, -50%) scale(${scaleFactor}) rotate(360deg); + } + } +`, styleSheet.cssRules.length) +}) diff --git a/src/pages/SignUp.vue b/src/pages/SignUp.vue index b77aafd..65f081d 100644 --- a/src/pages/SignUp.vue +++ b/src/pages/SignUp.vue @@ -7,7 +7,7 @@ import russian from 'boot/wordlists/russian.json' import uzbek from 'boot/wordlists/uzbek.json' import { wordlist as english } from '@scure/bip39/wordlists/english' import { wordlist as chinese } from '@scure/bip39/wordlists/simplified-chinese' -import db from 'boot/db' +import { db } from 'boot/db' import { generateMnemonic } from '@scure/bip39' import { pbkdf2 } from '@noble/hashes/pbkdf2' import { sha512 } from '@noble/hashes/sha512' @@ -65,6 +65,10 @@ const mn = ref('') let seed = '' let keys = '' +const goBack = () => { + router.push('/') +} + const gen = (l) => { let wordlist // const wordlist = l === 'ru' ? russian : english @@ -102,7 +106,7 @@ const signup = async () => { console.log(pk.value) user.crypt = seed user.seed = mn.value - router.push('/') + router.push('/profile') } gen(locale.value) @@ -115,6 +119,8 @@ const disabled = computed(() => pwd.value.length < 7) const copySign = (txt) => { copyToClipboard(txt) .then(() => { + isCopedSeed.value = true + isCopedPwd.value = false Notify.create(t('sign.copy')) }) .catch(() => { @@ -124,6 +130,8 @@ const copySign = (txt) => { const copyPwd = (txt) => { copyToClipboard(txt) .then(() => { + isCopedPwd.value = true + isCopedSeed.value = false Notify.create(t('sign.pwd')) }) .catch(() => { @@ -134,36 +142,87 @@ const copyPwd = (txt) => { + + diff --git a/src/pages/generateQr/GenerateQr.vue b/src/pages/generateQr/GenerateQr.vue new file mode 100644 index 0000000..0d7de9e --- /dev/null +++ b/src/pages/generateQr/GenerateQr.vue @@ -0,0 +1,94 @@ + + + + + + + + + + diff --git a/src/pages/sqanQr/ScanQr.vue b/src/pages/sqanQr/ScanQr.vue new file mode 100644 index 0000000..f667fdc --- /dev/null +++ b/src/pages/sqanQr/ScanQr.vue @@ -0,0 +1,307 @@ + + + + + + + + diff --git a/src/pages/sqanQr/modalErrorMessage.vue b/src/pages/sqanQr/modalErrorMessage.vue new file mode 100644 index 0000000..e15bf16 --- /dev/null +++ b/src/pages/sqanQr/modalErrorMessage.vue @@ -0,0 +1,29 @@ + + + diff --git a/src/pages/sqanQr/modalTx.vue b/src/pages/sqanQr/modalTx.vue new file mode 100644 index 0000000..7799dc3 --- /dev/null +++ b/src/pages/sqanQr/modalTx.vue @@ -0,0 +1,30 @@ + + diff --git a/src/pages/topUsers/TopUsersPage.vue b/src/pages/topUsers/TopUsersPage.vue index 015003a..4a02066 100644 --- a/src/pages/topUsers/TopUsersPage.vue +++ b/src/pages/topUsers/TopUsersPage.vue @@ -3,13 +3,13 @@ import { ref } from 'vue' import UserItem from './UserItem.vue' const userItems = ref([ - { id: 1, nickName: 'Тазик Дёгтя', publicKey: 'Ae2tdPwUPEZ6TS3vvgTmvNUZcfr9JnfU1sTq5i5XorEFgH77tJcYP9BX55L', avatar: 'https://s3-alpha-sig.figma.com/img/caed/fd35/f35e2d51acb83d492cdd6f833093392c?Expires=1710115200&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4&Signature=cDGXOuLvb~4vM7tlVVrDmvuZgIZo0~h~3pTs5StFrGIUHFDm84vKoWmwHnIj-oEPV-G~5limhTT83kDNHbpTQLSoiIoAt91n1KvwkS2z~6TIj5gMH4xwhr5BewyzDB2E2A1IogAFSE2q1x2AYk-VpcthIZWlKL9E-ZlLm71zIFTKaQJhxIl~5bMtC5h8eFlXn3eb6PDxjtv~p6s61N5dMWmuTAiX27ZXRlwnm6MWJZRmE7Evvm3Fe21kPSIvpjsR2BXUM3C3i8lXN6jOyjxTkoBPnA~8zzOFMoSRZEq89ObVKNCuQlxcPUw8sF~MifCpVMo8fwiRs4BviqxYFoSk~A__', rank: '1' }, + { id: 1, nickName: 'Тазик Дёгтя', publicKey: 'Ae2tdPwUPEZ6TS3vvgTmvNUZcfr9JnfU1sTq5i5XorEFgH77tJcYP9BX55L', avatar: 'https://static10.tgstat.ru/channels/_0/95/9599d12ba8791240e7a691f31ace35a6.jpg', rank: '1' }, { id: 2, nickName: 'Вупсень', publicKey: '1sTq5i5XTS3vvgTAe2tdPwUPEZ6mvNUZcfr9JnfUorEFgH77tJcYP9BX55L', avatar: 'https://sun9-61.userapi.com/impg/QSHPcb-Be_JXX7E09ckyZC1QaUI9SVrdV7do-g/pA2hg43JTZg.jpg?size=1276x1280&quality=95&sign=c1a77bfb1439d0715541b5f508567ad2&c_uniq_tag=r9oFUCQ2oNoAU9iza9izH2BlA1JK062VgFQcebhSy1A&type=album', rank: '2' }, { id: 3, nickName: 'Пупсень', publicKey: '9JnfU1PEZ6TS3vvgTmvNUZcfrsTq5iAe2tdPwU5XorEFgH77tJcYP9BX55L', avatar: 'https://kartinkof.club/uploads/posts/2023-05/1683383915_kartinkof-club-p-vupsen-kartinki-27.jpg', rank: '3' }, - { id: 4, nickName: 'Переносной гриль', publicKey: 'wUPEZ6TS3vvgTmvNUZcfr9JnfAe2tdPU1sTq5i5XorEFgH77tJcYP9BX55L', avatar: 'https://yt3.googleusercontent.com/vpuqGSejfwoBuzkPk-yWhZvkfmSYOITGXtpkL4oTMJIDi_2tlEYKcjF5ooIowscn7yeJpm1f=s900-c-k-c0x00ffffff-no-rj', rank: '4' }, + { id: 4, nickName: 'Переносной гриль', publicKey: 'wUPEZ6TS3vvgTmvNUZcfr9JnfAe2tdPU1sTq5i5XorEFgH77tJcYP9BX55L', avatar: 'https://mykaleidoscope.ru/x/uploads/posts/2022-09/1663138463_42-mykaleidoscope-ru-p-veselii-samurai-krasivo-43.jpg', rank: '4' }, { id: 5, nickName: 'Семен', publicKey: 'rEFgH77tJcYPAe2tdPwUPEZ6TS3vvgTmvNUZcfr9JnfU1sTq5i5Xo9BX55L', avatar: 'https://img.goodfon.ru/original/2048x2048/6/c5/zak-efron-aktere-paren-foto.jpg', rank: '5' }, - { id: 6, nickName: 'Сторож Совести', publicKey: 'nf2tdPwUPEZ6TS3vvgTmvNUZcfr9JU1sTq5i5XorEFgH77tJcAeYP9BX55L', avatar: 'https://s3-alpha-sig.figma.com/img/7a07/a920/115748a2208f913bb0e1847aa9b9daf8?Expires=1710115200&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4&Signature=EIxl9YQW6i11lZqKjRFbivwRtMlLAFR0rq1cGjDaLMQ2IMjDnxcJWfZqYWErmwWITQfTM2MD8NgRmGrgWMfiWcXU50PXaoqArPKxtoML~JqF9c4ZHobq9K~Dkt9gfnt9aZ64IfT-v1O3lJ36YHTH82wbBt0C~6iaoCT4CLccZwUwMFUOLOvy19ZPLA20zTQslFM620nEgBplo6vuA70dBfNtBCuSdFUdJiaEOabvda~Np2p1VBsCx4nf5J3v4GF2fCIzeJC4WwWHcw8d-V6f1BVzf1VZh46rTq4MkE80S23TgnVWH1YfLuE5gHL0XDtzqd4ADr~C32juUPjxAy~0hg__', rank: '6' }, - { id: 7, nickName: 'Vika', publicKey: '3vvgTmvNUAe2tdPwUPEZ6TSZcfr9JnfU1sTq5i5XorEFgH77tJcYP9BX55L', avatar: 'https://s3-alpha-sig.figma.com/img/31be/4e70/c81034cd57b4dcf8f41bebe70b816a49?Expires=1710115200&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4&Signature=egVtaBDb5XlkWppxqXpLIfM-ikdqdC5ajm9Xh9ApaB5XLIdBdkhnLnhASoAv0PD6kZzppDt1YUB-KII6oYbPjen6E6elmaXBFDfDDzfoZ~Em5vgHFS~75k1GFXpGsnStD9aY77I0NCPzfrfVxxdspWmB6d-WMazKA9mqI1i-UordY8kSrtRts5j8vR3yUF-KQc4tKFNv-6Sys1nwiO0XoVKTB6W-XfrH9qPqtqyLt1L93PTAZiCVblYvsGQXP5cntW1ANHxl7A93ryq3ZuMrr-tPiBOcXQQ2fOYSGCTVyYuQvHQW3QIn-bs9JypZqfVkDa8bnf80IZcjxTK5JwA31A__', rank: '7' } + { id: 6, nickName: 'Сторож Совести', publicKey: 'nf2tdPwUPEZ6TS3vvgTmvNUZcfr9JU1sTq5i5XorEFgH77tJcAeYP9BX55L', avatar: 'https://i.pinimg.com/736x/ba/33/ca/ba33caa17bcbae16ebb35514acf740bd.jpg', rank: '6' }, + { id: 7, nickName: 'Vika', publicKey: '3vvgTmvNUAe2tdPwUPEZ6TSZcfr9JnfU1sTq5i5XorEFgH77tJcYP9BX55L', avatar: 'https://sun6-22.userapi.com/s/v1/if1/Kx0oxhQzfzd4-V1EiwtJIqbzg3r5IjfLnVnqkXOcbV02dLx9FlmKmxOiZaWhcEEJiCrttjZY.jpg?size=1600x1600&quality=96&crop=482,0,1600,1600&ava=1', rank: '7' } ]) diff --git a/src/pages/topUsers/UserItem.vue b/src/pages/topUsers/UserItem.vue index c5689f6..be37c35 100644 --- a/src/pages/topUsers/UserItem.vue +++ b/src/pages/topUsers/UserItem.vue @@ -1,4 +1,4 @@ - + + diff --git a/src/pages/topUsers/addFriend.js b/src/pages/topUsers/addFriend.js new file mode 100644 index 0000000..6d6c116 --- /dev/null +++ b/src/pages/topUsers/addFriend.js @@ -0,0 +1,3 @@ +export default () => { + return true // temporary maintenance +} diff --git a/src/pages/topUsers/sendMessage.js b/src/pages/topUsers/sendMessage.js new file mode 100644 index 0000000..6d6c116 --- /dev/null +++ b/src/pages/topUsers/sendMessage.js @@ -0,0 +1,3 @@ +export default () => { + return true // temporary maintenance +} diff --git a/src/pages/topUsers/transaction.js b/src/pages/topUsers/transaction.js new file mode 100644 index 0000000..6d6c116 --- /dev/null +++ b/src/pages/topUsers/transaction.js @@ -0,0 +1,3 @@ +export default () => { + return true // temporary maintenance +} diff --git a/src/pages/user/UserProfile.vue b/src/pages/user/UserProfile.vue index 955fcc2..072c870 100644 --- a/src/pages/user/UserProfile.vue +++ b/src/pages/user/UserProfile.vue @@ -1,13 +1,166 @@ + + + + diff --git a/src/pages/user/UserTx.vue b/src/pages/user/UserTx.vue index b94f3b9..03b7476 100644 --- a/src/pages/user/UserTx.vue +++ b/src/pages/user/UserTx.vue @@ -1,142 +1,72 @@ diff --git a/src/router/routes.ts b/src/router/routes.ts index d0b9009..2cfb841 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -9,13 +9,14 @@ const routes: RouteRecordRaw[] = [ { path: 'contacts', component: () => import('pages/ContactsPage.vue') }, { path: 'sign', component: () => import('pages/SignUp.vue') }, { path: 'remember', component: () => import('pages/RestoreFromMnemonic.vue') }, - { path: 'qr', component: () => import('src/pages/ScanQr.vue') }, + { path: 'qr', component: () => import('src/pages/sqanQr/ScanQr.vue') }, { path: 'help', component: () => import('src/pages/HelpPage.vue') }, { path: 'global', component: () => import('src/pages/TxGlobal.vue') }, { path: 'myqr', component: () => import('src/pages/user/UserQR.vue') }, { path: 'friends', component: () => import('src/pages/user/UserFriends.vue') }, { path: 'tx', component: () => import('src/pages/user/UserTx.vue') }, { path: 'profile', component: () => import('src/pages/user/UserProfile.vue') }, + { path: 'generateQr', component: () => import('src/pages/generateQr/GenerateQr.vue') }, { path: 'receive', component: () => import('src/pages/user/UserReceive.vue') }, { path: 'crypto', component: () => import('src/pages/user/UserCrypto.vue') }, { path: 'ask', component: () => import('src/pages/landing/AskPage.vue') }, diff --git a/src/stores/contact.ts b/src/stores/contact.ts new file mode 100644 index 0000000..8e0ea43 --- /dev/null +++ b/src/stores/contact.ts @@ -0,0 +1,47 @@ +import { defineStore } from 'pinia' +import { ComponentInternalInstance, getCurrentInstance } from 'vue' + +export const contactStore = defineStore('contact', () => { + const vm = getCurrentInstance() + const { $db } = (vm as ComponentInternalInstance).appContext.config.globalProperties + + async function getContacts () { + return await $db.getContacts() + } + + async function findContact (name:string) { + return await $db.getContactsByName(name) + } + + async function setContacts (contacts: { name: string, addr: string, id: number }[]) { + const errors = [] + + for (const contact of contacts) { + const { name, addr } = contact + const res = await addContact(name, addr) + if (typeof res === 'string') errors.push(res) + } + + return errors + } + + async function addContact (name: string, addr: string) { + const hasContact = await $db.hasContact(name, addr) + if (hasContact) { + return `Контакт ${name} с таким именем или адресом (${addr}) уже существует` + } + return await $db.addContact({ name, addr }) + } + + async function changeContact (contact:{ name: string, addr: string, id: number }) { + console.log(contact) + + return await $db.set('contacts', contact) + } + + async function deleteContact (id: number) { + return await $db.deleteContact(id) + } + + return { getContacts, addContact, deleteContact, setContacts, findContact, changeContact } +}) diff --git a/src/stores/user.ts b/src/stores/user.ts index e8a6ff6..2dcaf49 100644 --- a/src/stores/user.ts +++ b/src/stores/user.ts @@ -1,6 +1,6 @@ import { defineStore } from 'pinia' import { ref } from 'vue' -import db from 'boot/db' +import { db } from 'boot/db' // TODO: !!STATE!! export const userStore = defineStore('user', () => {