Selaa lähdekoodia

fix(my-lp): 狙击加仓使用父行 nftMintAddress

- childColumns 改为 getChildColumns(parentRecord),子表列按父行生成
- 狙击按钮调用 handleSnipeAddPosition(parentRecord, finalAmount),加仓到父仓位

Co-authored-by: Cursor <cursoragent@cursor.com>
lushdog@outlook.com 1 kuukausi sitten
vanhempi
commit
f2ba91f662
1 muutettua tiedostoa jossa 22 lisäystä ja 18 poistoa
  1. 22 18
      src/app/my-lp/page.tsx

+ 22 - 18
src/app/my-lp/page.tsx

@@ -428,7 +428,24 @@ function MyLPPageContent() {
 		return '-'
 	}
 
-	const childColumns: ColumnsType<RecordInfo> = [
+	const getChildColumns = (
+		parentRecord: RecordInfo
+	): ColumnsType<RecordInfo> => [
+		{
+			title: 'Wallet Address',
+			dataIndex: 'walletAddress',
+			key: 'walletAddress',
+			render: (text: string, record: RecordInfo) => (
+				<span className="font-mono text-sm">
+					<Typography.Link
+						href={`https://www.byreal.io/en/portfolio?userAddress=${record.walletAddress}&tab=current&positionAddress=${record.positionAddress}&tokenAddress=${getPoolInfo(record.poolAddress).tokenAAddress}&tokenAddress=${getPoolInfo(record.poolAddress).tokenBAddress}`}
+						target="_blank"
+					>
+						{String(text ?? '').slice(0, 6)}...{String(text ?? '').slice(-4)}
+					</Typography.Link>
+				</span>
+			),
+		},
 		{
 			title: 'Bonus USD',
 			dataIndex: 'bonusUsd',
@@ -472,21 +489,6 @@ function MyLPPageContent() {
 				</span>
 			),
 		},
-		{
-			title: 'Wallet Address',
-			dataIndex: 'walletAddress',
-			key: 'walletAddress',
-			render: (text: string, record: RecordInfo) => (
-				<span className="font-mono text-sm">
-					<Typography.Link
-						href={`https://www.byreal.io/en/portfolio?userAddress=${record.walletAddress}&tab=current&positionAddress=${record.positionAddress}&tokenAddress=${getPoolInfo(record.poolAddress).tokenAAddress}&tokenAddress=${getPoolInfo(record.poolAddress).tokenBAddress}`}
-						target="_blank"
-					>
-						{String(text ?? '').slice(0, 6)}...{String(text ?? '').slice(-4)}
-					</Typography.Link>
-				</span>
-			),
-		},
 		{
 			title: '狙击',
 			key: 'snipe',
@@ -540,7 +542,9 @@ function MyLPPageContent() {
 						</span>
 						<Tooltip title="狙击(倍数×金额)">
 							<Typography.Link
-								onClick={() => handleSnipeAddPosition(record, finalAmount)}
+								onClick={() =>
+									handleSnipeAddPosition(parentRecord, finalAmount)
+								}
 								className="inline-flex items-center"
 							>
 								<AimOutlined style={{ fontSize: '18px', color: '#fa8c16' }} />
@@ -1095,7 +1099,7 @@ function MyLPPageContent() {
 									<div className="bg-gray-50/80 py-2 pr-4">
 										<Table
 											size="small"
-											columns={childColumns}
+											columns={getChildColumns(record)}
 											dataSource={list}
 											rowKey="positionAddress"
 											pagination={false}