@@ -96,7 +96,7 @@ function CircularProgressBar({ progress, size = 120, strokeWidth = 8, showCheckm
}
// Компонент мини-карточки желания для отображения внутри карточки проекта
function MiniWishCard ( { wish , onClick } ) {
function MiniWishCard ( { wish , onClick , pendingScoresByProject = { } } ) {
const handleClick = ( e ) => {
e . stopPropagation ( )
if ( onClick ) {
@@ -108,7 +108,9 @@ function MiniWishCard({ wish, onClick }) {
const isPointsCondition = cond ? . type === 'project_points'
const required = cond ? . required _points ? ? 0
const current = cond ? . current _points ? ? 0
const remaining = isPointsCondition ? Math . max ( 0 , required - current ) : 0
const projectId = cond ? . project _id
const pending = ( projectId != null && pendingScoresByProject [ projectId ] != null ) ? Number ( pendingScoresByProject [ projectId ] ) : 0
const remaining = isPointsCondition ? ( required - current - pending ) : 0
const showUnlockPoints = remaining > 0
// Auto-size: уменьшаем шрифт при большом количестве цифр, чтобы текст влезал
@@ -139,7 +141,7 @@ function MiniWishCard({ wish, onClick }) {
}
// Компонент карточки проекта с круглым прогрессбаром
function ProjectCard ( { project , projectColor , onProjectClick , wishes = [ ] , onWishClick } ) {
function ProjectCard ( { project , projectColor , onProjectClick , wishes = [ ] , onWishClick , pendingScoresByProject = { } } ) {
const { project _name , total _score , min _goal _score , max _goal _score , priority , today _change } = project
// Вычисляем прогресс по оригинальной логике из ProjectProgressBar
@@ -274,6 +276,7 @@ function ProjectCard({ project, projectColor, onProjectClick, wishes = [], onWis
key = { wish . id }
wish = { wish }
onClick = { onWishClick }
pendingScoresByProject = { pendingScoresByProject || { } }
/ >
) ) }
< / div >
@@ -284,7 +287,7 @@ function ProjectCard({ project, projectColor, onProjectClick, wishes = [], onWis
}
// Компонент группы проектов по приоритету
function PriorityGroup ( { title , subtitle , projects , allProjects , onProjectClick , getWishesForProject , onWishClick } ) {
function PriorityGroup ( { title , subtitle , projects , allProjects , onProjectClick , getWishesForProject , onWishClick , pendingScoresByProject = { } } ) {
if ( projects . length === 0 ) return null
return (
@@ -312,6 +315,7 @@ function PriorityGroup({ title, subtitle, projects, allProjects, onProjectClick,
onProjectClick = { onProjectClick }
wishes = { projectWishes }
onWishClick = { onWishClick }
pendingScoresByProject = { pendingScoresByProject }
/ >
)
} ) }
@@ -577,8 +581,9 @@ function CurrentWeek({ onProjectClick, data, loading, error, onRetry, allProject
const [ toastMessage , setToastMessage ] = useState ( null )
const [ selectedWishlistId , setSelectedWishlistId ] = useState ( null )
// Желания приходят вместе с данными проектов
// Желания и pending-баллы по проектам приходят вместе с данными
const wishes = data ? . wishes || [ ]
const pendingScoresByProject = data ? . pending _scores _by _project && typeof data . pending _scores _by _project === 'object' ? data . pending _scores _by _project : { }
// Функция для получения числового значения срока из текста
const getWeeksValue = ( weeksText ) => {
@@ -778,6 +783,7 @@ function CurrentWeek({ onProjectClick, data, loading, error, onRetry, allProject
onProjectClick = { onProjectClick }
getWishesForProject = { getWishesForProject }
onWishClick = { handleWishClick }
pendingScoresByProject = { pendingScoresByProject }
/ >
< PriorityGroup
@@ -788,6 +794,7 @@ function CurrentWeek({ onProjectClick, data, loading, error, onRetry, allProject
onProjectClick = { onProjectClick }
getWishesForProject = { getWishesForProject }
onWishClick = { handleWishClick }
pendingScoresByProject = { pendingScoresByProject }
/ >
< PriorityGroup
@@ -798,6 +805,7 @@ function CurrentWeek({ onProjectClick, data, loading, error, onRetry, allProject
onProjectClick = { onProjectClick }
getWishesForProject = { getWishesForProject }
onWishClick = { handleWishClick }
pendingScoresByProject = { pendingScoresByProject }
/ >
< / div >