feat(33-06): add market prices section to catalog detail page
- Add useGlobalItemPrices and useGlobalItemCommunityStats hooks - Add MarketPricesSection component with user's market MSRP prominent - Show community price stats per market with median and report count - Collapsible "Other Markets" section (collapsed by default) - Import useCurrency, useExchangeRates, formatPrice for market display Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -67,6 +67,43 @@ export function useLinkItem() {
|
||||
});
|
||||
}
|
||||
|
||||
interface MarketPriceData {
|
||||
id: number;
|
||||
globalItemId: number;
|
||||
market: string;
|
||||
currency: string;
|
||||
priceCents: number;
|
||||
source: string | null;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
interface CommunityPriceStat {
|
||||
market: string;
|
||||
currency: string;
|
||||
medianPrice: number;
|
||||
reportCount: number;
|
||||
}
|
||||
|
||||
export function useGlobalItemPrices(globalItemId: number) {
|
||||
return useQuery({
|
||||
queryKey: ["global-item-prices", globalItemId],
|
||||
queryFn: () =>
|
||||
apiGet<{ marketPrices: MarketPriceData[] }>(
|
||||
`/api/market-prices/global-items/${globalItemId}/prices`,
|
||||
),
|
||||
enabled: globalItemId > 0,
|
||||
});
|
||||
}
|
||||
|
||||
export function useGlobalItemCommunityStats(globalItemId: number) {
|
||||
return useQuery({
|
||||
queryKey: ["global-item-community-stats", globalItemId],
|
||||
queryFn: () =>
|
||||
apiGet<CommunityPriceStat[]>(`/api/community-prices/${globalItemId}`),
|
||||
enabled: globalItemId > 0,
|
||||
});
|
||||
}
|
||||
|
||||
export function useUnlinkItem() {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
|
||||
Reference in New Issue
Block a user