Browse Source

Fixed the contact editor

vue
Lev 2 years ago
parent
commit
e9051cdd82
  1. 21
      .idea/workspace.xml
  2. 29
      src/components/SiteSettings.vue
  3. 4
      src/views/Explore.vue

21
.idea/workspace.xml

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="ddb8afd5-d3ba-47b1-b6d0-227403f1abf7" name="Changes" comment="Fix domain result when it's not available + remove failed icon"> <list default="true" id="ddb8afd5-d3ba-47b1-b6d0-227403f1abf7" name="Changes" comment="Updated the address">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/api.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/components/SiteSettings.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/SiteSettings.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/views/Explore.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/Explore.vue" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -102,7 +103,8 @@
<workItem from="1678294988188" duration="3137000" /> <workItem from="1678294988188" duration="3137000" />
<workItem from="1678453431365" duration="7802000" /> <workItem from="1678453431365" duration="7802000" />
<workItem from="1678966587213" duration="1715000" /> <workItem from="1678966587213" duration="1715000" />
<workItem from="1679134080413" duration="5756000" /> <workItem from="1679134080413" duration="6305000" />
<workItem from="1679494839005" duration="10779000" />
</task> </task>
<task id="LOCAL-00001" summary="Wrote the landing"> <task id="LOCAL-00001" summary="Wrote the landing">
<created>1670844191163</created> <created>1670844191163</created>
@ -279,7 +281,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1679216484001</updated> <updated>1679216484001</updated>
</task> </task>
<option name="localTasksCounter" value="26" /> <task id="LOCAL-00026" summary="Updated the address">
<created>1679234696595</created>
<option name="number" value="00026" />
<option name="presentableId" value="LOCAL-00026" />
<option name="project" value="LOCAL" />
<updated>1679234696595</updated>
</task>
<option name="localTasksCounter" value="27" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -297,7 +306,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="Wrote the landing" />
<MESSAGE value="TON Web page" /> <MESSAGE value="TON Web page" />
<MESSAGE value="Adaptivity + more assets" /> <MESSAGE value="Adaptivity + more assets" />
<MESSAGE value="DarkLayout + Domain Bar" /> <MESSAGE value="DarkLayout + Domain Bar" />
@ -322,6 +330,7 @@
<MESSAGE value="Site constructor" /> <MESSAGE value="Site constructor" />
<MESSAGE value="Adding links (contacts)" /> <MESSAGE value="Adding links (contacts)" />
<MESSAGE value="Fix domain result when it's not available + remove failed icon" /> <MESSAGE value="Fix domain result when it's not available + remove failed icon" />
<option name="LAST_COMMIT_MESSAGE" value="Fix domain result when it's not available + remove failed icon" /> <MESSAGE value="Updated the address" />
<option name="LAST_COMMIT_MESSAGE" value="Updated the address" />
</component> </component>
</project> </project>

29
src/components/SiteSettings.vue

@ -39,18 +39,17 @@
<div style="display: flex; width: 100%"> <div style="display: flex; width: 100%">
<p style="width: 9rem;">Add link:</p> <p style="width: 9rem;">Add link:</p>
<div v-for="link_type in link_types" :key="link_type" class="link-type" @click="addLink(link_type)"> <div v-for="link_type in link_types" :key="link_type" class="link-type" @click="addLink(link_type)">
<i class="link-type-icon add" :class="link_icons[link_type]" <i class="link-type-icon add" :class="link_icons[link_type]"></i>
@click="constructor_params.link_type = link_type"></i>
</div> </div>
</div> </div>
<!-- The links themselves (editing constructor_params.contacts[link_type] for each key) --> <!-- The links themselves (editing constructor_params.contacts[link_type] for each key) -->
<div v-for="link_type in Object.keys(constructor_params.contacts)" :key="link_type" class="link-type"> <div v-for="contact in contacts" :key="contact[0]" class="link-type">
<div style="display: flex; width: 100%"> <div style="display: flex; width: 100%">
<!-- the icon as a label --> <!-- the icon as a label -->
<i style="width: 9rem;" class="link-type-icon" :class="link_icons[link_type]"></i> <i style="width: 9rem;" class="link-type-icon" :class="link_icons[contact[0]]"></i>
<!-- editing the link - constructor_params.contacts[link_type] --> <!-- editing the link - constructor_params.contacts[link_type] -->
<contenteditable class="record-inp" tag="div" :no-hl="true" :no-html="true" spellcheck="false" <contenteditable class="record-inp" tag="div" :no-hl="true" :no-html="true" spellcheck="false"
v-model="constructor_params.contacts[link_type]"></contenteditable> v-model="constructor_params.contacts[contact[0]]"></contenteditable>
</div> </div>
</div> </div>
<div class="save_container center"> <div class="save_container center">
@ -103,6 +102,7 @@ export default {
constructor_site, constructor_site,
constructor_params: new SiteConstructorParams(''), constructor_params: new SiteConstructorParams(''),
saved_constructor_params: new SiteConstructorParams(''), saved_constructor_params: new SiteConstructorParams(''),
contacts: []
} }
}, },
watch: { watch: {
@ -119,6 +119,16 @@ export default {
handler: function (newVal, oldVal) { handler: function (newVal, oldVal) {
if (newVal === oldVal) return; if (newVal === oldVal) return;
this.constructor_params = newVal.copy(); this.constructor_params = newVal.copy();
this.contacts = Object.entries(newVal.contacts);
},
deep: true
},
contacts: {
handler: function (newVal) {
this.constructor_params.contacts = new Map();
for (let contact of newVal) {
this.constructor_params.contacts[contact[0]] = contact[1];
}
}, },
deep: true deep: true
}, },
@ -137,13 +147,20 @@ export default {
}, },
link_icons() { link_icons() {
return link_icons; return link_icons;
} },
// used_link_types() {
// return Object.keys(this.constructor_params.contacts);
// },
}, },
methods: { methods: {
set_site_rec(site_rec) { set_site_rec(site_rec) {
this.site_rec = site_rec; this.site_rec = site_rec;
}, },
addLink(link_type) { addLink(link_type) {
console.log('adding link', link_type);
// If there's already a link of this type, don't add it
if (link_type in this.constructor_params.contacts) return;
this.contacts.push([link_type, default_links[link_type]])
this.constructor_params.contacts[link_type] = default_links[link_type]; this.constructor_params.contacts[link_type] = default_links[link_type];
}, },
} }

4
src/views/Explore.vue

@ -202,7 +202,9 @@ export default {
this.records.site = this.site_rec; this.records.site = this.site_rec;
}, },
async saveSiteConstr() { async saveSiteConstr() {
await this.saveSite(); if (this.site_rec !== this.records.site) {
await this.saveSite();
}
await call_api_post('set-site-data', this.constructor_params); await call_api_post('set-site-data', this.constructor_params);
this.saved_constructor_params = this.constructor_params; this.saved_constructor_params = this.constructor_params;
this.updSettingsComponent(); this.updSettingsComponent();

Loading…
Cancel
Save