diff --git a/Shared (Extension)/Resources/event_log.html b/Shared (Extension)/Resources/event_log.html index 1dad5b8..ff23718 100644 --- a/Shared (Extension)/Resources/event_log.html +++ b/Shared (Extension)/Resources/event_log.html @@ -8,6 +8,12 @@ Event Log + + @@ -20,7 +26,7 @@
Filters
-
+
+ +
+ + +
+ +
+ + +
diff --git a/Shared (Extension)/Resources/event_log.js b/Shared (Extension)/Resources/event_log.js index a67cffc..4c9a387 100644 --- a/Shared (Extension)/Resources/event_log.js +++ b/Shared (Extension)/Resources/event_log.js @@ -1,6 +1,7 @@ import Alpine from 'alpinejs'; +import { getPublicKey } from 'nostr-tools'; import { getHosts, sortByIndex } from './db'; -import { KINDS } from './utils'; +import { getProfiles, KINDS } from './utils'; Alpine.data('eventLog', () => ({ kinds: KINDS, @@ -10,6 +11,9 @@ Alpine.data('eventLog', () => ({ sort: 'asc', allHosts: [], host: '', + allProfiles: [], + profile: '', + pubkey: '', // date view fromCreatedAt: '2008-10-31', @@ -33,6 +37,12 @@ Alpine.data('eventLog', () => ({ ); this.events = events; getHosts().then(hosts => (this.allHosts = hosts)); + const profiles = await getProfiles(); + console.log(profiles); + this.allProfiles = profiles.map(profile => ({ + name: profile.name, + pubkey: getPublicKey(profile.privKey), + })); }, quickKindSelect() { @@ -43,6 +53,13 @@ Alpine.data('eventLog', () => ({ this.reload(); }, + pkFromProfile() { + this.pubkey = this.allProfiles.find( + ({ name }) => name === this.profile + ).pubkey; + this.reload(); + }, + // Properties get fromTime() { @@ -55,6 +72,10 @@ Alpine.data('eventLog', () => ({ return Math.floor(dt.getTime() / 1000); }, + get profileNames() { + return this.allProfiles.map(p => p.name); + }, + get keyRange() { switch (this.view) { case 'created_at': @@ -66,6 +87,11 @@ Alpine.data('eventLog', () => ({ case 'host': if (this.host.length === 0) return null; return IDBKeyRange.only(this.host); + + case 'pubkey': + if (this.pubkey.length === 0) return null; + return IDBKeyRange.only(this.pubkey); + default: return null; }