profile page improvements
This commit is contained in:
+42
-28
@@ -9,6 +9,7 @@ import Image from "next/image";
|
|||||||
export default function Profile() {
|
export default function Profile() {
|
||||||
const { currUser, logOut } = useAuth();
|
const { currUser, logOut } = useAuth();
|
||||||
const [user, setUser] = useState<User | null>(null);
|
const [user, setUser] = useState<User | null>(null);
|
||||||
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const userService: UserService = new UserService();
|
const userService: UserService = new UserService();
|
||||||
@@ -55,6 +56,8 @@ export default function Profile() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
async function handleSubmit(e) {
|
async function handleSubmit(e) {
|
||||||
|
setLoading(true);
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (!firstName) {
|
if (!firstName) {
|
||||||
@@ -91,6 +94,8 @@ export default function Profile() {
|
|||||||
"Something went wrong in saving your information. Please try again."
|
"Something went wrong in saving your information. Please try again."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const [firstName, setFirstName] = useState<string>(
|
const [firstName, setFirstName] = useState<string>(
|
||||||
@@ -114,7 +119,7 @@ export default function Profile() {
|
|||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
<span className="flex flex-col items-start">
|
<span className="flex flex-col items-start">
|
||||||
<span className="text-md">Avatar</span>
|
<span className="text-md">Avatar*</span>
|
||||||
<span className="text-gray-300 text-xs">
|
<span className="text-gray-300 text-xs">
|
||||||
Please change your google image to change this.
|
Please change your google image to change this.
|
||||||
</span>
|
</span>
|
||||||
@@ -126,7 +131,7 @@ export default function Profile() {
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span className="flex flex-col items-start">
|
<span className="flex flex-col items-start">
|
||||||
<span className="text-md">Email</span>
|
<span className="text-md">Email*</span>
|
||||||
<span className="text-gray-300 text-xs mb-2">
|
<span className="text-gray-300 text-xs mb-2">
|
||||||
This is set from your Google account and cannot be changed.
|
This is set from your Google account and cannot be changed.
|
||||||
</span>
|
</span>
|
||||||
@@ -140,7 +145,7 @@ export default function Profile() {
|
|||||||
|
|
||||||
<div className="flex flex-row justify-between space-x-3">
|
<div className="flex flex-row justify-between space-x-3">
|
||||||
<span className="flex flex-col items-start flex-1">
|
<span className="flex flex-col items-start flex-1">
|
||||||
<span className="text-md">First Name</span>
|
<span className="text-md">First Name*</span>
|
||||||
<span className="text-gray-300 text-xs mb-2"></span>
|
<span className="text-gray-300 text-xs mb-2"></span>
|
||||||
<input
|
<input
|
||||||
placeholder="ex. John"
|
placeholder="ex. John"
|
||||||
@@ -151,7 +156,7 @@ export default function Profile() {
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span className="flex flex-col items-start flex-1">
|
<span className="flex flex-col items-start flex-1">
|
||||||
<span className="text-md">Last Name</span>
|
<span className="text-md">Last Name*</span>
|
||||||
<span className="text-gray-300 text-xs mb-2"></span>
|
<span className="text-gray-300 text-xs mb-2"></span>
|
||||||
<input
|
<input
|
||||||
placeholder="ex. Brown"
|
placeholder="ex. Brown"
|
||||||
@@ -165,7 +170,7 @@ export default function Profile() {
|
|||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
<span className="flex flex-col items-start">
|
<span className="flex flex-col items-start">
|
||||||
<span className="text-md">Nickname</span>
|
<span className="text-md">Nickname*</span>
|
||||||
<span className="text-gray-300 text-xs mb-2">
|
<span className="text-gray-300 text-xs mb-2">
|
||||||
What does your team call you? This is what is displayed.
|
What does your team call you? This is what is displayed.
|
||||||
</span>
|
</span>
|
||||||
@@ -178,7 +183,7 @@ export default function Profile() {
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span className="flex flex-col items-start">
|
<span className="flex flex-col items-start">
|
||||||
<span className="text-md">Role</span>
|
<span className="text-md">Role*</span>
|
||||||
<span className="text-gray-300 text-xs mb-2">
|
<span className="text-gray-300 text-xs mb-2">
|
||||||
Are you a developer? designer? manager?
|
Are you a developer? designer? manager?
|
||||||
</span>
|
</span>
|
||||||
@@ -195,30 +200,39 @@ export default function Profile() {
|
|||||||
<span className="flex flex-row justify-end space-x-2">
|
<span className="flex flex-row justify-end space-x-2">
|
||||||
{/* if they already had a nickname, they are probably revisiting this page */}
|
{/* if they already had a nickname, they are probably revisiting this page */}
|
||||||
{/* can't cancel if they are a new user */}
|
{/* can't cancel if they are a new user */}
|
||||||
{user && user.nickName ? (
|
{loading ? (
|
||||||
<>
|
<svg
|
||||||
<button
|
className="animate-spin h-5 w-5 mr-3 border rounded-full"
|
||||||
onClick={() => router.push("/teams")}
|
viewBox="0 0 24 24"
|
||||||
className="bg-gray-100 py-2 px-5 rounded text-gray-400"
|
></svg>
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="submit"
|
|
||||||
className="text-sm text-white font-semibold py-2 px-5 bg-teal-500 rounded"
|
|
||||||
>
|
|
||||||
Save
|
|
||||||
</button>
|
|
||||||
</>
|
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{/* if they already had a nickname, they are probably revisiting this page */}
|
{user && user.nickName ? (
|
||||||
<button
|
<>
|
||||||
type="submit"
|
<button
|
||||||
className="text-sm text-white font-semibold py-2 px-5 bg-teal-500 rounded"
|
onClick={() => router.push("/teams")}
|
||||||
>
|
className="bg-gray-100 py-2 px-5 rounded text-gray-400"
|
||||||
{"Continue ->"}
|
>
|
||||||
</button>
|
Cancel
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
className="text-sm text-white font-semibold py-2 px-5 bg-teal-500 rounded"
|
||||||
|
>
|
||||||
|
Save
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{/* if they already had a nickname, they are probably revisiting this page */}
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
className="text-sm text-white font-semibold py-2 px-5 bg-teal-500 rounded"
|
||||||
|
>
|
||||||
|
{"Continue ->"}
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user