diff web/src/main.ts @ 14:b9c2b7fedbcd

fix up deployment and connect ui to server again
author drewp@bigasterisk.com
date Thu, 11 Jul 2024 22:11:41 -0700
parents f23b21bd0fce
children
line wrap: on
line diff
--- a/web/src/main.ts	Thu Jul 11 21:32:24 2024 -0700
+++ b/web/src/main.ts	Thu Jul 11 22:11:41 2024 -0700
@@ -5,6 +5,12 @@
 import { unsafeHTML } from "lit/directives/unsafe-html.js";
 setBasePath("@fs/opt/node_modules/@shoelace-style/shoelace/dist");
 
+interface Doc {
+  sourceTitle: string
+  phrase: string
+  snippetHtml: string
+}
+
 @customElement("sco-search-page")
 export class ScoSearchPage extends LitElement {
   static styles = [
@@ -52,7 +58,7 @@
     `,
   ];
   @state() query: string = "climate";
-  @state() results: Object[] = [];
+  @state() results: Doc[] = [];
   @state() queryError: string = "";
   @queryAsync("sl-textarea") queryEl?: Promise<SlTextarea>;
   protected async firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>) {
@@ -114,10 +120,10 @@
       <section id="results">
         <dl>
           ${this.results.map(
-            (r) =>
-              html`<dt>${r.title}</dt>
+      (r: Doc) =>
+        html`<dt>${r.sourceTitle}</dt>
                 <dd>${unsafeHTML(r.snippetHtml)}</dd>`
-          )}
+    )}
         </dl>
         <div>Matching results: ${this.results.length}</div>
       </section>