Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/ui/src/features/inbox/assets/posthog-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { cn } from "@posthog/quill";
import posthogIcon from "../../assets/posthog-icon.svg";

const SIZE = {
sm: { className: "h-[18px] w-[18px]", pixels: 28 },
Expand All @@ -11,6 +12,13 @@ interface SuggestedReviewerAvatarProps {
className?: string;
}

/** GitHub bots are suffixed with `[bot]`, e.g. `dependabot[bot]`. */
function isBotLogin(githubLogin: string): boolean {
return githubLogin.endsWith("[bot]");
}

const POSTHOG_BOT_LOGIN = "posthog[bot]";

/** GitHub profile avatar for suggested reviewers – matches SuggestedReviewersEditor. */
export function SuggestedReviewerAvatar({
githubLogin,
Expand All @@ -19,6 +27,27 @@ export function SuggestedReviewerAvatar({
}: SuggestedReviewerAvatarProps) {
const config = SIZE[size];

if (isBotLogin(githubLogin)) {
// GitHub bot avatars are noisy generic icons; render the PostHog logo for our
// own bot and an empty space sized like the avatar for every other bot.
if (githubLogin === POSTHOG_BOT_LOGIN) {
return (
<img
src={posthogIcon}
alt=""
className={cn("shrink-0 object-contain", config.className, className)}
/>
);
}

return (
<span
aria-hidden
className={cn("shrink-0", config.className, className)}
/>
);
}

return (
<img
src={`https://github.com/${githubLogin}.png?size=${config.pixels}`}
Expand Down
Loading