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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
=== Dockerfile ===
|
| 2 |
+
FROM node:18-alpine
|
| 3 |
+
|
| 4 |
+
WORKDIR /app
|
| 5 |
+
|
| 6 |
+
COPY package.json package-lock.json* ./
|
| 7 |
+
|
| 8 |
+
RUN npm install
|
| 9 |
+
|
| 10 |
+
COPY . .
|
| 11 |
+
|
| 12 |
+
RUN npm run build
|
| 13 |
+
|
| 14 |
+
EXPOSE 3000
|
| 15 |
+
|
| 16 |
+
CMD ["npm", "start"]
|
| 17 |
+
|
| 18 |
+
=== package.json ===
|
| 19 |
+
{
|
| 20 |
+
"name": "fireant-clone",
|
| 21 |
+
"version": "0.1.0",
|
| 22 |
+
"private": true,
|
| 23 |
+
"scripts": {
|
| 24 |
+
"dev": "next dev",
|
| 25 |
+
"build": "next build",
|
| 26 |
+
"start": "next start",
|
| 27 |
+
"lint": "next lint"
|
| 28 |
+
},
|
| 29 |
+
"dependencies": {
|
| 30 |
+
"next": "14.1.0",
|
| 31 |
+
"react": "^18.2.0",
|
| 32 |
+
"react-dom": "^18.2.0",
|
| 33 |
+
"lucide-react": "^0.330.0",
|
| 34 |
+
"recharts": "^2.12.0",
|
| 35 |
+
"clsx": "^2.1.0",
|
| 36 |
+
"tailwind-merge": "^2.2.1"
|
| 37 |
+
},
|
| 38 |
+
"devDependencies": {
|
| 39 |
+
"autoprefixer": "^10.4.17",
|
| 40 |
+
"postcss": "^8.4.35",
|
| 41 |
+
"tailwindcss": "^3.4.1",
|
| 42 |
+
"typescript": "^5.3.3",
|
| 43 |
+
"@types/node": "^20.11.17",
|
| 44 |
+
"@types/react": "^18.2.55",
|
| 45 |
+
"@types/react-dom": "^18.2.19"
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
=== next.config.js ===
|
| 50 |
+
/** @type {import('next').NextConfig} */
|
| 51 |
+
const nextConfig = {
|
| 52 |
+
reactStrictMode: true,
|
| 53 |
+
output: 'standalone',
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
module.exports = nextConfig
|
| 57 |
+
|
| 58 |
+
=== postcss.config.js ===
|
| 59 |
+
module.exports = {
|
| 60 |
+
plugins: {
|
| 61 |
+
tailwindcss: {},
|
| 62 |
+
autoprefixer: {},
|
| 63 |
+
},
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
=== tailwind.config.js ===
|
| 67 |
+
/** @type {import('tailwindcss').Config} */
|
| 68 |
+
module.exports = {
|
| 69 |
+
content: [
|
| 70 |
+
"./pages/**/*.{js,ts,jsx,tsx}",
|
| 71 |
+
"./components/**/*.{js,ts,jsx,tsx}",
|
| 72 |
+
],
|
| 73 |
+
theme: {
|
| 74 |
+
extend: {
|
| 75 |
+
colors: {
|
| 76 |
+
fireant: {
|
| 77 |
+
bg: '#0b0e11',
|
| 78 |
+
panel: '#15191e',
|
| 79 |
+
border: '#2a2e39',
|
| 80 |
+
green: '#00f4b0',
|
| 81 |
+
red: '#ff3747',
|
| 82 |
+
yellow: '#ffd600',
|
| 83 |
+
text: '#d1d5db',
|
| 84 |
+
textMuted: '#6b7280',
|
| 85 |
+
accent: '#2962ff'
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
fontSize: {
|
| 89 |
+
xxs: '0.65rem',
|
| 90 |
+
}
|
| 91 |
+
},
|
| 92 |
+
},
|
| 93 |
+
plugins: [],
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
=== styles/globals.css ===
|
| 97 |
+
@tailwind base;
|
| 98 |
+
@tailwind components;
|
| 99 |
+
@tailwind utilities;
|
| 100 |
+
|
| 101 |
+
:root {
|
| 102 |
+
--foreground-rgb: 255, 255, 255;
|
| 103 |
+
--background-start-rgb: 11, 14, 17;
|
| 104 |
+
--background-end-rgb: 11, 14, 17;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
body {
|
| 108 |
+
color: rgb(var(--foreground-rgb));
|
| 109 |
+
background: #0b0e11;
|
| 110 |
+
overflow: hidden; /* App-like feel */
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
/* Custom Scrollbar for the dashboard feel */
|
| 114 |
+
::-webkit-scrollbar {
|
| 115 |
+
width: 6px;
|
| 116 |
+
height: 6px;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
::-webkit-scrollbar-track {
|
| 120 |
+
background: #15191e;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
::-webkit-scrollbar-thumb {
|
| 124 |
+
background: #2a2e39;
|
| 125 |
+
border-radius: 3px;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
::-webkit-scrollbar-thumb:hover {
|
| 129 |
+
background: #4b5563;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
.text-up { color: #00f4b0; }
|
| 133 |
+
.text-down { color: #ff3747; }
|
| 134 |
+
.text-ref { color: #ffd600; }
|
| 135 |
+
|
| 136 |
+
=== components/Sidebar.jsx ===
|
| 137 |
+
import React from 'react';
|
| 138 |
+
import {
|
| 139 |
+
LayoutDashboard,
|
| 140 |
+
LineChart,
|
| 141 |
+
Newspaper,
|
| 142 |
+
Settings,
|
| 143 |
+
User,
|
| 144 |
+
Bell,
|
| 145 |
+
Search,
|
| 146 |
+
Briefcase,
|
| 147 |
+
TrendingUp
|
| 148 |
+
} from 'lucide-react';
|
| 149 |
+
|
| 150 |
+
const Sidebar = () => {
|
| 151 |
+
const navItems = [
|
| 152 |
+
{ icon: <LayoutDashboard size={20} />, label: 'Dashboard', active: true },
|
| 153 |
+
{ icon: <TrendingUp size={20} />, label: 'Market' },
|
| 154 |
+
{ icon: <Briefcase size={20} />, label: 'Portfolio' },
|
| 155 |
+
{ icon: <LineChart size={20} />, label: 'Technical' },
|
| 156 |
+
{ icon: <Newspaper size={20} />, label: 'News' },
|
| 157 |
+
{ icon: <Bell size={20} />, label: 'Alerts' },
|
| 158 |
+
];
|
| 159 |
+
|
| 160 |
+
return (
|
| 161 |
+
<div className="w-16 h-screen bg-fireant-panel border-r border-fireant-border flex flex-col items-center py-4 z-20">
|
| 162 |
+
<div className="mb-6 text-fireant-accent font-bold text-xl">FA</div>
|
| 163 |
+
|
| 164 |
+
<div className="flex-1 flex flex-col gap-2 w-full">
|
| 165 |
+
{navItems.map((item, index) => (
|
| 166 |
+
<button
|
| 167 |
+
key={index}
|
| 168 |
+
className={`w-full h-12 flex items-center justify-center transition-colors relative group
|
| 169 |
+
${item.active
|
| 170 |
+
? 'text-fireant-accent border-l-2 border-fireant-accent bg-fireant-bg'
|
| 171 |
+
: 'text-fireant-textMuted hover:text-white hover:bg-fireant-bg'}`}
|
| 172 |
+
>
|
| 173 |
+
{item.icon}
|
| 174 |
+
{/* Tooltip */}
|
| 175 |
+
<span className="absolute left-14 bg-gray-800 text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity whitespace-nowrap z-50">
|
| 176 |
+
{item.label}
|
| 177 |
+
</span>
|
| 178 |
+
</button>
|
| 179 |
+
))}
|
| 180 |
+
</div>
|
| 181 |
+
|
| 182 |
+
<div className="flex flex-col gap-4 mt-auto">
|
| 183 |
+
<button className="text-fireant-textMuted hover:text-white p-2">
|
| 184 |
+
<Settings size={20} />
|
| 185 |
+
</button>
|
| 186 |
+
<button className="text-fireant-textMuted hover:text-white p-2 mb-2">
|
| 187 |
+
<User size={20} />
|
| 188 |
+
</button>
|
| 189 |
+
</div>
|
| 190 |
+
</div>
|
| 191 |
+
);
|
| 192 |
+
};
|
| 193 |
+
|
| 194 |
+
export default Sidebar;
|
| 195 |
+
|
| 196 |
+
=== components/Header.jsx ===
|
| 197 |
+
import React from 'react';
|
| 198 |
+
import { Search, Menu, Bell, Download } from 'lucide-react';
|
| 199 |
+
|
| 200 |
+
const Header = () => {
|
| 201 |
+
return (
|
| 202 |
+
<header className="h-12 bg-fireant-panel border-b border-fireant-border flex items-center px-4 justify-between shrink-0">
|
| 203 |
+
<div className="flex items-center gap-4">
|
| 204 |
+
<div className="relative">
|
| 205 |
+
<Search className="absolute left-2 top-1.5 text-fireant-textMuted" size={16} />
|
| 206 |
+
<input
|
| 207 |
+
type="text"
|
| 208 |
+
placeholder="Search symbol (e.g. VCB, FPT)..."
|
| 209 |
+
className="bg-fireant-bg border border-fireant-border rounded text-sm pl-8 pr-4 py-1 w-64 focus:outline-none focus:border-fireant-accent text-white placeholder-gray-600"
|
| 210 |
+
/>
|
| 211 |
+
</div>
|
| 212 |
+
|
| 213 |
+
<div className="hidden md:flex gap-4 text-xs font-medium">
|
| 214 |
+
<div className="flex items-center gap-2">
|
| 215 |
+
<span className="text-fireant-textMuted">VNINDEX</span>
|
| 216 |
+
<span className="text-fireant-green">1,250.35</span>
|
| 217 |
+
<span className="bg-fireant-green/10 text-fireant-green px-1 rounded">+12.5 (+1.01%)</span>
|
| 218 |
+
</div>
|
| 219 |
+
<div className="flex items-center gap-2">
|
| 220 |
+
<span className="text-fireant-textMuted">VN30</span>
|
| 221 |
+
<span className="text-fireant-red">1,260.10</span>
|
| 222 |
+
<span className="bg-fireant-red/10 text-fireant-red px-1 rounded">-2.1 (-0.15%)</span>
|
| 223 |
+
</div>
|
| 224 |
+
</div>
|
| 225 |
+
</div>
|
| 226 |
+
|
| 227 |
+
<div className="flex items-center gap-4">
|
| 228 |
+
<a
|
| 229 |
+
href="https://huggingface.co/spaces/akhaliq/anycoder"
|
| 230 |
+
target="_blank"
|
| 231 |
+
rel="noreferrer"
|
| 232 |
+
className="text-xs font-semibold text-fireant-accent hover:text-white transition-colors bg-fireant-accent/10 px-3 py-1 rounded-full border border-fireant-accent/20"
|
| 233 |
+
>
|
| 234 |
+
Built with anycoder
|
| 235 |
+
</a>
|
| 236 |
+
<button className="bg-fireant-accent text-white text-xs px-3 py-1.5 rounded hover:bg-blue-600 transition-colors font-medium hidden sm:block">
|
| 237 |
+
Upgrade Pro
|
| 238 |
+
</button>
|
| 239 |
+
<Bell className="text-fireant-textMuted hover:text-white cursor-pointer" size={18} />
|
| 240 |
+
</div>
|
| 241 |
+
</header>
|
| 242 |
+
);
|
| 243 |
+
};
|
| 244 |
+
|
| 245 |
+
export default Header;
|
| 246 |
+
|
| 247 |
+
=== components/ChartWidget.jsx ===
|
| 248 |
+
import React from 'react';
|
| 249 |
+
import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts';
|
| 250 |
+
|
| 251 |
+
const data = [
|
| 252 |
+
{ time: '09:00', price: 85.2 },
|
| 253 |
+
{ time: '09:30', price: 85.8 },
|
| 254 |
+
{ time: '10:00', price: 86.1 },
|
| 255 |
+
{ time: '10:30', price: 85.9 },
|
| 256 |
+
{ time: '11:00', price: 86.5 },
|
| 257 |
+
{ time: '11:30', price: 86.8 },
|
| 258 |
+
{ time: '13:00', price: 87.2 },
|
| 259 |
+
{ time: '13:30', price: 87.0 },
|
| 260 |
+
{ time: '14:00', price: 87.5 },
|
| 261 |
+
{ time: '14:30', price: 87.9 },
|
| 262 |
+
];
|
| 263 |
+
|
| 264 |
+
const ChartWidget = ({ symbol = "FPT" }) => {
|
| 265 |
+
return (
|
| 266 |
+
<div className="flex flex-col h-full bg-fireant-panel rounded border border-fireant-border overflow-hidden">
|
| 267 |
+
<div className="px-3 py-2 border-b border-fireant-border flex justify-between items-center bg-fireant-bg/50">
|
| 268 |
+
<div className="flex items-center gap-2">
|
| 269 |
+
<span className="font-bold text-white">{symbol}</span>
|
| 270 |
+
<span className="text-xs text-fireant-textMuted">Daily Chart</span>
|
| 271 |
+
</div>
|
| 272 |
+
<div className="flex gap-1">
|
| 273 |
+
{['1D', '1W', '1M', '3M', '1Y'].map(t => (
|
| 274 |
+
<button key={t} className={`text-xs px-2 py-0.5 rounded ${t === '1D' ? 'bg-fireant-accent text-white' : 'text-fireant-textMuted hover:bg-fireant-border'}`}>
|
| 275 |
+
{t}
|
| 276 |
+
</button>
|
| 277 |
+
))}
|
| 278 |
+
</div>
|
| 279 |
+
</div>
|
| 280 |
+
|
| 281 |
+
<div className="flex-1 w-full min-h-[200px] p-2">
|
| 282 |
+
<ResponsiveContainer width="100%" height="100%">
|
| 283 |
+
<AreaChart data={data}>
|
| 284 |
+
<defs>
|
| 285 |
+
<linearGradient id="colorPrice" x1="0" y1="0" x2="0" y2="1">
|
| 286 |
+
<stop offset="5%" stopColor="#00f4b0" stopOpacity={0.3}/>
|
| 287 |
+
<stop offset="95%" stopColor="#00f4b0" stopOpacity={0}/>
|
| 288 |
+
</linearGradient>
|
| 289 |
+
</defs>
|
| 290 |
+
<CartesianGrid strokeDasharray="3 3" stroke="#2a2e39" vertical={false} />
|
| 291 |
+
<XAxis dataKey="time" stroke="#6b7280" fontSize={10} tickLine={false} axisLine={false} />
|
| 292 |
+
<YAxis domain={['auto', 'auto']} stroke="#6b7280" fontSize={10} orientation="right" tickLine={false} axisLine={false} />
|
| 293 |
+
<Tooltip
|
| 294 |
+
contentStyle={{ backgroundColor: '#15191e', borderColor: '#2a2e39', fontSize: '12px' }}
|
| 295 |
+
itemStyle={{ color: '#00f4b0' }}
|
| 296 |
+
/>
|
| 297 |
+
<Area type="monotone" dataKey="price" stroke="#00f4b0" fillOpacity={1} fill="url(#colorPrice)" strokeWidth={2} />
|
| 298 |
+
</AreaChart>
|
| 299 |
+
</ResponsiveContainer>
|
| 300 |
+
</div>
|
| 301 |
+
|
| 302 |
+
<div className="h-8 border-t border-fireant-border flex items-center px-3 gap-4 text-xs text-fireant-textMuted">
|
| 303 |
+
<span>O: <span className="text-white">85.2</span></span>
|
| 304 |
+
<span>H: <span className="text-fireant-green">87.9</span></span>
|
| 305 |
+
<span>L: <span className="text-fireant-red">85.0</span></span>
|
| 306 |
+
<span>C: <span className="text-white">87.9</span></span>
|
| 307 |
+
<span>Vol: <span className="text-yellow-400">2.5M</span></span>
|
| 308 |
+
</div>
|
| 309 |
+
</div>
|
| 310 |
+
);
|
| 311 |
+
};
|
| 312 |
+
|
| 313 |
+
export default ChartWidget;
|
| 314 |
+
|
| 315 |
+
=== components/Watchlist.jsx ===
|
| 316 |
+
import React, { useState, useEffect } from 'react';
|
| 317 |
+
import { MoreHorizontal, Plus } from 'lucide-react';
|
| 318 |
+
|
| 319 |
+
const initialStocks = [
|
| 320 |
+
{ symbol: 'VCB', ref: 89.5, price: 91.2, change: 1.7, pct: 1.9, vol: '1.2M' },
|
| 321 |
+
{ symbol: 'FPT', ref: 105.0, price: 106.5, change: 1.5, pct: 1.4, vol: '2.5M' },
|
| 322 |
+
{ symbol: 'HPG', ref: 28.0, price: 27.8, change: -0.2, pct: -0.7, vol: '15.4M' },
|
| 323 |
+
{ symbol: 'VNM', ref: 68.5, price: 68.5, change: 0, pct: 0, vol: '800K' },
|
| 324 |
+
{ symbol: 'TCB', ref: 35.2, price: 36.0, change: 0.8, pct: 2.2, vol: '5.1M' },
|
| 325 |
+
{ symbol: 'SSI', ref: 34.5, price: 35.1, change: 0.6, pct: 1.7, vol: '8.2M' },
|
| 326 |
+
{ symbol: 'MWG', ref: 45.0, price: 44.2, change: -0.8, pct: -1.7, vol: '3.4M' },
|
| 327 |
+
{ symbol: 'STB', ref: 30.1, price: 30.5, change: 0.4, pct: 1.3, vol: '12.1M' },
|
| 328 |
+
{ symbol: 'VPB', ref: 19.5, price: 19.6, change: 0.1, pct: 0.5, vol: '9.5M' },
|
| 329 |
+
{ symbol: 'MSN', ref: 65.0, price: 64.5, change: -0.5, pct: -0.7, vol: '1.1M' },
|
| 330 |
+
];
|
| 331 |
+
|
| 332 |
+
const Watchlist = () => {
|
| 333 |
+
const [stocks, setStocks] = useState(initialStocks);
|
| 334 |
+
|
| 335 |
+
// Simulate live data updates
|
| 336 |
+
useEffect(() => {
|
| 337 |
+
const interval = setInterval(() => {
|
| 338 |
+
setStocks(current => current.map(stock => {
|
| 339 |
+
if (Math.random() > 0.7) {
|
| 340 |
+
const move = (Math.random() - 0.5) * 0.5;
|
| 341 |
+
const newPrice = Number((stock.price + move).toFixed(2));
|
| 342 |
+
const change = Number((newPrice - stock.ref).toFixed(2));
|
| 343 |
+
const pct = Number(((change / stock.ref) * 100).toFixed(1));
|
| 344 |
+
return { ...stock, price: newPrice, change, pct };
|
| 345 |
+
}
|
| 346 |
+
return stock;
|
| 347 |
+
}));
|
| 348 |
+
}, 2000);
|
| 349 |
+
return () => clearInterval(interval);
|
| 350 |
+
}, []);
|
| 351 |
+
|
| 352 |
+
const getColor = (val) => {
|
| 353 |
+
if (val > 0) return 'text-fireant-green';
|
| 354 |
+
if (val < 0) return 'text-fireant-red';
|
| 355 |
+
return 'text-fireant-yellow';
|
| 356 |
+
};
|
| 357 |
+
|
| 358 |
+
return (
|
| 359 |
+
<div className="flex flex-col h-full bg-fireant-panel rounded border border-fireant-border">
|
| 360 |
+
<div className="px-3 py-2 border-b border-fireant-border flex justify-between items-center bg-fireant-bg/50">
|
| 361 |
+
<span className="font-bold text-sm text-white">Watchlist VN30</span>
|
| 362 |
+
<div className="flex gap-2">
|
| 363 |
+
<button className="text-fireant-textMuted hover:text-white"><Plus size={16}/></button>
|
| 364 |
+
<button className="text-fireant-textMuted hover:text-white"><MoreHorizontal size={16}/></button>
|
| 365 |
+
</div>
|
| 366 |
+
</div>
|
| 367 |
+
|
| 368 |
+
<div className="flex-1 overflow-auto">
|
| 369 |
+
<table className="w-full text-xs text-right">
|
| 370 |
+
<thead className="bg-fireant-bg text-fireant-textMuted sticky top-0">
|
| 371 |
+
<tr>
|
| 372 |
+
<th className="text-left p-2">Symbol</th>
|
| 373 |
+
<th className="p-2">Price</th>
|
| 374 |
+
<th className="p-2">+/-</th>
|
| 375 |
+
<th className="p-2">%</th>
|
| 376 |
+
<th className="p-2">Vol</th>
|
| 377 |
+
</tr>
|
| 378 |
+
</thead>
|
| 379 |
+
<tbody>
|
| 380 |
+
{stocks.map((s) => (
|
| 381 |
+
<tr key={s.symbol} className="border-b border-fireant-border/50 hover:bg-fireant-bg/50 cursor-pointer group">
|
| 382 |
+
<td className={`text-left p-2 font-bold ${getColor(s.change)}`}>{s.symbol}</td>
|
| 383 |
+
<td className={`p-2 ${getColor(s.change)}`}>{s.price.toFixed(2)}</td>
|
| 384 |
+
<td className={`p-2 ${getColor(s.change)}`}>{s.change > 0 ? '+' : ''}{s.change.toFixed(2)}</td>
|
| 385 |
+
<td className={`p-2 ${getColor(s.change)}`}>{s.pct > 0 ? '+' : ''}{s.pct}%</td>
|
| 386 |
+
<td className="p-2 text-white">{s.vol}</td>
|
| 387 |
+
</tr>
|
| 388 |
+
))}
|
| 389 |
+
</tbody>
|
| 390 |
+
</table>
|
| 391 |
+
</div>
|
| 392 |
+
</div>
|
| 393 |
+
);
|
| 394 |
+
};
|
| 395 |
+
|
| 396 |
+
export default Watchlist;
|
| 397 |
+
|
| 398 |
+
=== components/OrderBook.jsx ===
|
| 399 |
+
import React from 'react';
|
| 400 |
+
|
| 401 |
+
const OrderBook = () => {
|
| 402 |
+
const bids = [
|
| 403 |
+
{ price: 87.8, vol: '10.5K', w: '80%' },
|
| 404 |
+
{ price: 87.7, vol: '5.2K', w: '40%' },
|
| 405 |
+
{ price: 87.6, vol: '15.1K', w: '90%' },
|
| 406 |
+
{ price: 87.5, vol: '20.0K', w: '100%' },
|
| 407 |
+
{ price: 87.4, vol: '3.5K', w: '20%' },
|
| 408 |
+
];
|
| 409 |
+
|
| 410 |
+
const asks = [
|
| 411 |
+
{ price: 87.9, vol: '8.2K', w: '60%' },
|
| 412 |
+
{ price: 88.0, vol: '12.4K', w: '75%' },
|
| 413 |
+
{ price: 88.1, vol: '4.1K', w: '30%' },
|
| 414 |
+
{ price: 88.2, vol: '9.8K', w: '65%' },
|
| 415 |
+
{ price: 88.3, vol: '2.2K', w: '15%' },
|
| 416 |
+
];
|
| 417 |
+
|
| 418 |
+
return (
|
| 419 |
+
<div className="flex flex-col h-full bg-fireant-panel rounded border border-fireant-border">
|
| 420 |
+
<div className="px-3 py-2 border-b border-fireant-border bg-fireant-bg/50">
|
| 421 |
+
<span className="font-bold text-sm text-white">Order Book</span>
|
| 422 |
+
</div>
|
| 423 |
+
|
| 424 |
+
<div className="flex-1 flex flex-col text-xs overflow-hidden">
|
| 425 |
+
{/* Asks (Sellers) - Red */}
|
| 426 |
+
<div className="flex-1 flex flex-col-reverse overflow-hidden">
|
| 427 |
+
{asks.map((a, i) => (
|
| 428 |
+
<div key={i} className="flex relative hover:bg-fireant-bg/50 cursor-pointer py-0.5">
|
| 429 |
+
<div className="absolute right-0 top-0 bottom-0 bg-fireant-red/10" style={{ width: a.w }}></div>
|
| 430 |
+
<div className="flex-1 z-10 pl-2 text-fireant-textMuted">{a.vol}</div>
|
| 431 |
+
<div className="flex-1 z-10 text-right pr-2 text-fireant-red">{a.price}</div>
|
| 432 |
+
</div>
|
| 433 |
+
))}
|
| 434 |
+
</div>
|
| 435 |
+
|
| 436 |
+
<div className="h-8 border-y border-fireant-border flex items-center justify-between px-4 bg-fireant-bg">
|
| 437 |
+
<span className="text-fireant-green font-bold text-lg">87.90</span>
|
| 438 |
+
<span className="text-fireant-textMuted">Last Match</span>
|
| 439 |
+
</div>
|
| 440 |
+
|
| 441 |
+
{/* Bids (Buyers) - Green */}
|
| 442 |
+
<div className="flex-1 overflow-hidden">
|
| 443 |
+
{bids.map((b, i) => (
|
| 444 |
+
<div key={i} className="flex relative hover:bg-fireant-bg/50 cursor-pointer py-0.5">
|
| 445 |
+
<div className="absolute right-0 top-0 bottom-0 bg-fireant-green/10" style={{ width: b.w }}></div>
|
| 446 |
+
<div className="flex-1 z-10 pl-2 text-fireant-textMuted">{b.vol}</div>
|
| 447 |
+
<div className="flex-1 z-10 text-right pr-2 text-fireant-green">{b.price}</div>
|
| 448 |
+
</div>
|
| 449 |
+
))}
|
| 450 |
+
</div>
|
| 451 |
+
</div>
|
| 452 |
+
</div>
|
| 453 |
+
);
|
| 454 |
+
};
|
| 455 |
+
|
| 456 |
+
export default OrderBook;
|
| 457 |
+
|
| 458 |
+
=== components/NewsWidget.jsx ===
|
| 459 |
+
import React from 'react';
|
| 460 |
+
import { ExternalLink } from 'lucide-react';
|
| 461 |
+
|
| 462 |
+
const news = [
|
| 463 |
+
{ id: 1, time: '14:30', title: 'VN-Index gains 12 points as banking stocks surge', source: 'CafeF' },
|
| 464 |
+
{ id: 2, time: '13:15', title: 'Foreign investors net sold 500 billion VND today', source: 'Vietstock' },
|
| 465 |
+
{ id: 3, time: '11:45', title: 'FPT reports 20% profit growth in Q1 2024', source: 'FireAnt' },
|
| 466 |
+
{ id: 4, time: '10:20', title: 'Oil prices stabilize amidst global tensions', source: 'Reuters' },
|
| 467 |
+
{ id: 5, time: '09:45', title: 'Morning brief: Market opens green, liquidity improves', source: 'VnEconomy' },
|
| 468 |
+
{ id: 6, time: '09:00', title: 'State Bank continues to manage exchange rate flexibly', source: 'SBV' },
|
| 469 |
+
];
|
| 470 |
+
|
| 471 |
+
const NewsWidget = () => {
|
| 472 |
+
return (
|
| 473 |
+
<div className="flex flex-col h-full bg-fireant-panel rounded border border-fireant-border">
|
| 474 |
+
<div className="px-3 py-2 border-b border-fireant-border bg-fireant-bg/50 flex justify-between items-center">
|
| 475 |
+
<span className="font-bold text-sm text-white">Latest News</span>
|
| 476 |
+
<button className="text-xs text-fireant-accent hover:underline">View All</button>
|
| 477 |
+
</div>
|
| 478 |
+
|
| 479 |
+
<div className="flex-1 overflow-auto p-2">
|
| 480 |
+
<div className="flex flex-col gap-3">
|
| 481 |
+
{news.map((item) => (
|
| 482 |
+
<div key={item.id} className="group cursor-pointer border-b border-fireant-border/30 pb-2 last:border-0">
|
| 483 |
+
<div className="flex justify-between text-xs text-fireant-textMuted mb-1">
|
| 484 |
+
<span>{item.time}</span>
|
| 485 |
+
<span className="text-fireant-accent">{item.source}</span>
|
| 486 |
+
</div>
|
| 487 |
+
<h4 className="text-sm text-gray-300 group-hover:text-fireant-accent transition-colors line-clamp-2 leading-snug">
|
| 488 |
+
{item.title}
|
| 489 |
+
</h4>
|
| 490 |
+
</div>
|
| 491 |
+
))}
|
| 492 |
+
</div>
|
| 493 |
+
</div>
|
| 494 |
+
</div>
|
| 495 |
+
);
|
| 496 |
+
};
|
| 497 |
+
|
| 498 |
+
export default NewsWidget;
|
| 499 |
+
|
| 500 |
+
=== components/Layout.jsx ===
|
| 501 |
+
import React from 'react';
|
| 502 |
+
import Sidebar from './Sidebar';
|
| 503 |
+
import Header from './Header';
|
| 504 |
+
|
| 505 |
+
const Layout = ({ children }) => {
|
| 506 |
+
return (
|
| 507 |
+
<div className="flex h-screen w-screen bg-fireant-bg text-fireant-text overflow-hidden font-sans">
|
| 508 |
+
<Sidebar />
|
| 509 |
+
<div className="flex-1 flex flex-col min-w-0">
|
| 510 |
+
<Header />
|
| 511 |
+
<main className="flex-1 overflow-hidden p-2 relative">
|
| 512 |
+
{children}
|
| 513 |
+
</main>
|
| 514 |
+
</div>
|
| 515 |
+
</div>
|
| 516 |
+
);
|
| 517 |
+
};
|
| 518 |
+
|
| 519 |
+
export default Layout;
|
| 520 |
+
|
| 521 |
+
=== pages/index.js ===
|
| 522 |
+
import React from 'react';
|
| 523 |
+
import Layout from '../components/Layout';
|
| 524 |
+
import Watchlist from '../components/Watchlist';
|
| 525 |
+
import ChartWidget from '../components/ChartWidget';
|
| 526 |
+
import OrderBook from '../components/OrderBook';
|
| 527 |
+
import NewsWidget from '../components/NewsWidget';
|
| 528 |
+
|
| 529 |
+
export default function Dashboard() {
|
| 530 |
+
return (
|
| 531 |
+
<Layout>
|
| 532 |
+
{/* Main Grid Layout */}
|
| 533 |
+
<div className="grid grid-cols-12 grid-rows-6 gap-2 h-full w-full">
|
| 534 |
+
|
| 535 |
+
{/* Left Column: Watchlist (Takes 3 cols, full height) */}
|
| 536 |
+
<div className="col-span-12 md:col-span-4 lg:col-span-3 row-span-3 md:row-span-6">
|
| 537 |
+
<Watchlist />
|
| 538 |
+
</div>
|
| 539 |
+
|
| 540 |
+
{/* Middle Column: Chart & Order Book */}
|
| 541 |
+
<div className="col-span-12 md:col-span-8 lg:col-span-6 row-span-6 flex flex-col gap-2">
|
| 542 |
+
{/* Chart takes upper 2/3 */}
|
| 543 |
+
<div className="flex-[2] min-h-0">
|
| 544 |
+
<ChartWidget symbol="FPT" />
|
| 545 |
+
</div>
|
| 546 |
+
{/* Order Book takes lower 1/3 */}
|
| 547 |
+
<div className="flex-1 min-h-0 grid grid-cols-2 gap-2">
|
| 548 |
+
<OrderBook />
|
| 549 |
+
{/* Another widget placeholder (e.g., Foreign Flow) */}
|
| 550 |
+
<div className="bg-fireant-panel border border-fireant-border rounded p-3 flex flex-col">
|
| 551 |
+
<div className="text-sm font-bold text-white mb-2 border-b border-fireant-border pb-2">Foreign Flow</div>
|
| 552 |
+
<div className="flex-1 flex items-center justify-center text-fireant-textMuted text-xs">
|
| 553 |
+
<div className="text-center">
|
| 554 |
+
<div className="mb-1">Net Buy</div>
|
| 555 |
+
<div className="text-xl text-fireant-green font-bold">+45.2B</div>
|
| 556 |
+
</div>
|
| 557 |
+
</div>
|
| 558 |
+
</div>
|
| 559 |
+
</div>
|
| 560 |
+
</div>
|
| 561 |
+
|
| 562 |
+
{/* Right Column: News & Events (Hidden on smaller tablets, visible on large screens) */}
|
| 563 |
+
<div className="hidden lg:block lg:col-span-3 row-span-6 flex flex-col gap-2">
|
| 564 |
+
<div className="flex-1 min-h-0">
|
| 565 |
+
<NewsWidget />
|
| 566 |
+
</div>
|
| 567 |
+
<div className="h-1/3 bg-fireant-panel border border-fireant-border rounded p-3">
|
| 568 |
+
<div className="text-sm font-bold text-white mb-2">Market Movers</div>
|
| 569 |
+
<div className="space-y-2 text-xs">
|
| 570 |
+
<div className="flex justify-between items-center">
|
| 571 |
+
<span>VCB</span>
|
| 572 |
+
<span className="text-fireant-green">+2.5%</span>
|
| 573 |
+
</div>
|
| 574 |
+
<div className="flex justify-between items-center">
|
| 575 |
+
<span>BID</span>
|
| 576 |
+
<span className="text-fireant-green">+1.8%</span>
|
| 577 |
+
</div>
|
| 578 |
+
<div className="flex justify-between items-center">
|
| 579 |
+
<span>VHM</span>
|
| 580 |
+
<span className="text-fireant-red">-1.2%</span>
|
| 581 |
+
</div>
|
| 582 |
+
</div>
|
| 583 |
+
</div>
|
| 584 |
+
</div>
|
| 585 |
+
|
| 586 |
+
</div>
|
| 587 |
+
</Layout>
|
| 588 |
+
);
|
| 589 |
+
}
|
| 590 |
+
|
| 591 |
+
=== pages/_app.js ===
|
| 592 |
+
import '../styles/globals.css';
|
| 593 |
+
import Head from 'next/head';
|
| 594 |
+
|
| 595 |
+
function MyApp({ Component, pageProps }) {
|
| 596 |
+
return (
|
| 597 |
+
<>
|
| 598 |
+
<Head>
|
| 599 |
+
<title>FireAnt Dashboard Clone</title>
|
| 600 |
+
<meta name="description" content="Financial dashboard clone built with Next.js and Tailwind" />
|
| 601 |
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 602 |
+
</Head>
|
| 603 |
+
<Component {...pageProps} />
|
| 604 |
+
</>
|
| 605 |
+
);
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
export default MyApp;
|
| 609 |
+
|
| 610 |
+
=== pages/api/hello.js ===
|
| 611 |
+
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
| 612 |
+
|
| 613 |
+
export default function handler(req, res) {
|
| 614 |
+
res.status(200).json({ name: 'John Doe' })
|
| 615 |
+
}
|