4.14.0: Добавлен дневной прирост в карточках
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m25s

This commit is contained in:
poignatov
2026-02-04 15:04:58 +03:00
parent 8023319ee4
commit e66a3cecce
4 changed files with 135 additions and 5 deletions

View File

@@ -92,7 +92,7 @@ function CircularProgressBar({ progress, size = 120, strokeWidth = 8, showCheckm
// Компонент карточки проекта с круглым прогрессбаром
function ProjectCard({ project, projectColor, onProjectClick }) {
const { project_name, total_score, min_goal_score, max_goal_score, priority } = project
const { project_name, total_score, min_goal_score, max_goal_score, priority, today_change } = project
// Вычисляем прогресс по оригинальной логике из ProjectProgressBar
const getGoalProgress = () => {
@@ -155,6 +155,17 @@ function ProjectCard({ project, projectColor, onProjectClick }) {
return '0+'
}
// Форматируем сегодняшний прирост
const formatTodayChange = (value) => {
if (value === null || value === undefined) return '0'
const rounded = Math.round(value * 10) / 10
if (rounded === 0) return '0'
if (Number.isInteger(rounded)) {
return rounded > 0 ? `+${rounded}` : `${rounded}`
}
return rounded > 0 ? `+${rounded.toFixed(1)}` : `${rounded.toFixed(1)}`
}
const handleClick = () => {
if (onProjectClick) {
onProjectClick(project_name)
@@ -173,8 +184,15 @@ function ProjectCard({ project, projectColor, onProjectClick }) {
<div className="text-base font-semibold text-gray-600 leading-normal truncate mb-0.5">
{project_name}
</div>
<div className="text-3xl font-bold text-black leading-normal mb-0.5">
{total_score?.toFixed(1) || '0.0'}
<div className="flex items-center gap-2 mb-0.5">
<div className="text-3xl font-bold text-black leading-normal">
{total_score?.toFixed(1) || '0.0'}
</div>
{today_change !== null && today_change !== undefined && today_change !== 0 && (
<div className="text-base font-medium text-gray-400 leading-normal">
({formatTodayChange(today_change)})
</div>
)}
</div>
<div className="text-xs text-gray-500 leading-normal">
Целевая зона: {getTargetZone()}