add ability to select advert type

This commit is contained in:
liamcottle
2025-02-13 14:14:42 +13:00
parent cd97931a47
commit f3e5f97397

View File

@@ -28,11 +28,19 @@
<!-- action buttons -->
<div v-else class="flex space-x-1">
<button @click="sendFloodAdvert" type="button" class="my-auto bg-gray-500 text-white px-2 py-1 p-1 rounded shadow hover:bg-gray-400">
<DropDownMenu>
<template v-slot:button>
<button type="button" class="my-auto bg-gray-500 text-white px-2 py-1 p-1 rounded shadow hover:bg-gray-400">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M9.348 14.652a3.75 3.75 0 0 1 0-5.304m5.304 0a3.75 3.75 0 0 1 0 5.304m-7.425 2.121a6.75 6.75 0 0 1 0-9.546m9.546 0a6.75 6.75 0 0 1 0 9.546M5.106 18.894c-3.808-3.807-3.808-9.98 0-13.788m13.788 0c3.808 3.807 3.808 9.98 0 13.788M12 12h.008v.008H12V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z" />
</svg>
</button>
</template>
<template v-slot:items>
<DropDownMenuItem @click="sendZeroHopAdvert">Advert (Zero Hop)</DropDownMenuItem>
<DropDownMenuItem @click="sendFloodAdvert">Advert (Flood Routed)</DropDownMenuItem>
</template>
</DropDownMenu>
<DropDownMenu>
<template v-slot:button>
<button type="button" class="my-auto bg-gray-500 text-white px-2 py-1 p-1 rounded shadow hover:bg-gray-400">
@@ -83,8 +91,13 @@ export default {
name: 'Header',
components: {DropDownMenuItem, DropDownMenu, IconButton},
methods: {
async sendZeroHopAdvert() {
await GlobalState.connection.sendZeroHopAdvert();
alert("A zero hop advert has been sent.");
},
async sendFloodAdvert() {
await GlobalState.connection.sendFloodAdvert();
alert("A flood routed advert has been sent.");
},
async disconnect() {
await Connection.disconnect();