Browse Source

Managing records

vue
Lev 2 years ago
parent
commit
b4baca34ea
  1. 6
      .idea/workspace.xml
  2. 24
      src/assets/icons/logout.svg
  3. 1
      src/views/Checkout.vue
  4. 80
      src/views/Explore.vue

6
.idea/workspace.xml

@ -2,8 +2,8 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="ddb8afd5-d3ba-47b1-b6d0-227403f1abf7" name="Changes" comment="Checkout">
<change afterPath="$PROJECT_DIR$/src/assets/icons/logout.svg" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/result.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/result.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/views/Checkout.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/Checkout.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/views/Explore.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/Explore.vue" afterDir="false" />
</list>
@ -92,7 +92,9 @@
<workItem from="1673195751389" duration="2458000" />
<workItem from="1673683299593" duration="12019000" />
<workItem from="1673906442760" duration="1896000" />
<workItem from="1674161982371" duration="13824000" />
<workItem from="1674161982371" duration="16180000" />
<workItem from="1674453019641" duration="3282000" />
<workItem from="1674576152071" duration="4406000" />
</task>
<task id="LOCAL-00001" summary="Wrote the landing">
<created>1670844191163</created>

24
src/assets/icons/logout.svg

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg
width="800px"
height="800px"
viewBox="0 0 24 24"
fill="none"
version="1.1"
id="svg10005"
xmlns="http://www.w3.org/2000/svg">
<defs
id="defs10009" />
<path
d="M7.87828 12.07C7.87828 11.66 8.21828 11.32 8.62828 11.32H14.1083V2.86C14.0983 2.38 13.7183 2 13.2383 2C7.34828 2 3.23828 6.11 3.23828 12C3.23828 17.89 7.34828 22 13.2383 22C13.7083 22 14.0983 21.62 14.0983 21.14V12.81H8.62828C8.20828 12.82 7.87828 12.48 7.87828 12.07Z"
fill="#292D32"
id="path10001"
style="fill:#ffffff" />
<path
d="M20.5416 11.5402L17.7016 8.69016C17.4116 8.40016 16.9316 8.40016 16.6416 8.69016C16.3516 8.98016 16.3516 9.46016 16.6416 9.75016L18.2016 11.3102H14.1016V12.8102H18.1916L16.6316 14.3702C16.3416 14.6602 16.3416 15.1402 16.6316 15.4302C16.7816 15.5802 16.9716 15.6502 17.1616 15.6502C17.3516 15.6502 17.5416 15.5802 17.6916 15.4302L20.5316 12.5802C20.8316 12.3002 20.8316 11.8302 20.5416 11.5402Z"
fill="#292D32"
id="path10003"
style="fill:#ffffff" />
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

1
src/views/Checkout.vue

@ -56,7 +56,6 @@ export default {
const transaction = {
validUntil: validness,
messages: [
Object.assign({}, this.result.content_msg),
Object.assign({}, this.result.buy_msg)
]
}

80
src/views/Explore.vue

@ -25,13 +25,16 @@
<div>is owned by
<div class="owner-address">you</div>
</div>
<a :href="result.nft_info.explorer_link">View nft</a>
<br/>
<div id="wallet_input" class="rec-field">
<div style="display: flex; width: 100%">
<p style="width: 9rem">Wallet:</p>
<contenteditable class="record-inp" tag="div" :no-hl="true" :no-html="true" spellcheck="false"
v-model="wallet_rec"></contenteditable>
<div class="record-submit get_b">Save</div>
<div :class="{'record-submit': true, 'get_b': true, 'inactive': !walletChanged}" @click="saveWallet()">
Save
</div>
</div>
</div>
<div id="site_input" class="rec-field">
@ -39,7 +42,8 @@
<p style="width: 9rem;">Site:</p>
<contenteditable class="record-inp" tag="div" :no-hl="true" :no-html="true" spellcheck="false"
v-model="site_rec"></contenteditable>
<div class="record-submit get_b">Save</div>
<div :class="{'record-submit': true, 'get_b': true, 'inactive': !siteChanged}" @click="saveSite()">Save
</div>
</div>
</div>
</div>
@ -62,6 +66,7 @@ import RotateSquare2 from "../components/RotateSquare2.vue";
import {get_domain_result, get_records} from "../result";
import {convertAddress} from "../utils";
import contenteditable from 'vue-contenteditable';
import {call_api} from "../api";
export default {
name: "Explore",
@ -76,7 +81,9 @@ export default {
result: null,
records: null,
wallet_rec: null,
site_rec: null
site_rec: null,
signingSite: false,
signingWallet: false
}
},
mounted() {
@ -109,8 +116,75 @@ export default {
},
isMine() {
return this.result.owner === this.$store.getters.address;
},
walletChanged() {
return this.records && this.wallet_rec !== this.records.wallet;
},
siteChanged() {
return this.records && this.site_rec !== this.records.site;
}
},
methods: {
async saveWallet() {
if (!this.walletChanged) {
return;
}
// get the message from api at /set-record/site/{site} and sign it with tonconnect (from storage)
let message = await call_api('set-record/wallet/' + this.wallet_rec);
// send the message to tonconnect
let d = new Date();
let validness = parseInt((d.getTime() / 1000).toFixed(0)) + 360000;
let transaction = {
validUntil: validness,
messages: [
{
amount: (0.05 * 1000000000).toString(),
address: this.result.nft_info.address,
payload: message
}
]
};
this.signingWallet = true;
console.log("Sending transaction", transaction);
const result = await this.$store.state.connector.sendTransaction(transaction);
this.signingWallet = false;
if(!result.boc) {
// todo
}
get_records(this.result.nft_info.address).then(r => {
this.records = r;
})
},
async saveSite() {
if (!this.siteChanged) {
return;
}
// get the message from api at /set-record/site/{site} and sign it with tonconnect (from storage)
let message = await call_api('set-record/site/' + this.site_rec);
// send the message to tonconnect
let d = new Date();
let validness = parseInt((d.getTime() / 1000).toFixed(0)) + 360000;
let transaction = {
validUntil: validness,
messages: [
{
amount: (0.05 * 1000000000).toString(),
address: this.result.nft_info.address,
payload: message
}
]
};
this.signingSite = true;
const result = await this.$store.state.connector.sendTransaction(transaction);
this.signingSite = false;
if(!result.boc) {
// todo
}
get_records(this.result.nft_info.address).then(r => {
this.records = r;
})
},
},
watch: {
records: function (val) {
if (val) {

Loading…
Cancel
Save