Add Playwright configuration and initial tests for landing page
Copilot Setup Steps / copilot-setup-steps (push) Failing after 17s
Copilot Setup Steps / copilot-setup-steps (push) Failing after 17s
- Created playwright.config.ts for test configuration - Added .last-run.json to store test run status - Implemented landing.test.ts with tests for navbar visibility and navigation - Removed unused server proxy configuration from vite.config.ts
This commit is contained in:
@@ -12,42 +12,45 @@ export default function AlpacaAccountInfo() {
|
||||
const fetchAccount = async () => {
|
||||
try {
|
||||
const res = await fetch("/api/alpaca/account");
|
||||
if (!res.ok) throw new Error("API error");
|
||||
const data = await res.json();
|
||||
if (!res.ok) {
|
||||
throw new Error(data.error || "API error");
|
||||
}
|
||||
setAccount(data);
|
||||
} catch {
|
||||
setError("Failed to load account info.");
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : "Failed to load account info.";
|
||||
setError(message);
|
||||
}
|
||||
};
|
||||
fetchAccount();
|
||||
}, []);
|
||||
|
||||
if (error) return <p className="text-red-600">{error}</p>;
|
||||
if (!account) return <p className="text-gray-500">Loading account…</p>;
|
||||
if (error) return <p className="text-red-600 p-4 text-center">{error}</p>;
|
||||
if (!account) return <p className="text-gray-600 p-4 text-center">Loading account…</p>;
|
||||
|
||||
return (
|
||||
<div className="bg-white border rounded-lg p-4 shadow-sm">
|
||||
<h2 className="text-lg font-semibold mb-2">Alpaca Account</h2>
|
||||
<dl className="space-y-1 text-sm">
|
||||
<div className="flex justify-between">
|
||||
<dt className="text-gray-600">Cash</dt>
|
||||
<dd className="font-mono">
|
||||
<div className="bg-white rounded-xl shadow-lg p-6 border border-gray-200">
|
||||
<h2 className="text-xl font-bold text-gray-900 mb-4 text-center">Trading Account</h2>
|
||||
<div className="space-y-3">
|
||||
<div className="flex justify-between items-center py-2 border-b border-gray-100">
|
||||
<span className="text-gray-600 font-medium">Cash</span>
|
||||
<span className="text-lg font-bold text-green-600">
|
||||
${account.cash.toLocaleString(undefined, { minimumFractionDigits: 2 })}
|
||||
</dd>
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<dt className="text-gray-600">Buying Power</dt>
|
||||
<dd className="font-mono">
|
||||
<div className="flex justify-between items-center py-2 border-b border-gray-100">
|
||||
<span className="text-gray-600 font-medium">Buying Power</span>
|
||||
<span className="text-lg font-bold text-blue-600">
|
||||
${account.buying_power.toLocaleString(undefined, { minimumFractionDigits: 2 })}
|
||||
</dd>
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<dt className="text-gray-600">Portfolio Value</dt>
|
||||
<dd className="font-mono">
|
||||
<div className="flex justify-between items-center py-2">
|
||||
<span className="text-gray-600 font-medium">Portfolio Value</span>
|
||||
<span className="text-lg font-bold text-purple-600">
|
||||
${account.portfolio_value.toLocaleString(undefined, { minimumFractionDigits: 2 })}
|
||||
</dd>
|
||||
</span>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user