feat: enhance auction interactions and player statistics UI

This commit is contained in:
dahyeon committed 2026-11-11 20:06:22 +09:00
1 parent 6c582ba3cf
commit be4de61bb7
115 files changed
+13292 -2871

No files matched your search

@@ -0,0 +1,59 @@
import type { CSSProperties } from "react";
import { createPortal } from "react-dom";
import {
AUCTION_REACTIONS,
type ActiveAuctionReaction,
} from "../api/auction-reactions";
import "./auction-reactions.css";
function reactionStyle(id: string): CSSProperties {
let hash = 0;
for (const character of id)
hash = (hash * 31 + character.charCodeAt(0)) >>> 0;
return {
"--reaction-left": `${8 + (hash % 78)}%`,
"--reaction-drift": `${(hash % 65) - 32}px`,
"--reaction-tilt": `${(hash % 21) - 10}deg`,
} as CSSProperties;
}
export function AuctionReactionLayer({
reactions,
}: {
reactions: ActiveAuctionReaction[];
}) {
if (typeof document === "undefined") return null;
const latest = reactions.at(-1);
return createPortal(
<>
<div className="auction-reaction-layer" aria-hidden="true">
{reactions.map((reaction) => (
<div
key={reaction.id}
className="auction-floating-reaction"
data-reaction-id={reaction.id}
style={reactionStyle(reaction.id)}
>
<span className="auction-floating-emoji">
{AUCTION_REACTIONS[reaction.kind].emoji}
</span>
<span className="auction-floating-name">
{reaction.displayName}
</span>
</div>
))}
</div>
<span
className="sr-only"
role="status"
aria-live="polite"
aria-atomic="true"
>
{latest
? `${latest.displayName}님의 ${AUCTION_REACTIONS[latest.kind].label} 반응`
: ""}
</span>
</>,
document.body,
);
}