5.13.0: Карточки проектов и желаний на экране недели
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m10s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m10s
This commit is contained in:
@@ -104,6 +104,17 @@ function MiniWishCard({ wish, onClick }) {
|
||||
}
|
||||
}
|
||||
|
||||
const cond = wish.first_locked_condition
|
||||
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 showUnlockPoints = remaining > 0
|
||||
|
||||
// Auto-size: уменьшаем шрифт при большом количестве цифр, чтобы текст влезал
|
||||
const digits = String(Math.round(remaining)).length
|
||||
const fontSizePx = digits <= 1 ? 22 : digits === 2 ? 19 : digits === 3 ? 16 : 14
|
||||
|
||||
return (
|
||||
<div className="mini-wish-card" onClick={handleClick}>
|
||||
<div className="mini-wish-image">
|
||||
@@ -112,7 +123,16 @@ function MiniWishCard({ wish, onClick }) {
|
||||
) : (
|
||||
<div className="mini-wish-placeholder">🎁</div>
|
||||
)}
|
||||
<div className="mini-wish-overlay"></div>
|
||||
<div className="mini-wish-overlay" aria-hidden="true" />
|
||||
{showUnlockPoints && (
|
||||
<div
|
||||
className="mini-wish-unlock-points"
|
||||
style={{ fontSize: `${fontSizePx}px` }}
|
||||
aria-hidden="true"
|
||||
>
|
||||
{Math.round(remaining)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -206,7 +226,7 @@ function ProjectCard({ project, projectColor, onProjectClick, wishes = [], onWis
|
||||
<div className="project-card-wrapper">
|
||||
<div
|
||||
onClick={handleClick}
|
||||
className="bg-white rounded-3xl py-3 px-4 transition-all duration-300 cursor-pointer"
|
||||
className={`project-card-inner bg-white py-3 px-4 transition-all duration-300 cursor-pointer ${hasWishes ? 'rounded-t-3xl project-card-inner-with-wishes' : 'rounded-3xl'}`}
|
||||
>
|
||||
{/* Верхняя часть с названием и прогрессом */}
|
||||
<div className="flex items-center justify-between">
|
||||
@@ -245,16 +265,18 @@ function ProjectCard({ project, projectColor, onProjectClick, wishes = [], onWis
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Горизонтальный список желаний */}
|
||||
{/* Горизонтальный список желаний в отдельном белом блоке */}
|
||||
{hasWishes && (
|
||||
<div className="project-wishes-scroll">
|
||||
{wishes.map((wish) => (
|
||||
<MiniWishCard
|
||||
key={wish.id}
|
||||
wish={wish}
|
||||
onClick={onWishClick}
|
||||
/>
|
||||
))}
|
||||
<div className="project-wishes-block">
|
||||
<div className="project-wishes-scroll">
|
||||
{wishes.map((wish) => (
|
||||
<MiniWishCard
|
||||
key={wish.id}
|
||||
wish={wish}
|
||||
onClick={onWishClick}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user