Skip to content

Commit 49f1251

Browse files
committed
Narrower project cards
1 parent 35e7bff commit 49f1251

File tree

2 files changed

+61
-33
lines changed

2 files changed

+61
-33
lines changed

apps/web/src/components/ActivityFeed.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export default function ActivityFeed() {
9595
<div
9696
key={project.project_id}
9797
style={{
98-
flexBasis: "448px",
98+
flexBasis: "400px",
9999
flexGrow: 0,
100100
flexShrink: 0,
101101
}}

apps/web/src/components/PublicUserProfile.jsx

Lines changed: 60 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,17 @@ const UPDATE_PROJECT_ORDER = gql`
5353
`;
5454

5555
const UPDATE_USER_AVATAR = gql`
56-
mutation UpdateUserAvatar($user_id: uuid!, $avatar_variant: Int, $custom_avatar_data: jsonb) {
56+
mutation UpdateUserAvatar(
57+
$user_id: uuid!
58+
$avatar_variant: Int
59+
$custom_avatar_data: jsonb
60+
) {
5761
update_user_by_pk(
5862
pk_columns: { user_id: $user_id }
59-
_set: { avatar_variant: $avatar_variant, custom_avatar_data: $custom_avatar_data }
63+
_set: {
64+
avatar_variant: $avatar_variant
65+
custom_avatar_data: $custom_avatar_data
66+
}
6067
) {
6168
user_id
6269
avatar_variant
@@ -152,7 +159,7 @@ function SortableProjectCard({ project, projectUrl, isDragging }) {
152159
const style = {
153160
transform: CSS.Transform.toString(transform),
154161
transition,
155-
flexBasis: "448px",
162+
flexBasis: "400px",
156163
flexGrow: 0,
157164
flexShrink: 0,
158165
opacity: isSortableDragging ? 0.5 : 1,
@@ -385,7 +392,7 @@ export default function PublicUserProfile() {
385392
if (user) {
386393
const identifier = user.slug || user.user_id;
387394

388-
if (variant === 'custom') {
395+
if (variant === "custom") {
389396
// Load custom avatar from localStorage
390397
try {
391398
const saved = localStorage.getItem(`custom_avatar_${identifier}`);
@@ -395,10 +402,21 @@ export default function PublicUserProfile() {
395402
const size = 120;
396403
const pixelSize = size / 8;
397404
const COLORS = [
398-
'#000000', '#0000D7', '#D70000', '#D700D7',
399-
'#00D700', '#00D7D7', '#D7D700', '#D7D7D7',
400-
'#0000FF', '#FF0000', '#FF00FF', '#00FF00',
401-
'#00FFFF', '#FFFF00', '#FFFFFF'
405+
"#000000",
406+
"#0000D7",
407+
"#D70000",
408+
"#D700D7",
409+
"#00D700",
410+
"#00D7D7",
411+
"#D7D700",
412+
"#D7D7D7",
413+
"#0000FF",
414+
"#FF0000",
415+
"#FF00FF",
416+
"#00FF00",
417+
"#00FFFF",
418+
"#FFFF00",
419+
"#FFFFFF",
402420
];
403421

404422
let svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">`;
@@ -409,12 +427,14 @@ export default function PublicUserProfile() {
409427
const colorIndex = grid[row][col];
410428
if (colorIndex > 0) {
411429
const color = COLORS[colorIndex];
412-
svg += `<rect x="${col * pixelSize}" y="${row * pixelSize}" width="${pixelSize}" height="${pixelSize}" fill="${color}"/>`;
430+
svg += `<rect x="${col * pixelSize}" y="${
431+
row * pixelSize
432+
}" width="${pixelSize}" height="${pixelSize}" fill="${color}"/>`;
413433
}
414434
}
415435
}
416436

417-
svg += '</svg>';
437+
svg += "</svg>";
418438
const encoded = btoa(unescape(encodeURIComponent(svg)));
419439
const newAvatar = `data:image/svg+xml;base64,${encoded}`;
420440
setAvatarUrl(newAvatar);
@@ -424,16 +444,20 @@ export default function PublicUserProfile() {
424444
await gqlFetch(currentUserId, UPDATE_USER_AVATAR, {
425445
user_id: user.user_id,
426446
avatar_variant: -1,
427-
custom_avatar_data: grid
447+
custom_avatar_data: grid,
428448
});
429449
// Update local user state
430-
setUser({...user, avatar_variant: -1, custom_avatar_data: grid});
450+
setUser({
451+
...user,
452+
avatar_variant: -1,
453+
custom_avatar_data: grid,
454+
});
431455
} catch (error) {
432-
console.error('Failed to save custom avatar to database:', error);
456+
console.error("Failed to save custom avatar to database:", error);
433457
}
434458
}
435459
} catch (e) {
436-
console.error('Failed to load custom avatar:', e);
460+
console.error("Failed to load custom avatar:", e);
437461
}
438462
} else {
439463
// Generate new avatar with selected variant
@@ -445,12 +469,16 @@ export default function PublicUserProfile() {
445469
await gqlFetch(currentUserId, UPDATE_USER_AVATAR, {
446470
user_id: user.user_id,
447471
avatar_variant: variant,
448-
custom_avatar_data: null
472+
custom_avatar_data: null,
449473
});
450474
// Update local user state
451-
setUser({...user, avatar_variant: variant, custom_avatar_data: null});
475+
setUser({
476+
...user,
477+
avatar_variant: variant,
478+
custom_avatar_data: null,
479+
});
452480
} catch (error) {
453-
console.error('Failed to save avatar to database:', error);
481+
console.error("Failed to save avatar to database:", error);
454482
}
455483
}
456484
}
@@ -552,32 +580,32 @@ export default function PublicUserProfile() {
552580
shape="square"
553581
className="mb-3"
554582
style={{
555-
width: '120px',
556-
height: '120px',
557-
imageRendering: 'pixelated'
583+
width: "120px",
584+
height: "120px",
585+
imageRendering: "pixelated",
558586
}}
559587
/>
560588
{isOwnProfile && (
561589
<div
562590
className="absolute cursor-pointer"
563591
style={{
564-
top: '0',
565-
left: '128px',
566-
backgroundColor: '#1a1a1a',
567-
borderRadius: '50%',
568-
width: '28px',
569-
height: '28px',
570-
display: 'flex',
571-
alignItems: 'center',
572-
justifyContent: 'center',
573-
border: '2px solid #3a3a3a',
592+
top: "0",
593+
left: "128px",
594+
backgroundColor: "#1a1a1a",
595+
borderRadius: "50%",
596+
width: "28px",
597+
height: "28px",
598+
display: "flex",
599+
alignItems: "center",
600+
justifyContent: "center",
601+
border: "2px solid #3a3a3a",
574602
}}
575603
onClick={() => setShowAvatarSelector(true)}
576604
title="Change avatar"
577605
>
578606
<i
579607
className="pi pi-cog"
580-
style={{ fontSize: '12px', color: '#aaa' }}
608+
style={{ fontSize: "12px", color: "#aaa" }}
581609
/>
582610
</div>
583611
)}
@@ -711,7 +739,7 @@ export default function PublicUserProfile() {
711739
<div
712740
key={project.project_id}
713741
style={{
714-
flexBasis: "448px",
742+
flexBasis: "400px",
715743
flexGrow: 0,
716744
flexShrink: 0,
717745
}}

0 commit comments

Comments
 (0)