From 6208193de55ccc411749c4274b9f222fde78ccd5 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 11 Sep 2024 20:25:55 -0400 Subject: [PATCH] Fix plumbing for replies on the search tab. --- apps/ssb.json | 2 +- apps/ssb/tf-tab-search.js | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/ssb.json b/apps/ssb.json index 5b36f263..4726abdf 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🐌", - "previous": "&xsmsLytB3VvoHphiFHZGGEvrCfTEVGXrGwobGTIYFPQ=.sha256" + "previous": "&6oHPQCA26v+4nBXv+YUdCT43j2DpXDspxhHSSRydkiw=.sha256" } diff --git a/apps/ssb/tf-tab-search.js b/apps/ssb/tf-tab-search.js index ec5588f9..282e4134 100644 --- a/apps/ssb/tf-tab-search.js +++ b/apps/ssb/tf-tab-search.js @@ -5,6 +5,7 @@ import {styles} from './tf-styles.js'; class TfTabSearchElement extends LitElement { static get properties() { return { + drafts: {type: Object}, whoami: {type: String}, users: {type: Object}, following: {type: Array}, @@ -22,6 +23,10 @@ class TfTabSearchElement extends LitElement { this.users = {}; this.following = []; this.expanded = {}; + this.drafts = {}; + tfrpc.rpc.localStorageGet('drafts').then(function (d) { + self.drafts = JSON.parse(d || '{}'); + }); } async search(query) { @@ -70,6 +75,18 @@ class TfTabSearchElement extends LitElement { } } + draft(event) { + let id = event.detail.id || ''; + let previous = this.drafts[id]; + if (event.detail.draft !== undefined) { + this.drafts[id] = event.detail.draft; + } else { + delete this.drafts[id]; + } + this.drafts = Object.assign({}, this.drafts); + tfrpc.rpc.localStorageSet('drafts', JSON.stringify(this.drafts)); + } + render() { if (this.query !== this.last_query) { this.last_query = this.query; @@ -81,7 +98,7 @@ class TfTabSearchElement extends LitElement { - + `; } }