import { CSSProperties, ReactNode, useState } from 'react'; import axios from 'axios'; import { userInfo, gameInfo } from "../api/api"; import { AccountAvatar } from "./account"; import { Bubble, Vierkant, IconLabelButton } from './ui'; import DoneIcon from '@material-ui/icons/Done'; import CloseIcon from '@material-ui/icons/Close'; export function NotificationsArea(props: { visible?: boolean; friendRequests?: Array; gameInvites?: Array; rerender: () => void; }) { var messages = ( (props.friendRequests ? props.friendRequests.length : 0) + (props.gameInvites ? props.gameInvites.length : 0) ) return props.visible &&

Meldingen

{ props.gameInvites?.map(game => ) } { props.friendRequests?.map(user => ) } { messages == 0 &&

Geen meldingen

}
} var FriendRequestButtonStyle: CSSProperties = { borderRadius: 6, display: "inline-block", marginLeft: 0, textAlign: "center" }; function Acceptable(props: { children?: ReactNode; onAccept?: () => void; onDeny?: () => void; }) { return
{props.children}
} text="Accepteren"/> } text="Verwijderen"/>
} function FriendRequest(props: { user: userInfo; hide: () => void; }) { var [ gone, setGone ] = useState(false); var hide = () => { setGone(true); props.hide(); } return !gone && { axios.request({ method: "post", url: "/api/social/accept", headers: {"content-type": "application/json"}, data: { "id": props.user?.id } }) .then(hide); }} onDeny={() => { axios.request({ method: "post", url: "/api/social/remove", headers: {"content-type": "application/json"}, data: { "id": props.user?.id } }) .then(hide); }}>
Vriendschapsverzoek {props.user.username}
} function GameInvite(props: { game: gameInfo; hide: () => void; }) { return
Partijuitnodiging

{props.game.opponent?.username} wil een potje 4 op een rij spelen!

}