Skip to content

Commit

Permalink
Handle default name in LabelCircle
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman authored and futurepaul committed Apr 3, 2024
1 parent 77fef98 commit ea5bb01
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/LabelCircle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createResource, createSignal, JSX, Match, Switch } from "solid-js";
import { Dynamic } from "solid-js/web";

import avatar from "~/assets/generic-avatar.jpg";
import { generateGradient } from "~/utils";
import { DEFAULT_NOSTR_NAME, generateGradient } from "~/utils";

export function Circle(props: {
children: JSX.Element;
Expand Down Expand Up @@ -44,15 +44,18 @@ export function LabelCircle(props: {
onClick?: () => void;
}) {
const [gradient] = createResource(async () => {
if (props.name && props.contact) {
if (props.name && props.name !== DEFAULT_NOSTR_NAME && props.contact) {
return generateGradient(props.name || "?");
} else {
return undefined;
}
});

const text = () =>
props.contact && props.name && props.name.length
props.contact &&
props.name &&
props.name.length &&
props.name !== DEFAULT_NOSTR_NAME
? props.name[0]
: props.label
? "≡"
Expand Down

0 comments on commit ea5bb01

Please sign in to comment.