chg: usr: make fancy og tags - and create a special one for battle sharing #4
This commit is contained in:
@@ -134,8 +134,8 @@ function StatRow({ icon, label, value, valueColor }) {
|
||||
}
|
||||
|
||||
export default function BattleDialog({ games }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [game, setGame] = useState(null);
|
||||
const [open, setOpen] = useState(false);
|
||||
const [game, setGame] = useState(null);
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -156,18 +156,18 @@ export default function BattleDialog({ games }) {
|
||||
return <ThemeProvider theme={darkTheme}><Dialog open={false} sx={DIALOG_SX} /></ThemeProvider>;
|
||||
}
|
||||
|
||||
const meta = RESULT_META[game.result] ?? RESULT_META.draw;
|
||||
const resign = game.resign;
|
||||
const meta = RESULT_META[game.result] ?? RESULT_META.draw;
|
||||
const resign = game.resign;
|
||||
const endReason = resign
|
||||
? `${resign.charAt(0).toUpperCase() + resign.slice(1)} resigned`
|
||||
: 'Points';
|
||||
const shareUrl = `${window.location.origin}/battle/${game.id}`;
|
||||
? `${resign.charAt(0).toUpperCase() + resign.slice(1)} resigned`
|
||||
: 'Points';
|
||||
const shareUrl = `${window.location.origin}/battle/${game.uuid}`;
|
||||
|
||||
const handleShare = () => {
|
||||
navigator.clipboard.writeText(shareUrl).then(() => {
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2200);
|
||||
});
|
||||
navigator.clipboard.writeText(shareUrl).then(() => {
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2200);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user