Skip to content

Commit

Permalink
Clean up the design
Browse files Browse the repository at this point in the history
  • Loading branch information
mcintyre94 committed Dec 2, 2024
1 parent af116ac commit 4c023b8
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions src/routes/trades.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ type TokenAmountCellProps = {
adjustedForDecimals: boolean;
};
tokenMintData: MintData | undefined;
isDeposit: boolean;
onNumberClick?: () => void;
tokenPrice?: number;
};
Expand All @@ -480,7 +479,6 @@ function TokenAmountCell({
address,
amountToDisplay,
tokenMintData,
isDeposit,
onNumberClick,
tokenPrice,
}: TokenAmountCellProps) {
Expand Down Expand Up @@ -515,7 +513,6 @@ function TokenAmountCell({
// when there is a USD amount we display it underneath, flex-start alignment looks better
align={usdAmount ? "flex-start" : "center"}
>
{isDeposit && <Text>Deposited</Text>}
<Image
src={tokenMintData.logoURI}
width={16}
Expand Down Expand Up @@ -722,19 +719,16 @@ function StrategyKeyIcon({ strategyKey }: { strategyKey: Address }) {
}

type TransactionEventCellProps = {
eventType: "deposit" | "trade";
strategyType: StrategyType;
strategyKey: Address;
};

function TransactionEventCell({
eventType,
strategyType,
strategyKey,
}: TransactionEventCellProps) {
return (
<Group maw={150} justify="space-between">
<TransactionEventTypeBadge eventType={eventType} />
<Group maw={120} justify="space-between">
<TransactionStrategyBadge strategyType={strategyType} />
<StrategyKeyIcon strategyKey={strategyKey} />
</Group>
Expand Down Expand Up @@ -868,20 +862,21 @@ function TradeRow({
<Table.Tr key={trade.transactionSignature}>
<Table.Td>
<TransactionEventCell
eventType="trade"
strategyType={trade.strategyType}
strategyKey={trade.strategyKey}
/>
</Table.Td>
<Table.Td style={{ width: "1%" }}>
<DateCell date={trade.date} />
</Table.Td>
<Table.Td>
<TransactionEventTypeBadge eventType="trade" />
</Table.Td>
<Table.Td>
<TokenAmountCell
address={trade.inputMint}
amountToDisplay={trade.inputAmount}
tokenMintData={inputMintData}
isDeposit={false}
tokenPrice={inputTokenPrice}
/>
</Table.Td>
Expand All @@ -890,7 +885,6 @@ function TradeRow({
address={trade.outputMint}
amountToDisplay={outputAmountWithFee}
tokenMintData={outputMintData}
isDeposit={false}
onNumberClick={switchSubtractFee}
tokenPrice={outputTokenPrice}
/>
Expand Down Expand Up @@ -946,20 +940,21 @@ function DepositRow({ deposit, mints, tokenPrices }: DepositRowProps) {
<Table.Tr key={deposit.transactionSignature}>
<Table.Td>
<TransactionEventCell
eventType="deposit"
strategyType={deposit.strategyType}
strategyKey={deposit.strategyKey}
/>
</Table.Td>
<Table.Td>
<DateCell date={deposit.date} />
</Table.Td>
<Table.Td>
<TransactionEventTypeBadge eventType="deposit" />
</Table.Td>
<Table.Td colSpan={3}>
<TokenAmountCell
address={deposit.inputMint}
amountToDisplay={deposit.inputAmount}
tokenMintData={inputMintData}
isDeposit={true}
tokenPrice={tokenPrice}
/>
</Table.Td>
Expand Down Expand Up @@ -1210,9 +1205,10 @@ export default function Trades() {
<Table stickyHeader horizontalSpacing="lg">
<Table.Thead>
<Table.Tr>
<Table.Th>Event</Table.Th>
<Table.Th>Position</Table.Th>
<Table.Th>Date</Table.Th>
<Table.Th>Swapped</Table.Th>
<Table.Th>Action</Table.Th>
<Table.Th>Amount</Table.Th>
<Table.Th>
<Group gap="xl">
<Text fw={700}>For</Text>
Expand Down Expand Up @@ -1287,12 +1283,3 @@ export default function Trades() {
</>
);
}

// TODO next (maybe)

/**
*
* - rename event to position, only include strategy type + address
* - create an action column, that can be deposit or trade (maybe swap?) Between date and swapped
* - rename "Swapped" to "Amount"
*/

0 comments on commit 4c023b8

Please sign in to comment.