Skip to content

Commit cc9f95e

Browse files
author
Rajat Saxena
committed
Fixed post and image display
1 parent ee104b6 commit cc9f95e

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

apps/web/components/community/index.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
} from "@/components/ui/dialog";
2929
import { Comment as CommentType } from "./mock-data";
3030
import { useRouter } from "next/navigation";
31-
import { capitalize, FetchBuilder } from "@courselit/utils";
31+
import { capitalize, FetchBuilder, truncate } from "@courselit/utils";
3232
import { AddressContext, ProfileContext } from "@components/contexts";
3333
import { PaginatedTable, useToast } from "@courselit/components-library";
3434
import {
@@ -1122,7 +1122,7 @@ export function CommunityForum({
11221122
post
11231123
.user
11241124
.avatar
1125-
?.thumbnail ||
1125+
?.file ||
11261126
"/courselit_backdrop_square.webp"
11271127
}
11281128
alt={`${post.user.name}'s avatar`}
@@ -1194,8 +1194,11 @@ export function CommunityForum({
11941194
<p className="text-base mb-4 font-semibold line-clamp-3">
11951195
{post.title}
11961196
</p>
1197-
<p className="text-sm mb-4 line-clamp-3">
1198-
{post.content}
1197+
<p className="text-sm mb-4 whitespace-pre-wrap">
1198+
{truncate(
1199+
post.content,
1200+
500,
1201+
)}
11991202
</p>
12001203
{post.media && (
12011204
<div className="flex gap-2 overflow-x-auto">
@@ -1245,7 +1248,7 @@ export function CommunityForum({
12451248
</Card>
12461249
</DialogTrigger>
12471250
<DialogContent
1248-
className="sm:max-w-[600px] w-full overflow-y-auto max-h-[calc(100vh-4rem)] my-8"
1251+
className="sm:max-w-[600px] w-full overflow-y-auto max-h-[80vh] my-8"
12491252
aria-describedby={undefined}
12501253
>
12511254
<VisuallyHidden>
@@ -1261,7 +1264,7 @@ export function CommunityForum({
12611264
src={
12621265
post.user
12631266
.avatar
1264-
?.thumbnail ||
1267+
?.file ||
12651268
"/courselit_backdrop_square.webp"
12661269
}
12671270
alt={`${post.user.name}'s avatar`}
@@ -1375,10 +1378,10 @@ export function CommunityForum({
13751378
</DropdownMenu>
13761379
</div>
13771380
<div>
1378-
<p className="text-base mb-4 font-semibold line-clamp-3">
1381+
<p className="text-base mb-4 font-semibold">
13791382
{post.title}
13801383
</p>
1381-
<p className="text-sm mb-4 line-clamp-3">
1384+
<p className="text-sm mb-4 whitespace-pre-wrap">
13821385
{post.content}
13831386
</p>
13841387
</div>

0 commit comments

Comments
 (0)