Skip to content

Commit

Permalink
avatar: fix check for avoiding comet & moon sigils
Browse files Browse the repository at this point in the history
  • Loading branch information
latter-bolden committed Mar 18, 2024
1 parent 03cd458 commit 0d827dd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/tlon-web/src/components/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import classNames from 'classnames';
import { darken, lighten, parseToHsla } from 'color2k';
import _ from 'lodash';
import React, { CSSProperties, useMemo } from 'react';
import { isValidPatp } from 'urbit-ob';
import { isValidPatp, clan as shipType } from 'urbit-ob';

import { isValidUrl, normalizeUrbitColor } from '@/logic/utils';
import { useAvatar } from '@/state/avatar';
Expand Down Expand Up @@ -139,7 +139,10 @@ function Avatar({
background: adjustedColor,
foreground: foregroundColor,
};
const invalidShip = useMemo(() => !isValidPatp(ship), [ship]);
const invalidShip = useMemo(
() => !isValidPatp(ship) || ['comet', 'moon'].includes(shipType(ship)),
[ship]
);

const shouldShowImage = useMemo(
() =>
Expand Down Expand Up @@ -172,7 +175,7 @@ function Avatar({
return (
<img
className={classNames(className, classes, 'object-cover')}
src={avatar || ''} // Convert null to an empty string
src={avatar ?? ''} // Defensively avoid null src
alt=""
style={style}
onLoad={load}
Expand Down

0 comments on commit 0d827dd

Please sign in to comment.