Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ dist-ssr
# custom
!lib
.react-router
.vite
19 changes: 9 additions & 10 deletions frontend/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
"scripts": {
"dev": "react-router dev",
"build": "react-router build",
"start": "react-router-serve ./build/server/index.js",
"start": "vite preview --outDir build/client",
"tauri": "tauri"
},
"dependencies": {
"@radix-ui/react-avatar": "^1.1.10",
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-scroll-area": "^1.2.10",
"@radix-ui/react-separator": "^1.1.7",
"@radix-ui/react-slot": "^1.2.3",
"@radix-ui/react-tooltip": "^1.2.8",
Expand All @@ -21,17 +20,19 @@
"@tauri-apps/plugin-opener": "^2.5.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"dayjs": "^1.11.18",
"echarts": "^6.0.0",
"isbot": "^5",
"lucide-react": "^0.544.0",
"overlayscrollbars": "^2.12.0",
"overlayscrollbars-react": "^0.5.6",
"react": "^19.1.1",
"react-dom": "^19.1.1",
"tailwind-merge": "^3.3.1"
},
"devDependencies": {
"@biomejs/biome": "^2.2.4",
"@react-router/dev": "^7.8.2",
"@react-router/fs-routes": "^7.8.2",
"@react-router/serve": "^7.8.2",
"@tailwindcss/vite": "^4.1.13",
"@tauri-apps/cli": "^2.8.4",
Expand Down
79 changes: 0 additions & 79 deletions frontend/src/app/_home/route.tsx

This file was deleted.

54 changes: 54 additions & 0 deletions frontend/src/app/home/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { Plus } from "lucide-react";
import { Outlet, useLocation } from "react-router";
import { Button } from "@/components/ui/button";
import {
StockMenu,
StockMenuGroup,
StockMenuGroupHeader,
StockMenuHeader,
StockMenuListItem,
} from "@/components/valuecell/menus/stock-menus";
import ScrollContainer from "@/components/valuecell/scroll-container";
import { stockData } from "@/mock/stock-data";

export default function HomeLayout() {
const { pathname } = useLocation();

// Extract stock symbol (e.g., AAPL) from path like /stock/AAPL
const stockSymbol = pathname.split("/")[2];

return (
<div className="flex flex-1 overflow-hidden">
<ScrollContainer className="flex-1">
<Outlet />
</ScrollContainer>

<aside className="flex h-full flex-col justify-between border-l">
<StockMenu>
<StockMenuHeader>My Stocks</StockMenuHeader>
<ScrollContainer>
{stockData.map((group) => (
<StockMenuGroup key={group.title}>
<StockMenuGroupHeader>{group.title}</StockMenuGroupHeader>
{group.stocks.map((stock) => (
<StockMenuListItem
key={stock.symbol}
stock={stock}
to={`/stock/${stock.symbol}`}
isActive={stockSymbol === stock.symbol}
replace={!!stockSymbol}
/>
))}
</StockMenuGroup>
))}
</ScrollContainer>
</StockMenu>

<Button variant="secondary" className="mx-5 mb-6 font-bold text-sm">
<Plus size={16} />
Add Stocks
</Button>
</aside>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./agent-recommend-list";
export * from "./agent-suggestions-list";
export * from "./sparkline-stock-list";
export * from "./stock-details-list";
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { MiniSparkline } from "@valuecell/charts/mini-sparkline";
import MiniSparkline from "@valuecell/charts/mini-sparkline";
import { STOCK_COLORS } from "@/constants/stock";
import { cn, formatChange, formatPrice, getChangeType } from "@/lib/utils";
import type { StockChangeType } from "@/types/stock";
import type { SparklineData } from "@/types/chart";

export interface SparklineStock {
symbol: string;
price: number;
currency: string;
changeAmount: number;
changePercent: number;
sparklineData: number[];
sparklineData: SparklineData;
}

interface SparklineStockListProps extends React.HTMLAttributes<HTMLDivElement> {
Expand All @@ -20,18 +21,6 @@ interface SparklineStockItemProps
stock: SparklineStock;
}

const BASE_COLOR: Record<StockChangeType, string> = {
positive: "#3F845F",
negative: "#E25C5C",
neutral: "#707070",
};

const GRADIENT_COLORS: Record<StockChangeType, [string, string]> = {
positive: ["rgba(63, 132, 95, 0.5)", "rgba(63, 132, 95, 0)"],
negative: ["rgba(226, 92, 92, 0.5)", "rgba(226, 92, 92, 0)"],
neutral: ["rgba(112, 112, 112, 0.5)", "rgba(112, 112, 112, 0)"],
};

function SparklineStockItem({
className,
stock,
Expand All @@ -54,21 +43,27 @@ function SparklineStockItem({
</p>
</div>
<p
className="font-semibold text-[20px] leading-[26px]"
style={{ color: BASE_COLOR[changeType] }}
className={`font-semibold text-[20px] leading-[26px]`}
style={{
color: STOCK_COLORS[changeType],
}}
>
{formatPrice(stock.price, stock.currency)}
</p>
<div className="flex items-start gap-1">
<span
className="font-normal text-[12px] leading-[16px]"
style={{ color: BASE_COLOR[changeType] }}
className={`font-normal text-[12px] leading-[16px]`}
style={{
color: STOCK_COLORS[changeType],
}}
>
{formatChange(stock.changeAmount)}
</span>
<span
className="font-normal text-[12px] leading-[16px]"
style={{ color: BASE_COLOR[changeType] }}
className={`font-normal text-[12px] leading-[16px]`}
style={{
color: STOCK_COLORS[changeType],
}}
>
{formatChange(stock.changePercent, "%")}
</span>
Expand All @@ -78,8 +73,7 @@ function SparklineStockItem({
<MiniSparkline
className="pointer-events-none"
data={stock.sparklineData}
color={BASE_COLOR[changeType]}
gradientColors={GRADIENT_COLORS[changeType]}
changeType={changeType}
width={140}
height={64}
/>
Expand Down
Loading