All display related decisions are taken in the UI, but on top of the UI's model.
For this purpose we introduce classes for `CfdState` and `Position` so we can add the relevant mapping functions to these classes.
To achieve the mapping from daemon sse even to the `Cfd` / `Order` interface (that now contain classes instead of just primitives) we extend the sse hook to accept a mapping function.
We define this mapping function for `Cfd` and `Order`, because those contain classes, for all others we just use the default mapping.
Actions are dynamically rendered based on the state.
The daemon decides on the action name.
A single post endpoint handles all actions.
The UI maps the actions to icons.
Co-authored-by: Thomas Eizinger <thomas@coblox.tech>
The default path through the function would be to propagate every
error. However, we want to inspect whether it is one very specific
error.
Make this clear in the code structure by having a dedicated `if let`
for the special case but keep using `?` afterwards.
There is so much conditional logic on compiling for x64 and armv7
that we are better off with just defining two separate jobs without
any conditional logic.
As the profit margin is connected to the CFD feed, refresh the feed whenever
current price or the CFDs change.
Note: this is not exactly a clean revert, as I head to solve some conflicts when
rebasing.
This reverts commit 4b8237c9d6.
After last night's conversation, we decided to return to the first version of
the PR, which will come in a subsequent commit.
We can create a grid that has two columns:
- The first one is set to `max-content`.
- The second one is set to `auto`.
This will make the first columns as wide as the widest row and the
second column will take up the remainder of the space given by the
parent container.
When sorting the triangle appears next to the header text - that is expected and standard behaviour.
The span was always rendered (also with no sorting), and message up the alignment of the text.
Additionally add a text-align right for fixing the `State` header, that was somewhat floating around.
The Grid was restrictive and caused problems overlapping things.
We can achieve better layouting with flex components (for now mostly HStack and VStack flexes).
We can eventually also add space bounds to the flexes for more layourting (i.e. graph should take 70% on right...), but for now I kept it rather simple.
I experimented with Grids for the tiles where we group information (i.e. Buy, Order) but it did not look good, so I amd using flexes with fixed label width for better looks.