Skip to content

Commit f30cfff

Browse files
committed
Fix bio parsing grid
1 parent ca3eb62 commit f30cfff

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

web/components/profile-grid.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,26 @@ function ProfilePreview(props: {
8787
const bio = profile.bio as JSONContent;
8888

8989
if (bio && bio.content) {
90-
bio.content = bio.content?.map(c => {
91-
if (c.type === 'heading' || c.type === 'list') {
92-
return {
90+
const newBio = []
91+
let i = 0
92+
for (const c of bio.content) {
93+
if ((c?.content?.length || 0) == 0) continue
94+
if (c.type === 'paragraph') {
95+
newBio.push(c)
96+
} else if (['heading'].includes(c.type ?? '')) {
97+
newBio.push({
9398
type: 'paragraph',
9499
content: c.content
95-
}
100+
})
101+
} else if (c.type === 'image') {
102+
continue
103+
} else {
104+
newBio.push(c)
96105
}
97-
return c
98-
})
106+
i += 1
107+
if (i >= 5) break
108+
}
109+
bio.content = newBio
99110
}
100111

101112
return (

0 commit comments

Comments
 (0)