Skip to content

Commit

Permalink
docs: add ui images
Browse files Browse the repository at this point in the history
  • Loading branch information
rodionlim committed Jan 27, 2025
1 parent cb4dee0 commit e654c33
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,15 @@ portfolio-manager/
└── README.md
```

## Sample Curl Commands
## UI

### Blotter Table

User can add, delete and update trades via the blotter component in the user interface.

![Blotter Table](docs/Blotter.png)

## Backend API - Sample Curl Commands

All API calls are documented (OAS) under `http://localhost:8080/swagger/index.html`

Expand Down
Binary file added docs/Blotter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 14 additions & 4 deletions web/ui/src/components/Blotter/BlotterTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Box, Button } from "@mantine/core";
import {
MantineReactTable,
MRT_ColumnDef,
MRT_TableInstance,
useMantineReactTable,
} from "mantine-react-table";
import { useQuery } from "@tanstack/react-query";
Expand Down Expand Up @@ -67,7 +68,7 @@ const BlotterTable: React.FC = () => {
<Button
color="red"
disabled={!table.getIsSomeRowsSelected()}
onClick={handleDeleteTrades}
onClick={handleDeleteTrades(table)}
variant="filled"
>
Delete Selected Trades
Expand All @@ -77,13 +78,22 @@ const BlotterTable: React.FC = () => {
});

const handleAddTrade = () => {
// TODO: Route to add trade form
alert("Add Trade");
refetch();
};

const handleDeleteTrades = () => {
alert("Delete Selected Trades");
refetch();
const handleDeleteTrades = (
table: MRT_TableInstance<Trade>
): (() => void) => {
return () => {
const deletionTrades = table
.getSelectedRowModel()
.rows.map((trade) => trade.original.TradeID);
// TODO: call backend api to delete trades with mutation
alert("Delete Selected Trades " + deletionTrades);
refetch();
};
};

if (isLoading) return <div>Loading...</div>;
Expand Down

0 comments on commit e654c33

Please sign in to comment.