From ae0d5d813f6e0b6e0265cfd78496e1464855b5d0 Mon Sep 17 00:00:00 2001
From: asepharyana
Date: Wed, 16 Sep 2026 15:39:33 +0700
Subject: [PATCH] feat(ui): watchlist empty-state + chat error styling + hint
- WatchlistDrawer: shows helpful hint ('Ketik kode saham lalu Add') when empty
- ChatSidebar: errors in text-destructive, empty state explains how chat works
- styled-components/timestamp formatting and company-name display already in previous commit
---
web/src/components/WatchlistChat.tsx | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/web/src/components/WatchlistChat.tsx b/web/src/components/WatchlistChat.tsx
index af08ed1..c37c28f 100644
--- a/web/src/components/WatchlistChat.tsx
+++ b/web/src/components/WatchlistChat.tsx
@@ -36,7 +36,9 @@ export function WatchlistDrawer() {
{err()}
- {(t) => {t} del(t)}>× }
+ Ketik kode saham lalu Add — mis. BBCA, TLKM, BBRI.}>
+ {(t) => {t} del(t)}>× }
+
@@ -45,7 +47,7 @@ export function WatchlistDrawer() {
export function ChatSidebar() {
const [msg, setMsg] = createSignal("");
- const [log, setLog] = createSignal<{ q: string; a: string }[]>([]);
+ const [log, setLog] = createSignal<{ q: string; a: string; err?: boolean }[]>([]);
async function send() {
const q = msg().trim();
if (!q) return;
@@ -54,18 +56,25 @@ export function ChatSidebar() {
const r = await api.chat(q);
setLog((p) => [...p, { q, a: r.answer }].slice(-10));
} catch (e) {
- setLog((p) => [...p, { q, a: String(e) }].slice(-10));
+ setLog((p) => [...p, { q, a: String(e), err: true }].slice(-10));
}
}
return (
AI Chat
-
-
- {(m) => You: {m.q}
{m.a.slice(0, 500)}
}
-
-
+ Tanya soal watchlist-mu — sistem jawab dari data yang tersimpan (bukan karangan).
}>
+
+
+ {(m) => (
+
+
You: {m.q}
+
{m.a.slice(0, 500)}
+
+ )}
+
+
+
Tanya AI
setMsg(e.currentTarget.value)} onKeyDown={(e: KeyboardEvent) => { if (e.key === "Enter") send(); }} />
@@ -74,4 +83,4 @@ export function ChatSidebar() {
);
-}
\ No newline at end of file
+}