diff --git a/app/routes/profile.tsx b/app/routes/profile.tsx index e284299..2199f9d 100644 --- a/app/routes/profile.tsx +++ b/app/routes/profile.tsx @@ -1,7 +1,7 @@ import { useContext, useState, useEffect } from "react"; import { toast } from "react-hot-toast"; import { useLocalStorage } from "~/hooks/useLocalStorage"; -import { isValidPlayerStats } from "~/utils/utils"; +import { idToColor, isValidPlayerStats } from "~/utils/utils"; import { AuthContext } from "../components/AuthProvider/AuthProvider"; import { updateUsername, @@ -9,8 +9,11 @@ import { importStatsFromLocalStorage, } from "../firebase/utils"; +import { EnvelopeIcon } from "@heroicons/react/20/solid"; + export default function Profile() { const { user, updateUser } = useContext(AuthContext); + const [newUsername, setNewUsername] = useState(""); const [changing, setChanging] = useState(false); const [message, setMessage] = useState(""); @@ -115,67 +118,86 @@ export default function Profile() { } }; + const profile = user + ? { + name: user.username, + email: user.email, + avatar: `https://ui-avatars.com/api/?name=${ + user.username + }&size=20&background=${idToColor(user.uid)}`, // replace with user avatar link if any + backgroundImage: "https://via.placeholder.com/1920x1080", // replace with a user background link if any + } + : null; + if (user) { return ( -
- If you've been playing Chessguessr, your stats are saved in - your browser. By importing them, you can keep them safe on - your account and access them on any device. Please note, stats - can be imported only once. -
- -+ If you've been playing Chessguessr, your stats are saved in your + browser. By importing them, you can keep them safe on your + account and access them on any device. Please note, stats can be + imported only once. +
+ +