diff --git a/src/components/Player.js b/src/components/Player.js index 1806469c..21bb123c 100644 --- a/src/components/Player.js +++ b/src/components/Player.js @@ -7,6 +7,9 @@ import { useStorageState } from "react-use-storage-state"; import { Auth } from "aws-amplify"; import { API_ENDPOINT_AUTH } from "../config"; import { Helmet } from "react-helmet-async"; +import { ReactMarkdown } from "react-markdown/lib/react-markdown"; +import remarkGfm from "remark-gfm"; +import rehypeRaw from "rehype-raw"; import Spinner from "./Spinner"; import Flag from "./Flag"; import ActivityMarker from "./ActivityMarker"; @@ -88,6 +91,7 @@ function Player() { if (allUsers !== null) { const rec = allUsers.find((u) => u.id === userid); if (rec !== undefined && rec !== null) { + console.log(rec); userSetter(rec); } else { userSetter(null); @@ -193,7 +197,27 @@ function Player() { )} + {user.bggid === undefined ? null : ( + + + BGG profile + + + )} + {user.about === undefined ? null : ( + + {user.about} + + )}
{ - async function fetchData() { - var url = new URL(API_ENDPOINT_OPEN); - url.searchParams.append("query", "user_names"); - const res = await fetch(url); - const result = await res.json(); - console.log("user_names: ", result); - usersSetter(result.map((u) => u.name)); - } - if (show && users.length === 0) fetchData(); - }, [show, users]); - const handleNameChangeClick = () => { nameSetter(globalMe.name); changingNameSetter(true); @@ -205,6 +204,21 @@ function UserSettingsModal(props) { }); }; + const saveBGGid = () => { + handleSettingChangeSubmit("bggid", bggid); + globalMeSetter((val) => ({ ...val, bggid })); + usersSetter((val) => + val.map((u) => (u.id === globalMe?.id ? { ...u, bggid } : u)) + ); + }; + const saveAbout = () => { + handleSettingChangeSubmit("about", aboutMe); + globalMeSetter((val) => ({ ...val, about: aboutMe })); + usersSetter((val) => + val.map((u) => (u.id === globalMe?.id ? { ...u, about: aboutMe } : u)) + ); + }; + const handleEMailChangeClick = () => { emailSetter(user.signInUserSession.idToken.payload.email); changingEMailSetter(true); @@ -782,6 +796,85 @@ function UserSettingsModal(props) {
+ {/********************* BGG ID *********************/} + {globalMe === null ? null : ( +
+ +
+ bggidSetter(e.target.value)} + /> +

+ + Test link + +

+
+ {globalMe === undefined || globalMe.bggid === bggid ? null : ( +
+ +
+ )} +
+ )} + {/********************* About Me *********************/} + {globalMe === null ? null : ( +
+ +
+ + + {aboutMe} + +
+ {globalMe === undefined || globalMe.about === aboutMe ? null : ( +
+ +
+ )} +
+ )} + {/********************* notifications *********************/}
diff --git a/src/pages/Skeleton.js b/src/pages/Skeleton.js index 58dd2d3c..7e6801fc 100644 --- a/src/pages/Skeleton.js +++ b/src/pages/Skeleton.js @@ -158,6 +158,7 @@ function Bones(props) { const res = await fetch(url); const result = await res.json(); usersSetter(result); + console.log(result); } catch (error) { usersSetter(null); }