Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PleatherStarfish committed Aug 5, 2024
1 parent 494cf6b commit caced95
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion backend/static/js/main.js

Large diffs are not rendered by default.

26 changes: 15 additions & 11 deletions frontend/src/pages/UserPage.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
BuildingOffice2Icon,
FolderIcon,
WrenchIcon
WrenchIcon,
ShoppingCartIcon
} from "@heroicons/react/24/outline";
import { Link, Outlet, useLocation } from "react-router-dom";
import React, { useEffect, useState } from "react";

import { Cart } from "react-bootstrap-icons";
import Gravatar from "react-gravatar";
import cx from "classnames";
import useAuthenticatedUser from "../services/useAuthenticatedUser";
Expand All @@ -23,7 +23,7 @@ const initialNavigation = [
{
name: "Shopping List",
to: "shopping-list",
icon: Cart,
icon: ShoppingCartIcon,
current: false,
},
];
Expand Down Expand Up @@ -146,20 +146,24 @@ const UserPage = () => {
<li className="justify-between mt-auto -mx-6">
<Link to="settings">
<div className="flex items-center px-6 py-3 text-sm font-semibold leading-6 text-gray-900 group/settings gap-x-4 hover:bg-gray-200">
<Gravatar
className="rounded-full"
email={(user?.emails ?? []).filter((e) => e.primary === true)[0].email}
rating="pg"
size={40}
/>
{user?.emails?.length > 0 ? (
<Gravatar
className="rounded-full"
email={user.emails.find((e) => e.primary)?.email || user.emails[0].email}
rating="pg"
size={40}
/>
) : (
<div className="w-10 h-10 bg-gray-200 rounded-full" />
)}
<span className="sr-only">Your profile</span>
<span
aria-hidden="true"
className="invisible transition-all opacity-0 whitespace-nowrap group-hover/slideout:visible group-hover/slideout:opacity-100"
>
{user.first_name && user.last_name
{user?.first_name && user?.last_name
? `${user.first_name} ${user.last_name}`
: user.username}
: user?.username || "User"}
</span>
</div>
</Link>
Expand Down

0 comments on commit caced95

Please sign in to comment.