add button to reset path

This commit is contained in:
liamcottle
2025-02-13 01:31:20 +13:00
parent f99724bea2
commit 24fec964de
2 changed files with 19 additions and 0 deletions

View File

@@ -14,6 +14,14 @@
<div class="text-sm text-gray-500 font-semibold">{{ contact.advName }}</div> <div class="text-sm text-gray-500 font-semibold">{{ contact.advName }}</div>
</div> </div>
<!-- reset path button -->
<DropDownMenuItem @click="onResetPath(contact)">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12" />
</svg>
<span>Reset Path</span>
</DropDownMenuItem>
<!-- delete contact button --> <!-- delete contact button -->
<DropDownMenuItem @click="onDeleteContact(contact)"> <DropDownMenuItem @click="onDeleteContact(contact)">
<svg class="size-5 text-red-500" viewBox="0 0 20 20" fill="currentColor"> <svg class="size-5 text-red-500" viewBox="0 0 20 20" fill="currentColor">
@@ -46,6 +54,13 @@ export default {
"contact-deleted", "contact-deleted",
], ],
methods: { methods: {
async onResetPath(contact) {
// reset path
await Connection.resetContactPath(contact.publicKey);
await Connection.loadContacts();
},
async onDeleteContact(contact) { async onDeleteContact(contact) {
// confirm user wants to remove this contact // confirm user wants to remove this contact

View File

@@ -65,6 +65,10 @@ class Connection {
await GlobalState.connection.sendCommandSetDeviceTime(timestamp); await GlobalState.connection.sendCommandSetDeviceTime(timestamp);
} }
static async resetContactPath(publicKey) {
await GlobalState.connection.sendCommandResetPath(publicKey);
}
static async removeContact(publicKey) { static async removeContact(publicKey) {
await GlobalState.connection.sendCommandRemoveContact(publicKey); await GlobalState.connection.sendCommandRemoveContact(publicKey);
} }