Skip to content

Commit 84311d6

Browse files
authored
fix: allow null username (#8552)
1 parent 975de81 commit 84311d6

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

packages/app/src/app/pages/Dashboard/Components/Sandbox/SandboxCard.tsx

+9-7
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,15 @@ export const SandboxCard = ({
284284
<CardContent selected={selected}>
285285
<Stack direction="vertical" gap={0}>
286286
<SandboxTitle brightness={thumbnail.brightness} {...props} />
287-
<Text
288-
size={12}
289-
truncate
290-
css={{ marginLeft: 28, color: userNameTextColor }}
291-
>
292-
Created by {username}
293-
</Text>
287+
{username ? (
288+
<Text
289+
size={12}
290+
truncate
291+
css={{ marginLeft: 28, color: userNameTextColor }}
292+
>
293+
Created by {username}
294+
</Text>
295+
) : null}
294296
</Stack>
295297
<SandboxStats
296298
noDrag={noDrag}

packages/app/src/app/pages/Dashboard/Components/Sandbox/SandboxListItem.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export const SandboxListItem = ({
175175
variant={selected ? 'body' : 'muted'}
176176
maxWidth="100%"
177177
>
178-
{timeAgo} by {username}
178+
{timeAgo} {username ? `by ${username}` : ''}
179179
</Text>
180180
)}
181181
</Column>

packages/app/src/app/pages/Dashboard/Components/Sandbox/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,10 @@ const GenericSandbox = ({ isScrolling, item, page }: GenericSandboxProps) => {
308308
{...interactionProps}
309309
isScrolling={isScrolling}
310310
username={
311+
sandboxProps.sandbox.author &&
311312
sandboxProps.sandbox.author.username === user?.username
312313
? 'you'
313-
: sandboxProps.sandbox.author.username
314+
: sandboxProps.sandbox.author?.username || null
314315
}
315316
/>
316317
</div>

packages/app/src/app/pages/Dashboard/Components/Sandbox/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface SandboxItemComponentProps {
1515
PrivacyIcon: React.FC;
1616
screenshotUrl: string | null;
1717
restricted: boolean;
18-
username: string;
18+
username: string | null;
1919
interaction: 'button' | 'link';
2020
isScrolling: boolean;
2121
selected: boolean;

0 commit comments

Comments
 (0)