Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
eddf05e
feat(dateutil): add shared date formatting and weekday mapping
CsJsss Jun 12, 2026
5651ba2
refactor(model): add inventory status constants
CsJsss Jun 12, 2026
f5a9e44
feat(orm): add FindDailySells using two-query pattern
CsJsss Jun 12, 2026
6dd6131
feat(orm): add FindDailyBuys using Preload pattern
CsJsss Jun 12, 2026
6c17322
feat(trade): add ListDailySells using dateutil for group-by-date
CsJsss Jun 12, 2026
e54a791
feat(inventory): extract resolvePriceMap, add ListDailyBuys
CsJsss Jun 12, 2026
640b657
feat(app): expose GetDailySells and GetDailyBuys
CsJsss Jun 12, 2026
f72f170
feat(frontend): add shared hooks for daily trading views
CsJsss Jun 12, 2026
f6f980c
feat(frontend): add daily sell tab to CompletedTradesPage
CsJsss Jun 12, 2026
e4c7c7e
feat(frontend): add daily buy tab to InventoryPage
CsJsss Jun 12, 2026
39bc6f4
feat: add server-side pagination to daily sell/buy APIs
CsJsss Jun 12, 2026
79cc069
feat(frontend): add pagination, date format, profit display to daily …
CsJsss Jun 12, 2026
0c054ae
refactor(frontend): remove month selector from daily sell view
CsJsss Jun 12, 2026
401fbf4
feat(frontend): add daily profit rate to buy collapsed row
CsJsss Jun 12, 2026
73fcb6c
refactor(frontend): flatten daily card layout, add year, use platform…
CsJsss Jun 12, 2026
ab78b95
refactor(frontend): widen date column for better readability
CsJsss Jun 12, 2026
624c7d1
refactor(frontend): widen date column to 200px
CsJsss Jun 12, 2026
5c1ff4b
refactor(frontend): widen date column to 240px
CsJsss Jun 12, 2026
24e49f8
feat(frontend): add page jump input to daily pagination
CsJsss Jun 12, 2026
bb97251
feat(frontend): show monthly aggregates in buy separator row
CsJsss Jun 12, 2026
b15d8cc
fix(frontend): remove unnecessary type assertion in monthly aggregate
CsJsss Jun 12, 2026
20a87ca
fix(frontend): suppress useMemo deps lint warning for monthlyGroups
CsJsss Jun 12, 2026
264c7ac
feat(frontend): expand all month groups by default
CsJsss Jun 12, 2026
2a8b0e4
feat(frontend): add profit rate to daily sell day card
CsJsss Jun 12, 2026
5160956
refactor(frontend): collapse month groups by default
CsJsss Jun 12, 2026
89a0e33
fix(frontend): remove dead expandAll code, hoist PAGE_SIZE to module …
CsJsss Jun 12, 2026
ea67713
refactor(frontend): remove redundant day summary rows from daily cards
CsJsss Jun 12, 2026
1588435
feat: add daily buy and sell pages
CsJsss Jun 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ func (a *App) GetItemDetail(accountID uint, assetID string) (*inventory.ItemDeta
return a.svc.Inventory().GetItemDetail(accountID, assetID)
}

func (a *App) GetDailyBuys(accountID uint, page, pageSize int) (*inventory.DailyBuyPaginated, error) {
return a.svc.Inventory().ListDailyBuys(accountID, page, pageSize)
}

func (a *App) GetCompletedTrades(accountID uint, page, pageSize int, sortBy, sortDir string) (*trade.PaginatedGroups, error) {
return a.svc.Trade().ListCompletedTradeGroups(accountID, page, pageSize, sortBy, sortDir)
}
Expand All @@ -132,6 +136,10 @@ func (a *App) GetUnmatchedSells(accountID uint) ([]model.TradeRecord, error) {
return a.svc.Trade().ListUnmatchedSells(accountID)
}

func (a *App) GetDailySells(accountID uint, year, month, page, pageSize int) (*trade.DailySellPaginated, error) {
return a.svc.Trade().ListDailySells(accountID, year, month, page, pageSize)
}

func (a *App) GetPnlSummary(accountID uint) (*pnl.PnlSummaryView, error) {
return a.svc.Pnl().GetSummary(accountID)
}
Expand Down
24 changes: 24 additions & 0 deletions frontend/src/hooks/useDailyBuys.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { useQuery } from '@tanstack/react-query';
import { GetDailyBuys } from '../lib/wails';
import { useAccounts } from './useAccounts';

const STALE_TIME_MS = 2 * 60 * 1000;
const DEFAULT_PAGE_SIZE = 30;

export function useDailyBuys(
selectedAccountId: number | null,
page: number,
pageSize: number = DEFAULT_PAGE_SIZE,
) {
const { data: accounts = [] } = useAccounts();

return useQuery({
queryKey: ['dailyBuys', selectedAccountId ?? 0, page, pageSize],
queryFn: () => {
const accountId = selectedAccountId ?? 0;
return GetDailyBuys(accountId, page, pageSize);
},
staleTime: STALE_TIME_MS,
enabled: selectedAccountId !== null || accounts.length > 0,
});
}
26 changes: 26 additions & 0 deletions frontend/src/hooks/useDailySells.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useQuery } from '@tanstack/react-query';
import { GetDailySells } from '../lib/wails';
import { useAccounts } from './useAccounts';

const STALE_TIME_MS = 2 * 60 * 1000;
const DEFAULT_PAGE_SIZE = 30;

export function useDailySells(
selectedAccountId: number | null,
year: number,
month: number,
page: number,
pageSize: number = DEFAULT_PAGE_SIZE,
) {
const { data: accounts = [] } = useAccounts();

return useQuery({
queryKey: ['dailySells', selectedAccountId ?? 0, year, month, page, pageSize],
queryFn: () => {
const accountId = selectedAccountId ?? 0;
return GetDailySells(accountId, year, month, page, pageSize);
},
staleTime: STALE_TIME_MS,
enabled: selectedAccountId !== null || accounts.length > 0,
});
}
25 changes: 25 additions & 0 deletions frontend/src/hooks/useExpandableSet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { useState, useCallback } from 'react';

/**
* Shared hook for expand/collapse state using a Set of string keys.
* Used by collapsible day cards in daily sell/buy views.
*/
export function useExpandableSet() {
const [expanded, setExpanded] = useState<Set<string>>(new Set());

const toggle = useCallback((key: string) => {
setExpanded((prev) => {
const next = new Set(prev);
if (next.has(key)) {
next.delete(key);
} else {
next.add(key);
}
return next;
});
}, []);

const isExpanded = useCallback((key: string) => expanded.has(key), [expanded]);

return { expanded, isExpanded, toggle };
}
4 changes: 4 additions & 0 deletions frontend/src/lib/wails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
GetCompletedTrades,
GetCompletedTradesSummary,
GetUnmatchedSells,
GetDailySells,
GetDailyBuys,
GetPnlSummary,
GetMonthlyBreakdown,
GetDashboardSummary,
Expand All @@ -34,6 +36,8 @@ export {
GetCompletedTrades,
GetCompletedTradesSummary,
GetUnmatchedSells,
GetDailySells,
GetDailyBuys,
GetPnlSummary,
GetMonthlyBreakdown,
GetDashboardSummary,
Expand Down
Loading
Loading