feat(api): 接入 yahoo-finance2 构建股票自动行情引擎,并实装一键同步按钮
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { getAssets } from '@/actions/asset';
|
||||
import { AddAssetDialog } from '@/components/assets/add-asset-dialog';
|
||||
import { UpdatePriceDialog } from '@/components/assets/update-price-dialog';
|
||||
import { SyncButton } from '@/components/assets/sync-button';
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
@@ -25,7 +25,10 @@ export default async function AssetsPage() {
|
||||
<div className="space-y-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-2xl font-bold">資產列表</h1>
|
||||
<AddAssetDialog />
|
||||
<div className="flex gap-2">
|
||||
<SyncButton />
|
||||
<AddAssetDialog />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="rounded-md border">
|
||||
@@ -38,13 +41,12 @@ export default async function AssetsPage() {
|
||||
<TableHead>基礎幣種</TableHead>
|
||||
<TableHead>當前市價 (Latest Price)</TableHead>
|
||||
<TableHead>創建時間</TableHead>
|
||||
<TableHead>操作</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{assets.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={6} className="text-center text-muted-foreground">
|
||||
<TableCell colSpan={5} className="text-center text-muted-foreground">
|
||||
暫無資產,點擊"添加資產"按鈕錄入第一個資產
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
@@ -60,9 +62,6 @@ export default async function AssetsPage() {
|
||||
? new Date(asset.createdAt).toLocaleString('zh-CN')
|
||||
: '-'}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<UpdatePriceDialog assetId={asset.id} currentPrice={asset.latestPrice ? new Big(asset.latestPrice).toString() : '0'} />
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user