Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(welcome): make side-panel examples clickable and label each by its category

Haozhe Wu4538ccc7c1dc
diff --git a/frontend/src/components/chat/WelcomeScreen.tsx b/frontend/src/components/chat/WelcomeScreen.tsx
index 691339ff6..81cf776be 100644
--- a/frontend/src/components/chat/WelcomeScreen.tsx
+++ b/frontend/src/components/chat/WelcomeScreen.tsx
@@ -176,6 +176,23 @@ const CATEGORIES: Category[] = [
},
];
+const FEATURED_EXAMPLE_KEYS = [
+ "welcome.examples.earningsReport",
+ "welcome.examples.crossMarketPortfolio",
+ "welcome.examples.thesisTracker",
+] as const;
+
+// Resolved from the library so a featured card always carries its own
+// category label and prompt; a key that drifts out of CATEGORIES fails loudly.
+const FEATURED_EXAMPLES = FEATURED_EXAMPLE_KEYS.map((titleKey) => {
+ const category = CATEGORIES.find((cat) => cat.examples.some((ex) => ex.titleKey === titleKey));
+ const example = category?.examples.find((ex) => ex.titleKey === titleKey);
+ if (!category || !example) {
+ throw new Error(`Featured example ${titleKey} is not in the example library`);
+ }
+ return { category, example };
+});
+
const GREETING_KEYS = {
morning: [
"welcome.greetings.morning1",
@@ -406,29 +423,32 @@ export function WelcomeScreen({ onExample }: Props) {
</main>
<aside className="self-start lg:sticky lg:top-8">
- <div className="rounded-2xl border border-border/70 bg-card/55 p-5 shadow-sm">
- <div className="flex items-center justify-between border-b border-border/60 pb-4">
- <span className="text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground">{t("welcome.categories.valueInvesting" as any)}</span>
- <span className="h-2 w-2 rounded-full bg-emerald-500/80" aria-hidden="true" />
- </div>
- <div className="space-y-5 pt-5">
- <div>
- <p className="text-[11px] uppercase tracking-[0.14em] text-muted-foreground/70">{t("welcome.categories.docWebResearch" as any)}</p>
- <p className="mt-1.5 text-sm font-medium leading-6">{t("welcome.examples.earningsReport" as any)}</p>
- <p className="mt-1 text-xs leading-5 text-muted-foreground">{t("welcome.examples.earningsReportDesc" as any)}</p>
- </div>
- <div className="border-t border-border/60 pt-5">
- <p className="text-[11px] uppercase tracking-[0.14em] text-muted-foreground/70">{t("welcome.categories.multiMarketBacktest" as any)}</p>
- <p className="mt-1.5 text-sm font-medium leading-6">{t("welcome.examples.crossMarketPortfolio" as any)}</p>
- <p className="mt-1 text-xs leading-5 text-muted-foreground">{t("welcome.examples.crossMarketPortfolioDesc" as any)}</p>
- </div>
- <div className="border-t border-border/60 pt-5">
- <p className="text-[11px] uppercase tracking-[0.14em] text-muted-foreground/70">{t("welcome.categories.valueInvesting" as any)}</p>
- <p className="mt-1.5 text-sm font-medium leading-6">{t("welcome.examples.thesisTracker" as any)}</p>
- <p className="mt-1 text-xs leading-5 text-muted-foreground">{t("welcome.examples.thesisTrackerDesc" as any)}</p>
- </div>
- </div>
- </div>
+ <section
+ aria-labelledby="welcome-featured-heading"
+ className="rounded-2xl border border-border/70 bg-card/55 px-5 pt-5 shadow-sm"
+ >
+ <h2
+ id="welcome-featured-heading"
+ className="border-b border-border/60 pb-4 text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground"
+ >
+ {t("welcome.featured" as any)}
+ </h2>
+ <ul className="divide-y divide-border/60">
+ {FEATURED_EXAMPLES.map(({ category, example }) => (
+ <li key={example.titleKey}>
+ <button
+ type="button"
+ onClick={() => onExample(t(example.promptKey as any))}
+ className="group block w-full py-4 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40"
+ >
+ <span className="block text-[11px] uppercase tracking-[0.14em] text-muted-foreground/70">{t(category.labelKey as any)}</span>
+ <span className="mt-1.5 block text-sm font-medium leading-6 transition-colors group-hover:text-primary">{t(example.titleKey as any)}</span>
+ <span className="mt-1 block text-xs leading-5 text-muted-foreground">{t(example.descKey as any)}</span>
+ </button>
+ </li>
+ ))}
+ </ul>
+ </section>
<div className="mt-3 rounded-xl border border-dashed border-border/80 p-4">
<p className="text-xs font-medium">{t("welcome.tasks.hint")}</p>
</div>
diff --git a/frontend/src/i18n/locales/ar.json b/frontend/src/i18n/locales/ar.json
index e700bae12..1b67d0366 100644
--- a/frontend/src/i18n/locales/ar.json
+++ b/frontend/src/i18n/locales/ar.json
@@ -441,6 +441,7 @@
"taskSubtitle": "اسأل عن سهم أو استراتيجية أو محفظتك — سأجلب البيانات وأجري الحسابات وأعرض كل خطوة.",
"quickActions": "إجراءات سريعة",
"browseAllExamples": "تصفح جميع الأمثلة",
+ "featured": "أمثلة مختارة",
"greetings": {
"morning1": "صباح الخير.",
"morning2": "صباح الخير — جاهزون متى شئت.",
diff --git a/frontend/src/i18n/locales/de.json b/frontend/src/i18n/locales/de.json
index f537d6a4c..f6387bbe2 100644
--- a/frontend/src/i18n/locales/de.json
+++ b/frontend/src/i18n/locales/de.json
@@ -447,6 +447,7 @@
"taskSubtitle": "Frag nach einer Aktie, einer Strategie oder deinem Portfolio — ich hole die Daten, rechne alles durch und zeige jeden Schritt.",
"quickActions": "Schnellaktionen",
"browseAllExamples": "Alle Beispiele durchsuchen",
+ "featured": "Ausgewählte Beispiele",
"greetings": {
"morning1": "Guten Morgen.",
"morning2": "Morgen — ich bin bereit, wenn du es bist.",
diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json
index 01c99dbcb..842a50c2e 100644
--- a/frontend/src/i18n/locales/en.json
+++ b/frontend/src/i18n/locales/en.json
@@ -447,6 +447,7 @@
"taskSubtitle": "Ask about a stock, a strategy, or your portfolio — I'll pull the data, run the numbers, and show every step.",
"quickActions": "Quick actions",
"browseAllExamples": "Browse all examples",
+ "featured": "Featured examples",
"greetings": {
"morning1": "Good morning.",
"morning2": "Morning — ready when you are.",
diff --git a/frontend/src/i18n/locales/es.json b/frontend/src/i18n/locales/es.json
index 43fa103ba..eb43e679d 100644
--- a/frontend/src/i18n/locales/es.json
+++ b/frontend/src/i18n/locales/es.json
@@ -447,6 +447,7 @@
"taskSubtitle": "Pregunta sobre una acción, una estrategia o tu portafolio — obtendré los datos, haré los cálculos y te mostraré cada paso.",
"quickActions": "Acciones rápidas",
"browseAllExamples": "Ver todos los ejemplos",
+ "featured": "Ejemplos destacados",
"greetings": {
"morning1": "Buenos días.",
"morning2": "Buenos días — listo cuando quieras.",
diff --git a/frontend/src/i18n/locales/fa.json b/frontend/src/i18n/locales/fa.json
index fdb85f8eb..a7e6d06bf 100644
--- a/frontend/src/i18n/locales/fa.json
+++ b/frontend/src/i18n/locales/fa.json
@@ -447,6 +447,7 @@
"taskSubtitle": "درباره یک سهم، یک استراتژی یا پورتفولیوی خود بپرسید — داده را می‌کشم، محاسبه می‌کنم و همه گام‌ها را نشان می‌دهم.",
"quickActions": "اقدامات سریع",
"browseAllExamples": "مرور همه مثال‌ها",
+ "featured": "نمونه‌های منتخب",
"greetings": {
"morning1": "صبح بخیر.",
"morning2": "صبح بخیر — هر وقت آماده بودی من هم هستم.",
diff --git a/frontend/src/i18n/locales/id.json b/frontend/src/i18n/locales/id.json
index 76f6b864e..8c3b74ed6 100644
--- a/frontend/src/i18n/locales/id.json
+++ b/frontend/src/i18n/locales/id.json
@@ -447,6 +447,7 @@
"taskSubtitle": "Tanyakan tentang saham, strategi, atau portofolio Anda — saya akan mengambil data, menghitung angkanya, dan menampilkan setiap langkah.",
"quickActions": "Aksi cepat",
"browseAllExamples": "Lihat semua contoh",
+ "featured": "Contoh pilihan",
"greetings": {
"morning1": "Selamat pagi.",
"morning2": "Pagi — siap saat Anda siap.",
diff --git a/frontend/src/i18n/locales/ja.json b/frontend/src/i18n/locales/ja.json
index cab896bdf..9c16ef195 100644
--- a/frontend/src/i18n/locales/ja.json
+++ b/frontend/src/i18n/locales/ja.json
@@ -441,6 +441,7 @@
"taskSubtitle": "銘柄・戦略・ポートフォリオについて聞いてください。データ取得から計算まで、すべての手順をお見せします。",
"quickActions": "クイックアクション",
"browseAllExamples": "すべての例を見る",
+ "featured": "おすすめの例",
"greetings": {
"morning1": "おはようございます。",
"morning2": "おはようございます。いつでもどうぞ。",
diff --git a/frontend/src/i18n/locales/ko.json b/frontend/src/i18n/locales/ko.json
index d5b0133a3..3095ecd0d 100644
--- a/frontend/src/i18n/locales/ko.json
+++ b/frontend/src/i18n/locales/ko.json
@@ -441,6 +441,7 @@
"taskSubtitle": "종목, 전략, 포트폴리오에 대해 물어보세요. 데이터 수집부터 계산까지 모든 과정을 보여드립니다.",
"quickActions": "빠른 작업",
"browseAllExamples": "모든 예시 보기",
+ "featured": "추천 예시",
"greetings": {
"morning1": "좋은 아침입니다.",
"morning2": "좋은 아침입니다. 언제든 시작하세요.",
diff --git a/frontend/src/i18n/locales/pt-BR.json b/frontend/src/i18n/locales/pt-BR.json
index a72c95fa9..7044b3f63 100644
--- a/frontend/src/i18n/locales/pt-BR.json
+++ b/frontend/src/i18n/locales/pt-BR.json
@@ -447,6 +447,7 @@
"taskSubtitle": "Pergunte sobre uma ação, uma estratégia ou seu portfólio — extrairei os dados, analisarei os números e mostrarei cada etapa.",
"quickActions": "Ações rápidas",
"browseAllExamples": "Navegue por todos os exemplos",
+ "featured": "Exemplos em destaque",
"greetings": {
"morning1": "Bom dia.",
"morning2": "Bom dia - pronto quando você estiver.",
diff --git a/frontend/src/i18n/locales/tr.json b/frontend/src/i18n/locales/tr.json
index 3739e8749..d378f3114 100644
--- a/frontend/src/i18n/locales/tr.json
+++ b/frontend/src/i18n/locales/tr.json
@@ -400,6 +400,7 @@
"taskSubtitle": "Bir hisse, strateji veya portföyün hakkında sor; verileri getirip hesaplayacağım ve her adımı göstereceğim.",
"quickActions": "Hızlı işlemler",
"browseAllExamples": "Tüm örnekleri görüntüle",
+ "featured": "Öne çıkan örnekler",
"greetings": {
"morning1": "Günaydın.",
"morning2": "Günaydın, hazır olduğunda başlayabiliriz.",
diff --git a/frontend/src/i18n/locales/zh-CN.json b/frontend/src/i18n/locales/zh-CN.json
index 617299042..8b7dfda6a 100644
--- a/frontend/src/i18n/locales/zh-CN.json
+++ b/frontend/src/i18n/locales/zh-CN.json
@@ -441,6 +441,7 @@
"taskSubtitle": "问一只股票、一个策略,或者你的持仓——我会自己取数据、跑计算,并把每一步摆给你看。",
"quickActions": "快捷操作",
"browseAllExamples": "浏览全部示例",
+ "featured": "精选示例",
"greetings": {
"morning1": "早上好。",
"morning2": "早上好,随时可以开始。",