Skip to content

Commit 12498fe

Browse files
committed
Make inactive players icon grayscale
1 parent 2411713 commit 12498fe

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

artifacts/game-client/src/lib/adepts-scoreboard/Scoreboard.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,21 @@ function publicUrl(path: string): string {
2525
}
2626

2727
/** Стилизованный силуэт «адепта» + слой с официальной иконкой темы при наличии */
28-
function SlotPortrait({ accentHsl, slotIndex }: { accentHsl: string; slotIndex: number }) {
28+
function SlotPortrait({
29+
accentHsl,
30+
slotIndex,
31+
isInactiveTurn,
32+
}: {
33+
accentHsl: string;
34+
slotIndex: number;
35+
/** Ход задан и не у этого места — портрет в градациях серого */
36+
isInactiveTurn: boolean;
37+
}) {
2938
const [iconFailed, setIconFailed] = useState(false);
3039
const filterId = `adeptGlow-${slotIndex}`;
3140
const iconSrc = publicUrl("/lor-adeptov-icon.png");
41+
const inactiveImgFilter = "grayscale(1) brightness(0.92) contrast(1.06) opacity(0.9)";
42+
const activeImgFilter = `brightness(1.08) saturate(1.35) drop-shadow(0 0 12px ${hsl(accentHsl, 0.82)}) drop-shadow(0 0 32px ${hsl(accentHsl, 0.38)})`;
3243

3344
return (
3445
<div className="relative z-[1] flex min-h-[53px] flex-1 flex-col items-center justify-center px-1.5 py-1.5 md:min-h-[62px]">
@@ -38,6 +49,8 @@ function SlotPortrait({ accentHsl, slotIndex }: { accentHsl: string; slotIndex:
3849
height: "78%",
3950
background: `radial-gradient(ellipse at center 35%, ${hsl(accentHsl, 0.52)} 0%, ${hsl(accentHsl, 0.18)} 40%, transparent 70%)`,
4051
filter: "blur(14px)",
52+
opacity: isInactiveTurn ? 0.35 : 1,
53+
transition: "opacity 0.45s ease-out",
4154
}}
4255
/>
4356
{!iconFailed ? (
@@ -46,14 +59,19 @@ function SlotPortrait({ accentHsl, slotIndex }: { accentHsl: string; slotIndex:
4659
alt=""
4760
className="relative z-[1] max-h-[4.05rem] w-auto max-w-[72%] object-contain opacity-[0.98] md:max-h-[4.5rem]"
4861
style={{
49-
filter: `brightness(1.08) saturate(1.35) drop-shadow(0 0 12px ${hsl(accentHsl, 0.82)}) drop-shadow(0 0 32px ${hsl(accentHsl, 0.38)})`,
62+
filter: isInactiveTurn ? inactiveImgFilter : activeImgFilter,
63+
transition: "filter 0.45s ease-out",
5064
}}
5165
onError={() => setIconFailed(true)}
5266
/>
5367
) : (
5468
<svg
5569
viewBox="0 0 120 148"
5670
className="relative z-[1] h-[4.05rem] w-auto max-w-[88%] md:h-[4.5rem]"
71+
style={{
72+
filter: isInactiveTurn ? inactiveImgFilter : "none",
73+
transition: "filter 0.45s ease-out",
74+
}}
5775
aria-hidden
5876
>
5977
<defs>
@@ -280,6 +298,8 @@ export function Scoreboard({
280298
const theme = ADEPTS_SLOT_THEMES[index] ?? ADEPTS_SLOT_THEMES[0]!;
281299
const accent = theme.hsl;
282300
const isTurn = normalizedTurn === index;
301+
const isInactiveTurnPortrait =
302+
normalizedTurn !== undefined && !isTurn;
283303

284304
return (
285305
<div
@@ -336,7 +356,7 @@ export function Scoreboard({
336356
)}
337357
</div>
338358

339-
<SlotPortrait accentHsl={accent} slotIndex={index} />
359+
<SlotPortrait accentHsl={accent} slotIndex={index} isInactiveTurn={isInactiveTurnPortrait} />
340360

341361
<div
342362
className="relative z-[1] mt-auto flex flex-col items-center gap-1 border-t px-2 py-1.5 pb-2"

0 commit comments

Comments
 (0)