Skip to content

Commit fddb78f

Browse files
committed
refactor: unify home page layout, always show ticker tape, and use new agent suggestions list component
1 parent ed63f04 commit fddb78f

File tree

2 files changed

+34
-53
lines changed

2 files changed

+34
-53
lines changed

frontend/src/app/home/_layout.tsx

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,24 @@ export default function HomeLayout() {
88
<div className="flex flex-1 flex-col gap-4 overflow-hidden bg-gray-100 py-4 pr-4 pl-2">
99
<h1 className="font-medium text-3xl">👋 Welcome to ValueCell !</h1>
1010

11-
<div className="flex min-h-0 flex-1 gap-3 overflow-hidden">
12-
<main className="scroll-container h-full min-h-0 flex-1 rounded-lg">
11+
<div className="flex flex-1 gap-3 overflow-hidden">
12+
<main className="scroll-container flex-1 rounded-lg">
1313
<Outlet />
1414
</main>
1515

16-
{
17-
<aside className="flex h-full min-w-62 max-w-80 flex-col overflow-hidden rounded-lg bg-white">
18-
<div className="min-h-0 flex-1 overflow-hidden">
19-
<StockList />
20-
</div>
16+
<aside className="flex w-72 flex-col overflow-hidden rounded-lg bg-white">
17+
<StockList />
2118

22-
<StockSearchModal>
23-
<Button
24-
variant="secondary"
25-
className="mx-5 mb-6 font-bold text-sm hover:bg-gray-200"
26-
>
27-
<Plus size={16} />
28-
Add Stocks
29-
</Button>
30-
</StockSearchModal>
31-
</aside>
32-
}
19+
<StockSearchModal>
20+
<Button
21+
variant="secondary"
22+
className="mx-5 mb-6 font-bold text-sm hover:bg-gray-200"
23+
>
24+
<Plus size={16} />
25+
Add Stocks
26+
</Button>
27+
</StockSearchModal>
28+
</aside>
3329
</div>
3430
</div>
3531
);

frontend/src/app/home/home.tsx

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useNavigate } from "react-router";
33
import { useAllPollTaskList } from "@/api/conversation";
44
import { agentSuggestions } from "@/mock/agent-data";
55
import ChatInputArea from "../agent/components/chat-conversation/chat-input-area";
6-
import { AgentSuggestionItem, AgentTaskCards } from "./components";
6+
import { AgentSuggestionsList, AgentTaskCards } from "./components";
77
import TradingViewTickerTape from "./components/tradingview-ticker-tape";
88

99
const INDEX_SYMBOLS = [
@@ -21,29 +21,22 @@ function Home() {
2121
const [inputValue, setInputValue] = useState<string>("");
2222

2323
const { data: allPollTaskList } = useAllPollTaskList();
24-
const hasNewsTickerTape = allPollTaskList?.some(
25-
(item) => item.agent_name === "NewsAgent",
26-
);
2724

2825
const handleAgentClick = (agentId: string) => {
2926
navigate(`/agent/${agentId}`);
3027
};
3128

3229
return (
33-
<div className="scroll-container flex min-h-svh min-w-[800px] flex-col gap-3 pb-4">
30+
<div className="flex h-full min-w-[800px] flex-col gap-3">
3431
{allPollTaskList && allPollTaskList.length > 0 ? (
35-
<section className="flex h-full flex-1 flex-col items-center justify-between gap-4 overflow-hidden">
36-
{hasNewsTickerTape && (
37-
<div className="mx-auto w-4/5 max-w-[800px] px-4">
38-
<TradingViewTickerTape symbols={INDEX_SYMBOLS} />
39-
</div>
40-
)}
41-
<div className="scroll-container w-full">
32+
<section className="flex w-full flex-1 flex-col items-center justify-between gap-4">
33+
<TradingViewTickerTape symbols={INDEX_SYMBOLS} />
34+
35+
<div className="scroll-container flex-1">
4236
<AgentTaskCards tasks={allPollTaskList} />
4337
</div>
4438

4539
<ChatInputArea
46-
className="w-full"
4740
value={inputValue}
4841
onChange={(value) => setInputValue(value)}
4942
onSend={() =>
@@ -56,20 +49,15 @@ function Home() {
5649
/>
5750
</section>
5851
) : (
59-
<section className="flex h-full w-full flex-1 flex-col items-center gap-8 overflow-hidden rounded-lg bg-white pt-12">
60-
<div className="mx-auto w-4/5 max-w-[800px] px-4">
61-
<TradingViewTickerTape symbols={INDEX_SYMBOLS} />
62-
</div>
63-
<div className="mt-16 space-y-4 text-center text-gray-950">
64-
<h1 className="font-medium text-3xl">👋 Hello Investor!</h1>
65-
</div>
52+
<section className="flex w-full flex-1 flex-col items-center gap-8 rounded-lg bg-white px-6 pt-12">
53+
<TradingViewTickerTape symbols={INDEX_SYMBOLS} />
6654

67-
<div className="flex w-full max-w-[800px] flex-col gap-4 px-4">
68-
{/* Index section redesigned to ticker tape */}
69-
</div>
55+
<h1 className="mt-16 font-medium text-3xl text-gray-950">
56+
👋 Hello Investor!
57+
</h1>
7058

7159
<ChatInputArea
72-
className="w-3/4 max-w-[800px]"
60+
className="w-4/5 max-w-[800px]"
7361
value={inputValue}
7462
onChange={(value) => setInputValue(value)}
7563
onSend={() =>
@@ -81,17 +69,14 @@ function Home() {
8169
}
8270
/>
8371

84-
<div className="grid w-full max-w-[800px] grid-cols-3 gap-4 px-4">
85-
{agentSuggestions.map((suggestion) => (
86-
<AgentSuggestionItem
87-
key={suggestion.id}
88-
suggestion={{
89-
...suggestion,
90-
onClick: () => handleAgentClick(suggestion.id),
91-
}}
92-
/>
93-
))}
94-
</div>
72+
<AgentSuggestionsList
73+
suggestions={agentSuggestions.map((suggestion) => {
74+
return {
75+
...suggestion,
76+
onClick: () => handleAgentClick(suggestion.id),
77+
};
78+
})}
79+
/>
9580
</section>
9681
)}
9782
</div>

0 commit comments

Comments
 (0)