Skip to content

Commit d2eb8f0

Browse files
authored
remove user avatar for now (#11172)
1 parent a0c2568 commit d2eb8f0

File tree

1 file changed

+10
-61
lines changed

1 file changed

+10
-61
lines changed

src/components/header.tsx

Lines changed: 10 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
'use client';
22

3-
import {Fragment, useEffect, useState} from 'react';
3+
import {Fragment} from 'react';
44
import {HamburgerMenuIcon} from '@radix-ui/react-icons';
55
import Image from 'next/image';
6-
import Link from 'next/link';
76

87
import SentryLogoSVG from 'sentry-docs/logos/sentry-logo-dark.svg';
98

@@ -22,53 +21,7 @@ type Props = {
2221
noSearch?: boolean;
2322
};
2423

25-
type User = {
26-
avatarUrl: string;
27-
email: string;
28-
id: string;
29-
isActive: boolean;
30-
name: string;
31-
username: string;
32-
};
33-
34-
function Avatar({user}: {user: User}) {
35-
return (
36-
<Link href="https://sentry.io" className="">
37-
<div className="flex items-center space-x-2 px-4">
38-
{/* eslint-disable-next-line @next/next/no-img-element */}
39-
<img
40-
src={user.avatarUrl}
41-
alt={user.name}
42-
width={32}
43-
height={32}
44-
className="rounded-full h-8 w-8"
45-
/>
46-
<div className="flex flex-col">
47-
<span className="font-medium text-sm text-[var(--foreground)]">
48-
{user.name}
49-
</span>
50-
<span className="text-xs text-[var(--foreground-secondary)]">
51-
{user.username}
52-
</span>
53-
</div>
54-
</div>
55-
</Link>
56-
);
57-
}
58-
5924
export function Header({pathname, searchPlatforms, noSearch}: Props) {
60-
// this should work on production (given the request is not blocked by ad blockers),
61-
// but it doesn't on dev or previews because of CORS
62-
// I implemeted a workaround in the form of an api route while building this
63-
const [user, setUser] = useState<User | null>(null);
64-
useEffect(() => {
65-
fetch('https://sentry.io/api/0/users/me/', {credentials: 'include'})
66-
.then(r => r.json())
67-
.then(setUser)
68-
// eslint-disable-next-line no-console
69-
.catch(console.error);
70-
}, []);
71-
7225
return (
7326
<header className="bg-[var(--gray-1)] h-[var(--header-height)] w-full z-50 border-b border-[var(--gray-a3)] fixed top-0">
7427
{/* define a header-height variable for consumption by other components */}
@@ -114,19 +67,15 @@ export function Header({pathname, searchPlatforms, noSearch}: Props) {
11467
<div className="hidden lg-xl:flex justify-end flex-1 space-x-2 items-center min-w-fit">
11568
<NavLink href="https://sentry.io/changelog/">Changelog</NavLink>
11669
<NavLink href="https://try.sentry-demo.com/demo/start/">Sandbox</NavLink>
117-
{user ? (
118-
<Avatar user={user} />
119-
) : (
120-
<Fragment>
121-
<NavLink href="https://sentry.io/">Sign In</NavLink>
122-
<NavLink
123-
href="https://sentry.io/signup/"
124-
className="transition-all duration-300 ease-in-out hover:bg-gradient-to-r hover:from-[#fa7faa] hover:via-[#ff9691] hover:to-[#ffb287]"
125-
>
126-
Get Started
127-
</NavLink>
128-
</Fragment>
129-
)}
70+
<Fragment>
71+
<NavLink href="https://sentry.io/">Sign In</NavLink>
72+
<NavLink
73+
href="https://sentry.io/signup/"
74+
className="transition-all duration-300 ease-in-out hover:bg-gradient-to-r hover:from-[#fa7faa] hover:via-[#ff9691] hover:to-[#ffb287]"
75+
>
76+
Get Started
77+
</NavLink>
78+
</Fragment>
13079
<ThemeToggle />
13180
</div>
13281
<div className="lg-xl:hidden ml-auto">

0 commit comments

Comments
 (0)