Add host and player identification in GamePickerCard
This update introduces visual indicators to identify the host and the current user in the GamePickerCard component. Hosts are marked with a star, and the current user is labeled as "(du)". The design of the member pills has also been enhanced for better clarity and aesthetics.
This commit is contained in:
@@ -515,6 +515,8 @@ export default function App() {
|
|||||||
setGameId={setGameId}
|
setGameId={setGameId}
|
||||||
onOpenHelp={() => setHelpOpen(true)}
|
onOpenHelp={() => setHelpOpen(true)}
|
||||||
members={members}
|
members={members}
|
||||||
|
me={me}
|
||||||
|
hostUserId={gameMeta?.host_user_id || ""}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Sieger Badge: zwischen Spiel und Verdächtigte Person */}
|
{/* Sieger Badge: zwischen Spiel und Verdächtigte Person */}
|
||||||
|
|||||||
@@ -2,7 +2,46 @@ import React from "react";
|
|||||||
import { styles } from "../styles/styles";
|
import { styles } from "../styles/styles";
|
||||||
import { stylesTokens } from "../styles/theme";
|
import { stylesTokens } from "../styles/theme";
|
||||||
|
|
||||||
export default function GamePickerCard({ games, gameId, setGameId, onOpenHelp, members = [] }) {
|
export default function GamePickerCard({
|
||||||
|
games,
|
||||||
|
gameId,
|
||||||
|
setGameId,
|
||||||
|
onOpenHelp,
|
||||||
|
members = [],
|
||||||
|
me,
|
||||||
|
hostUserId,
|
||||||
|
}) {
|
||||||
|
const cur = games.find((x) => x.id === gameId);
|
||||||
|
|
||||||
|
const renderMemberName = (m) => {
|
||||||
|
const base = ((m.display_name || "").trim() || (m.email || "").trim() || "—");
|
||||||
|
const isMe = !!(me?.id && String(me.id) === String(m.id));
|
||||||
|
const isHost = !!(hostUserId && String(hostUserId) === String(m.id));
|
||||||
|
|
||||||
|
const suffix = `${isHost ? " ⭐" : ""}${isMe ? " (du)" : ""}`;
|
||||||
|
return base + suffix;
|
||||||
|
};
|
||||||
|
|
||||||
|
const pillStyle = (isHost, isMe) => ({
|
||||||
|
padding: "7px 10px",
|
||||||
|
borderRadius: 999,
|
||||||
|
border: `1px solid ${
|
||||||
|
isHost ? "rgba(233,216,166,0.35)" : "rgba(233,216,166,0.16)"
|
||||||
|
}`,
|
||||||
|
background: isHost
|
||||||
|
? "linear-gradient(180deg, rgba(233,216,166,0.14), rgba(10,10,12,0.35))"
|
||||||
|
: "rgba(10,10,12,0.30)",
|
||||||
|
color: stylesTokens.textMain,
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: 950,
|
||||||
|
boxShadow: isHost ? "0 8px 18px rgba(0,0,0,0.25)" : "none",
|
||||||
|
opacity: isMe ? 1 : 0.95,
|
||||||
|
display: "inline-flex",
|
||||||
|
alignItems: "center",
|
||||||
|
gap: 6,
|
||||||
|
whiteSpace: "nowrap",
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ marginTop: 14 }}>
|
<div style={{ marginTop: 14 }}>
|
||||||
<div style={styles.card}>
|
<div style={styles.card}>
|
||||||
@@ -26,47 +65,82 @@ export default function GamePickerCard({ games, gameId, setGameId, onOpenHelp, m
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* kleine Code Zeile unter dem Picker (optional nice) */}
|
{/* Code Zeile */}
|
||||||
{(() => {
|
{cur?.code && (
|
||||||
const cur = games.find((x) => x.id === gameId);
|
<div
|
||||||
if (!cur?.code) return null;
|
style={{
|
||||||
return (
|
padding: "0 12px 10px",
|
||||||
<div style={{ padding: "0 12px 12px", fontSize: 12, color: stylesTokens.textDim, opacity: 0.9 }}>
|
fontSize: 12,
|
||||||
|
color: stylesTokens.textDim,
|
||||||
|
opacity: 0.92,
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
gap: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div>
|
||||||
Code: <b style={{ color: stylesTokens.textGold }}>{cur.code}</b>
|
Code: <b style={{ color: stylesTokens.textGold }}>{cur.code}</b>
|
||||||
</div>
|
</div>
|
||||||
);
|
|
||||||
})()}
|
|
||||||
|
|
||||||
{members?.length > 0 && (
|
{/* Mini hint rechts (optional) */}
|
||||||
<div style={{ marginTop: 8 }}>
|
<div style={{ fontSize: 11, opacity: 0.75 }}>
|
||||||
<div style={{ fontSize: 12, opacity: 0.8, color: stylesTokens.textDim }}>
|
teilen
|
||||||
Spieler ({members.length})
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style={{ marginTop: 6, display: "flex", flexWrap: "wrap", gap: 8 }}>
|
|
||||||
{members.map((m) => {
|
|
||||||
const name = ((m.display_name || "").trim() || (m.email || "").trim() || "—");
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
key={m.id}
|
|
||||||
style={{
|
|
||||||
padding: "6px 10px",
|
|
||||||
borderRadius: 999,
|
|
||||||
border: "1px solid rgba(233,216,166,0.18)",
|
|
||||||
background: "rgba(10,10,12,0.35)",
|
|
||||||
color: stylesTokens.textMain,
|
|
||||||
fontSize: 13,
|
|
||||||
fontWeight: 900,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{name}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* Spieler */}
|
||||||
|
{members?.length > 0 && (
|
||||||
|
<div style={{ padding: "0 12px 12px" }}>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
fontSize: 12,
|
||||||
|
opacity: 0.85,
|
||||||
|
color: stylesTokens.textDim,
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
gap: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div>Spieler</div>
|
||||||
|
<div style={{ fontWeight: 900, color: stylesTokens.textGold }}>
|
||||||
|
{members.length}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
marginTop: 8,
|
||||||
|
padding: 10,
|
||||||
|
borderRadius: 16,
|
||||||
|
border: `1px solid rgba(233,216,166,0.10)`,
|
||||||
|
background: "rgba(10,10,12,0.18)",
|
||||||
|
display: "flex",
|
||||||
|
flexWrap: "wrap",
|
||||||
|
gap: 8,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{members.map((m) => {
|
||||||
|
const isMe = !!(me?.id && String(me.id) === String(m.id));
|
||||||
|
const isHost = !!(hostUserId && String(hostUserId) === String(m.id));
|
||||||
|
const label = renderMemberName(m);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div key={m.id} style={pillStyle(isHost, isMe)} title={label}>
|
||||||
|
{isHost && <span style={{ color: stylesTokens.textGold }}>⭐</span>}
|
||||||
|
<span>{label.replace(" ⭐", "")}</span>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style={{ marginTop: 6, fontSize: 11, opacity: 0.7, color: stylesTokens.textDim }}>
|
||||||
|
⭐ = Host • (du) = du
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user