Skip to content

Commit 1a69e13

Browse files
reganbenedettiRegan
andauthored
user names are defaulted to 'user' and have default profile icon (#601)
Co-authored-by: Regan <z5487348@ad.unsw.edu.au>
1 parent a1c9f20 commit 1a69e13

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

frontend/src/components/NavBar/AvatarButton.tsx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,17 @@ const ToggleButton = styled(Popover.Button, {
1313
const ItemButton = tw.button`flex items-center justify-end gap-1 rounded-md px-2 py-1 focus-within:outline-none focus-within:ring focus-within:ring-indigo-600/50 hover:bg-gray-50 hover:text-indigo-700`;
1414

1515
const AvatarButton = () => {
16-
const name = localStorage.getItem("name") ?? "";
17-
const initials = name
18-
.split(" ")
19-
// this non-exhaustively matches other latin alphabets, not just enligh
20-
// https://stackoverflow.com/a/32567789
21-
.map((n) => [...n].find((c) => c.toLowerCase() !== c.toUpperCase()) ?? n[0])
22-
.join("");
23-
16+
const name = "user"
2417
const navigate = useNavigate();
2518
const logout = () => {
26-
["name", "signup_token", "AUTH_TOKEN"].forEach((key) => {
27-
localStorage.removeItem(key);
28-
navigate("/");
29-
});
30-
};
19+
navigate("/");
20+
}
21+
3122

3223
return (
3324
<Popover tw="relative">
3425
<>
35-
<ToggleButton>{initials}</ToggleButton>
26+
<ToggleButton>{<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-user-icon lucide-user"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>}</ToggleButton>
3627
<Transition
3728
as={Fragment}
3829
enter={tw`transition duration-200 ease-out`}

0 commit comments

Comments
 (0)