From ed31f3b747845025f34d95aac9009e91c70640cc Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Mon, 9 Dec 2024 16:38:34 -0800 Subject: [PATCH 1/7] wip --- src/pages/inspect/ui/actions.tsx | 6 +- src/pages/inspect/ui/executions.tsx | 166 +++++++++++++++++----------- 2 files changed, 106 insertions(+), 66 deletions(-) diff --git a/src/pages/inspect/ui/actions.tsx b/src/pages/inspect/ui/actions.tsx index f58a5b49..20362ef6 100644 --- a/src/pages/inspect/ui/actions.tsx +++ b/src/pages/inspect/ui/actions.tsx @@ -10,7 +10,7 @@ import { useLpIdInUrl } from '@/pages/inspect/ui/result.tsx'; import { useLpPosition } from '@/pages/inspect/lp/api/position.ts'; import { Skeleton } from '@/shared/ui/skeleton.tsx'; -const PositionClosed = ({ +export const PositionClosed = ({ closingTx, closingTime, closingHeight, @@ -38,7 +38,7 @@ const PositionClosed = ({ ); }; -const PositionWithdraw = ({ withdrawal }: { withdrawal: PositionWithdrawal }) => { +export const PositionWithdraw = ({ withdrawal }: { withdrawal: PositionWithdrawal }) => { return (
@@ -61,7 +61,7 @@ const PositionWithdraw = ({ withdrawal }: { withdrawal: PositionWithdrawal }) => ); }; -const PositionOpen = ({ state }: { state: PositionStateResponse }) => { +export const PositionOpen = ({ state }: { state: PositionStateResponse }) => { return (
diff --git a/src/pages/inspect/ui/executions.tsx b/src/pages/inspect/ui/executions.tsx index ec6b97da..496fe263 100644 --- a/src/pages/inspect/ui/executions.tsx +++ b/src/pages/inspect/ui/executions.tsx @@ -10,13 +10,105 @@ import { TimeDisplay } from '@/pages/inspect/ui/time.tsx'; import { useLpIdInUrl } from '@/pages/inspect/ui/result.tsx'; import { useLpPosition } from '@/pages/inspect/lp/api/position.ts'; import { Skeleton } from '@/shared/ui/skeleton.tsx'; +import { + PositionStateResponse, + PositionWithdrawal, +} from '@/shared/api/server/position/timeline/types.ts'; +import { PositionWithdraw, PositionClosed, PositionOpen } from '@/pages/inspect/ui/actions.tsx'; -const DataBody = ({ executions }: { executions: PositionExecutions }) => { +interface ExecutionProps { + execution: PositionExecutions['items'][0]; +} + +const Execution = ({ execution: e }: ExecutionProps) => { + return ( + + +
+
+
+ + + Trade Input + +
+
+ +
+
+ + + Trade Output + +
+
+ + + LP Fee + +
+
+
+
+ + Routing + + + + +
+
+ + New Reserves + +
+ + +
+
+
+
+
+
+ ); +}; + +const DataBody = ({ + state, + withdrawals, + executions +}: { + state: PositionStateResponse; + withdrawals: PositionWithdrawal[]; + executions: PositionExecutions; +}) => { return (
+ {withdrawals.map((w, i) => ( + + ))} + {state.closingTime && state.closingHeight && ( + + )} {executions.items.length === 0 && ( - None + No executions )} {executions.items.map((e, i) => ( @@ -25,66 +117,7 @@ const DataBody = ({ executions }: { executions: PositionExecutions }) => {
- - -
-
-
- - - Trade Input - -
-
- -
-
- - - Trade Output - -
-
- - - LP Fee - -
-
-
-
- - Routing - - - - -
-
- - New Reserves - -
- - -
-
-
-
-
-
+
))} @@ -100,6 +133,7 @@ const DataBody = ({ executions }: { executions: PositionExecutions }) => {
)} + ); }; @@ -198,7 +232,13 @@ export const Executions = () => { Executions {isLoading && } - {data && } + {data && ( + + )} ); }; From 026b7260b91fb0d1a5dce15072ca3cec82b81a2a Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Mon, 9 Dec 2024 16:50:49 -0800 Subject: [PATCH 2/7] wip --- src/pages/inspect/ui/actions.tsx | 102 ++++++++++++--------- src/pages/inspect/ui/executions.tsx | 136 ++++++++++++++-------------- src/pages/inspect/ui/result.tsx | 4 +- 3 files changed, 129 insertions(+), 113 deletions(-) diff --git a/src/pages/inspect/ui/actions.tsx b/src/pages/inspect/ui/actions.tsx index 20362ef6..4d85c744 100644 --- a/src/pages/inspect/ui/actions.tsx +++ b/src/pages/inspect/ui/actions.tsx @@ -20,67 +20,81 @@ export const PositionClosed = ({ closingTx?: string; }) => { return ( - -
-
- {closingTx && ( - - Tx: {closingTx} - - )} -
+
+
-
- -
+ +
+
+ {closingTx && ( + + Tx: {closingTx} + + )} +
+ +
+
+
+
- +
+ +
+
); }; export const PositionWithdraw = ({ withdrawal }: { withdrawal: PositionWithdrawal }) => { return ( - -
-
-
- - -
+
+
- - Tx: {withdrawal.txHash} - -
+ +
+
+
+ + +
-
- -
+ + Tx: {withdrawal.txHash} + +
+
+
- +
+ +
+
); }; export const PositionOpen = ({ state }: { state: PositionStateResponse }) => { return ( - -
-
-
- - -
- - - Tx: {state.openingTx} - -
+
+
+ +
+
+
+ + +
-
- -
+ + Tx: {state.openingTx} + +
+
+
+
+
+
- +
); }; diff --git a/src/pages/inspect/ui/executions.tsx b/src/pages/inspect/ui/executions.tsx index 496fe263..306ea5da 100644 --- a/src/pages/inspect/ui/executions.tsx +++ b/src/pages/inspect/ui/executions.tsx @@ -22,66 +22,73 @@ interface ExecutionProps { const Execution = ({ execution: e }: ExecutionProps) => { return ( - - -
-
-
- - - Trade Input - -
-
- -
-
- - - Trade Output - -
-
- - - LP Fee - -
-
-
-
- - Routing - - - - -
-
- - New Reserves - -
- - +
+
+ +
+
+ + +
+
+
+ + + Trade Input + +
+
+ +
+
+ + + Trade Output + +
+
+ + + LP Fee + +
+
+
+
+ + Routing + + + + +
+
+ + New Reserves + +
+ + +
+
-
-
- - + + +
+
); }; @@ -112,13 +119,8 @@ const DataBody = ({ )} {executions.items.map((e, i) => ( -
-
- -
-
- -
+
+
))} {executions.skipped > 0 && ( @@ -222,14 +224,14 @@ const LoadingState = () => { ); }; -export const Executions = () => { +export const Timeline = () => { const id = useLpIdInUrl(); const { data, isLoading } = useLpPosition(id); return (
- Executions + Position Timeline {isLoading && } {data && ( diff --git a/src/pages/inspect/ui/result.tsx b/src/pages/inspect/ui/result.tsx index e495a70b..468a8536 100644 --- a/src/pages/inspect/ui/result.tsx +++ b/src/pages/inspect/ui/result.tsx @@ -7,7 +7,7 @@ import { StateDetails } from '@/pages/inspect/ui/state-details.tsx'; import { VolumeAndFeesTable } from '@/pages/inspect/ui/volume.tsx'; import { Actions } from '@/pages/inspect/ui/actions.tsx'; import { DebugView } from '@/pages/inspect/ui/debug.tsx'; -import { Executions } from '@/pages/inspect/ui/executions.tsx'; +import { Timeline } from '@/pages/inspect/ui/executions.tsx'; const ErrorState = ({ error }: { error: unknown }) => { return {String(error)}; @@ -55,7 +55,7 @@ export const LpInspectResult = () => { {/* Second Column */}
- +
From 224ce82c8a9deb7209820c8e318da0006b4703c5 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Mon, 9 Dec 2024 16:59:42 -0800 Subject: [PATCH 3/7] wip layout --- src/pages/inspect/ui/result.tsx | 7 ++----- src/pages/inspect/ui/volume.tsx | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pages/inspect/ui/result.tsx b/src/pages/inspect/ui/result.tsx index 468a8536..774acd6b 100644 --- a/src/pages/inspect/ui/result.tsx +++ b/src/pages/inspect/ui/result.tsx @@ -40,10 +40,7 @@ export const LpInspectResult = () => {
- -
-
- +
{/* DebugView only on larger screens */} @@ -55,7 +52,7 @@ export const LpInspectResult = () => { {/* Second Column */}
- +
diff --git a/src/pages/inspect/ui/volume.tsx b/src/pages/inspect/ui/volume.tsx index 8b93b7b7..b1b6abac 100644 --- a/src/pages/inspect/ui/volume.tsx +++ b/src/pages/inspect/ui/volume.tsx @@ -93,7 +93,7 @@ const DataBody = ({ v }: { v: VolumeAndFeesResponse }) => { - Total + Total (All Routes) {v.totals.executionCount} From da03cf4043ff6dff104d6600e288e3498cb2a14c Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Mon, 9 Dec 2024 16:59:51 -0800 Subject: [PATCH 4/7] fix wrong data --- src/shared/api/server/position/timeline/state.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/api/server/position/timeline/state.ts b/src/shared/api/server/position/timeline/state.ts index 2f79d6e4..208d66c4 100644 --- a/src/shared/api/server/position/timeline/state.ts +++ b/src/shared/api/server/position/timeline/state.ts @@ -48,14 +48,14 @@ export const getPositionState = async (id: PositionId): Promise Date: Mon, 9 Dec 2024 18:19:18 -0800 Subject: [PATCH 5/7] lint fix --- src/pages/inspect/ui/result.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/inspect/ui/result.tsx b/src/pages/inspect/ui/result.tsx index 774acd6b..3b8e2c04 100644 --- a/src/pages/inspect/ui/result.tsx +++ b/src/pages/inspect/ui/result.tsx @@ -5,7 +5,6 @@ import { Text } from '@penumbra-zone/ui/Text'; import { useLpPosition } from '@/pages/inspect/lp/api/position.ts'; import { StateDetails } from '@/pages/inspect/ui/state-details.tsx'; import { VolumeAndFeesTable } from '@/pages/inspect/ui/volume.tsx'; -import { Actions } from '@/pages/inspect/ui/actions.tsx'; import { DebugView } from '@/pages/inspect/ui/debug.tsx'; import { Timeline } from '@/pages/inspect/ui/executions.tsx'; From bba5ba67799a99aafa5152d00421614213d5aab9 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Mon, 9 Dec 2024 18:22:32 -0800 Subject: [PATCH 6/7] lint fix --- src/pages/inspect/ui/executions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/inspect/ui/executions.tsx b/src/pages/inspect/ui/executions.tsx index 306ea5da..08a4196b 100644 --- a/src/pages/inspect/ui/executions.tsx +++ b/src/pages/inspect/ui/executions.tsx @@ -1,4 +1,3 @@ -import { PositionExecutions } from '@/shared/api/server/position/timeline/types.ts'; import { Text } from '@penumbra-zone/ui/Text'; import { Card } from '@penumbra-zone/ui/Card'; import { Density } from '@penumbra-zone/ui/Density'; @@ -11,6 +10,7 @@ import { useLpIdInUrl } from '@/pages/inspect/ui/result.tsx'; import { useLpPosition } from '@/pages/inspect/lp/api/position.ts'; import { Skeleton } from '@/shared/ui/skeleton.tsx'; import { + PositionExecutions, PositionStateResponse, PositionWithdrawal, } from '@/shared/api/server/position/timeline/types.ts'; From 4e2b8e1e03f5c4cffb9a384e539225d8eabc40f8 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Mon, 9 Dec 2024 18:27:56 -0800 Subject: [PATCH 7/7] fmt fix --- src/pages/inspect/ui/actions.tsx | 5 +---- src/pages/inspect/ui/executions.tsx | 14 +++----------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/pages/inspect/ui/actions.tsx b/src/pages/inspect/ui/actions.tsx index 4d85c744..7831081f 100644 --- a/src/pages/inspect/ui/actions.tsx +++ b/src/pages/inspect/ui/actions.tsx @@ -22,7 +22,6 @@ export const PositionClosed = ({ return (
-
@@ -33,8 +32,7 @@ export const PositionClosed = ({ )}
-
-
+
@@ -49,7 +47,6 @@ export const PositionWithdraw = ({ withdrawal }: { withdrawal: PositionWithdrawa return (
-
diff --git a/src/pages/inspect/ui/executions.tsx b/src/pages/inspect/ui/executions.tsx index 08a4196b..d24ca5c2 100644 --- a/src/pages/inspect/ui/executions.tsx +++ b/src/pages/inspect/ui/executions.tsx @@ -47,11 +47,7 @@ const Execution = ({ execution: e }: ExecutionProps) => {
- + LP Fee @@ -95,7 +91,7 @@ const Execution = ({ execution: e }: ExecutionProps) => { const DataBody = ({ state, withdrawals, - executions + executions, }: { state: PositionStateResponse; withdrawals: PositionWithdrawal[]; @@ -235,11 +231,7 @@ export const Timeline = () => { {isLoading && } {data && ( - + )}
);