mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-03-17 21:31:52 +01:00
noogle: deal with multiple dvms
This commit is contained in:
parent
a0a06274d7
commit
402e364cc7
1
.gitignore
vendored
1
.gitignore
vendored
@ -180,3 +180,4 @@ tests/gui/svelte/node_modules
|
||||
tests/gui/vuejs/noogle/node_modules
|
||||
tests/gui/vuejs/noogle/.idea/
|
||||
tests/gui/vuejs/noogle/package-lock.json
|
||||
search.py
|
||||
|
@ -128,7 +128,7 @@ async function listen() {
|
||||
if (event.kind === 7000) {
|
||||
try {
|
||||
console.log("7000:", event.content);
|
||||
miniToastr.showMessage("DVM replied", event.content, VueNotifications.types.info)
|
||||
miniToastr.showMessage(event.content, event.author.toBech32(), VueNotifications.types.info)
|
||||
} catch (error) {
|
||||
console.log("Error: ", error);
|
||||
}
|
||||
@ -136,7 +136,8 @@ async function listen() {
|
||||
else if(event.kind === 6302) {
|
||||
let entries = []
|
||||
console.log("6302:", event.content);
|
||||
miniToastr.showMessage("DVM replied", "Received Results", VueNotifications.types.success)
|
||||
|
||||
miniToastr.showMessage("Received Results", event.author.toBech32(), VueNotifications.types.success)
|
||||
let event_etags = JSON.parse(event.content)
|
||||
for (let etag of event_etags){
|
||||
const eventid = EventId.fromHex(etag[1])
|
||||
@ -162,13 +163,14 @@ async function listen() {
|
||||
let nostrudelurl = "https://nostrudel.ninja/#/n/" + bech32id
|
||||
let uri = "nostr:" + bech32id // nip19.toNostrUri()
|
||||
|
||||
if (!items.find(e => e.id === evt.id)) {
|
||||
if (items.find(e => e.id === evt.id) === undefined) {
|
||||
items.push({id:evt.id, content: evt.content, author: name, authorurl: "https://njump.me/" + evt.author.toBech32(), links: {"uri": uri, "highlighter": highlighterurl, "njump": njumpurl, "nostrudel": nostrudelurl} , avatar: picture, indicator: {"time": evt.createdAt.toHumanDatetime()}})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
console.log("Events from" + event.author.toHex())
|
||||
console.log(items)
|
||||
store.commit('set_search_results', items)
|
||||
}
|
||||
},
|
||||
|
@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<EasyDataTable class="customize-table" header-text-direction="left" expand v-if="store.state.results.length != 0" table-class-name="customize-table"
|
||||
<EasyDataTable class="customize-table" header-text-direction="left" v-if="store.state.results.length != 0" table-class-name="customize-table"
|
||||
:headers="headers"
|
||||
:items="store.state.results">
|
||||
:items="store.state.results" :sort-by="sortBy"
|
||||
:sort-type="sortType">
|
||||
<template #item-content="{ content, author, authorurl, avatar, indicator, links}">
|
||||
<div class="playeauthor-wrapper">
|
||||
<img class="avatar" :src="avatar" alt="" />
|
||||
@ -37,15 +38,18 @@
|
||||
<script lang="ts" setup>
|
||||
|
||||
|
||||
|
||||
import type { Header, Item } from "vue3-easy-data-table";
|
||||
import type {Header, Item, SortType} from "vue3-easy-data-table";
|
||||
import store from '../store';
|
||||
|
||||
const sortBy = "indicator.time";
|
||||
const sortType: SortType = "desc";
|
||||
|
||||
const headers: Header[] = [
|
||||
{ text: "Results:", value: "content", fixed:true},
|
||||
// { text: "Time", value: "indicator.time", sortable: true, },
|
||||
];
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@ -31,8 +31,12 @@ const store = createStore({
|
||||
state.nip89dvms = nip89dvms
|
||||
},
|
||||
set_search_results(state, results){
|
||||
state.results = results
|
||||
console.log(state.results)
|
||||
state.results.length = 0
|
||||
state.results.push.apply(state.results, results)
|
||||
//state.results = []
|
||||
|
||||
//[].push.apply(state.results, results)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user