Skip to content

Commit

Permalink
fix: allow null username (#8552)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnm committed Aug 20, 2024
1 parent 975de81 commit 84311d6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,15 @@ export const SandboxCard = ({
<CardContent selected={selected}>
<Stack direction="vertical" gap={0}>
<SandboxTitle brightness={thumbnail.brightness} {...props} />
<Text
size={12}
truncate
css={{ marginLeft: 28, color: userNameTextColor }}
>
Created by {username}
</Text>
{username ? (
<Text
size={12}
truncate
css={{ marginLeft: 28, color: userNameTextColor }}
>
Created by {username}
</Text>
) : null}
</Stack>
<SandboxStats
noDrag={noDrag}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export const SandboxListItem = ({
variant={selected ? 'body' : 'muted'}
maxWidth="100%"
>
{timeAgo} by {username}
{timeAgo} {username ? `by ${username}` : ''}
</Text>
)}
</Column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,10 @@ const GenericSandbox = ({ isScrolling, item, page }: GenericSandboxProps) => {
{...interactionProps}
isScrolling={isScrolling}
username={
sandboxProps.sandbox.author &&
sandboxProps.sandbox.author.username === user?.username
? 'you'
: sandboxProps.sandbox.author.username
: sandboxProps.sandbox.author?.username || null
}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface SandboxItemComponentProps {
PrivacyIcon: React.FC;
screenshotUrl: string | null;
restricted: boolean;
username: string;
username: string | null;
interaction: 'button' | 'link';
isScrolling: boolean;
selected: boolean;
Expand Down

0 comments on commit 84311d6

Please sign in to comment.