mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-03-10 04:51:47 +00:00
Adicionado aba de estabelecimentos e feita ajuste de interface. Detalhes adicionados no CHANGELOG.md
This commit is contained in:
committed by
Felipe Coutinho
parent
ffde55f589
commit
9b78f839bf
@@ -16,6 +16,7 @@ import { useIsMobile } from "@/hooks/use-mobile";
|
||||
import MoneyValues from "@/components/money-values";
|
||||
import { type ChartConfig, ChartContainer } from "@/components/ui/chart";
|
||||
import type { ExpensesByCategoryData } from "@/lib/dashboard/categories/expenses-by-category";
|
||||
import { getCategoryColor } from "@/lib/utils/category-colors";
|
||||
import { formatPeriodForUrl } from "@/lib/utils/period";
|
||||
import { WidgetEmptyState } from "../widget-empty-state";
|
||||
|
||||
@@ -51,24 +52,15 @@ export function ExpensesByCategoryWidgetWithChart({
|
||||
const isMobile = useIsMobile();
|
||||
const periodParam = formatPeriodForUrl(period);
|
||||
|
||||
// Configuração do chart com cores do CSS
|
||||
// Configuração do chart com as mesmas cores dos ícones das categorias (getCategoryColor)
|
||||
const chartConfig = useMemo(() => {
|
||||
const config: ChartConfig = {};
|
||||
const colors = [
|
||||
"var(--chart-1)",
|
||||
"var(--chart-2)",
|
||||
"var(--chart-3)",
|
||||
"var(--chart-4)",
|
||||
"var(--chart-5)",
|
||||
"var(--chart-1)",
|
||||
"var(--chart-2)",
|
||||
];
|
||||
|
||||
if (data.categories.length <= 7) {
|
||||
data.categories.forEach((category, index) => {
|
||||
config[category.categoryId] = {
|
||||
label: category.categoryName,
|
||||
color: colors[index % colors.length],
|
||||
color: getCategoryColor(index),
|
||||
};
|
||||
});
|
||||
} else {
|
||||
@@ -77,12 +69,12 @@ export function ExpensesByCategoryWidgetWithChart({
|
||||
top7.forEach((category, index) => {
|
||||
config[category.categoryId] = {
|
||||
label: category.categoryName,
|
||||
color: colors[index % colors.length],
|
||||
color: getCategoryColor(index),
|
||||
};
|
||||
});
|
||||
config.outros = {
|
||||
label: "Outros",
|
||||
color: "var(--chart-6)",
|
||||
color: getCategoryColor(7),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user