refactor(core): move app para src e padroniza estrutura

This commit is contained in:
Felipe Coutinho
2026-03-12 19:22:50 +00:00
parent d92e70f1b9
commit b0fbb1062a
567 changed files with 8981 additions and 5014 deletions

View File

@@ -0,0 +1,48 @@
import type {
Budget,
BudgetCategory,
} from "@/features/budgets/components/types";
import type {
GoalProgressCategory,
GoalProgressItem,
GoalProgressStatus,
} from "@/features/dashboard/goals-progress-queries";
import { formatPercentage } from "@/shared/utils/percentage";
export const clampGoalProgress = (value: number, min: number, max: number) =>
Math.min(max, Math.max(min, value));
export const formatGoalProgressPercentage = (value: number, withSign = false) =>
formatPercentage(value, {
maximumFractionDigits: 1,
signDisplay: withSign ? "always" : "auto",
});
export const getGoalProgressStatusColorClass = (status: GoalProgressStatus) =>
status === "exceeded" ? "text-destructive" : "";
export const mapGoalProgressCategoriesToBudgetCategories = (
categories: GoalProgressCategory[],
): BudgetCategory[] =>
categories.map((category) => ({
id: category.id,
name: category.name,
icon: category.icon,
}));
export const mapGoalProgressItemToBudget = (
item: GoalProgressItem,
): Budget => ({
id: item.id,
amount: item.budgetAmount,
spent: item.spentAmount,
period: item.period,
createdAt: item.createdAt,
category: item.categoryId
? {
id: item.categoryId,
name: item.categoryName,
icon: item.categoryIcon,
}
: null,
});