feat(belo): add analysis page with historical stats, chart, and date range picker
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { keepPreviousData, useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import {
|
||||
getQuotes, fetchQuotes, getQuoteHistory, getDailyMinMax, getDailyQuotes,
|
||||
getQuotes, fetchQuotes, getQuoteHistory, getDailyMinMax, getDailyQuotes, getHistoricalMinMax,
|
||||
getPeriodicExpenses, createPeriodicExpense as createPeriodicExpenseApi,
|
||||
updatePeriodicExpense as updatePeriodicExpenseApi,
|
||||
deletePeriodicExpense as deletePeriodicExpenseApi,
|
||||
@@ -23,6 +23,8 @@ export const quoteKeys = {
|
||||
["quotes", type, "minMax", startDate, endDate] as const,
|
||||
daily: (type: string, startDate: string, endDate: string) =>
|
||||
["quotes", type, "daily", startDate, endDate] as const,
|
||||
historicalMinMax: (type: string) =>
|
||||
["quotes", type, "historicalMinMax"] as const,
|
||||
};
|
||||
|
||||
export function useQuotes() {
|
||||
@@ -72,6 +74,14 @@ export function useDailyQuotes(type: string, startDate: string, endDate: string)
|
||||
});
|
||||
}
|
||||
|
||||
export function useHistoricalMinMax(type: string) {
|
||||
return useQuery({
|
||||
queryKey: quoteKeys.historicalMinMax(type),
|
||||
queryFn: () => getHistoricalMinMax(type),
|
||||
staleTime: 30_000,
|
||||
});
|
||||
}
|
||||
|
||||
// Expenses
|
||||
|
||||
export const expenseKeys = {
|
||||
|
||||
Reference in New Issue
Block a user