Skip to content

Commit 44eb043

Browse files
committed
Fixed cards UI
1 parent a59aa64 commit 44eb043

File tree

11 files changed

+42
-235
lines changed

11 files changed

+42
-235
lines changed
Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,40 @@
1-
import { Card, CardContent } from "@/components/ui/card";
21
import { Course } from "@courselit/common-models";
3-
import { Link } from "@courselit/components-library";
2+
import {
3+
ContentCard,
4+
ContentCardContent,
5+
ContentCardHeader,
6+
ContentCardImage,
7+
Image,
8+
} from "@courselit/components-library";
49
import { truncate } from "@ui-lib/utils";
5-
import Image from "next/image";
610

711
export function BlogContentCard({ product }: { product: Course }) {
812
return (
9-
<Link href={`/blog/${product.slug}/${product.courseId}`}>
10-
<Card className="overflow-hidden transition-all duration-300 hover:shadow-lg hover:-translate-y-1">
11-
<div className="relative aspect-video">
12-
<Image
13-
src={
14-
product.featuredImage?.thumbnail ||
15-
"/courselit_backdrop_square.webp"
16-
}
17-
alt={product.title}
18-
fill
19-
className="object-cover"
20-
priority
21-
/>
22-
</div>
23-
<CardContent className="p-4">
24-
<h3 className="text-xl font-semibold mb-3">
25-
{product.title}
26-
</h3>
27-
<div className="flex items-center justify-between text-sm text-muted-foreground">
28-
<div className="flex items-center gap-1 ascp">
29-
<Image
30-
src={
31-
product.user?.avatar?.thumbnail ||
32-
"/courselit_backdrop_square.webp"
33-
}
34-
alt={product.user?.name || "User Avatar"}
35-
width={24}
36-
height={24}
37-
className="rounded-full"
38-
/>
39-
<span>
40-
{truncate(product.user?.name || "Unnamed", 30)}
41-
</span>
42-
</div>
13+
<ContentCard href={`/blog/${product.slug}/${product.courseId}`}>
14+
<ContentCardImage
15+
src={product.featuredImage?.file || ""}
16+
alt={product.title}
17+
/>
18+
<ContentCardContent>
19+
<ContentCardHeader>
20+
{truncate(product.title, 32)}
21+
</ContentCardHeader>
22+
<div className="flex items-center justify-between text-sm text-muted-foreground">
23+
<div className="flex items-center gap-1 ascp">
24+
<Image
25+
src={product.user?.avatar?.thumbnail}
26+
alt={product.user?.name || "User Avatar"}
27+
loading="lazy"
28+
className="!aspect-square rounded-full"
29+
width="w-6"
30+
height="h-6"
31+
/>
32+
<span>
33+
{truncate(product.user?.name || "Unnamed", 30)}
34+
</span>
4335
</div>
44-
</CardContent>
45-
</Card>
46-
</Link>
36+
</div>
37+
</ContentCardContent>
38+
</ContentCard>
4739
);
4840
}

apps/web/app/(with-contexts)/(with-layout)/communities/content-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function CommunityContentCard({
2929
<div className="relative aspect-video">
3030
<Image
3131
src={
32-
community.featuredImage?.thumbnail ||
32+
community.featuredImage?.file ||
3333
"/courselit_backdrop_square.webp"
3434
}
3535
alt={community.name}

apps/web/app/(with-contexts)/(with-layout)/products/content-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function ProductContentCard({ product }: { product: Course }) {
2121
<div className="relative aspect-video">
2222
<Image
2323
src={
24-
product.featuredImage?.thumbnail ||
24+
product.featuredImage?.file ||
2525
"/courselit_backdrop_square.webp"
2626
}
2727
alt={product.title}

apps/web/app/(with-contexts)/(with-layout)/products/products-list.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { EmptyState } from "./empty-state";
99
import { Button } from "@components/ui/button";
1010
import { SkeletonCard, ProductCard } from "@courselit/components-library";
1111
import { SiteInfoContext } from "@components/contexts";
12+
import { truncate } from "@ui-lib/utils";
1213
const ITEMS_PER_PAGE = 9;
1314

1415
export function ProductsList({
@@ -61,7 +62,9 @@ export function ProductsList({
6162
: products.map((product: Course) => (
6263
<ProductCard
6364
key={product.courseId}
64-
product={product}
65+
product={Object.assign({}, product, {
66+
title: truncate(product.title, 32),
67+
})}
6568
siteinfo={siteinfo}
6669
/>
6770
))}

apps/web/app/(with-contexts)/dashboard/(sidebar)/my-content/page.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ const breadcrumbs = [{ label: MY_CONTENT_HEADER, href: "#" }];
4242

4343
export default function Page() {
4444
const [data, setData] = useState<ContentItem[]>([]);
45-
const [dataLoaded, setDataLoaded] = useState(false);
4645
const [loading, setLoading] = useState(true);
4746
const { profile } = useContext(ProfileContext);
4847
const address = useContext(AddressContext);
@@ -83,7 +82,6 @@ export default function Page() {
8382
} catch (e: any) {
8483
} finally {
8584
setLoading(false);
86-
setDataLoaded(true);
8785
}
8886
};
8987

apps/web/app/(with-contexts)/dashboard/(sidebar)/products/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function ProductCard({ product }: { product: Course }) {
6666
return (
6767
<ContentCard href={`/dashboard/product/${product.courseId}`}>
6868
<ContentCardImage
69-
src={product.featuredImage?.thumbnail}
69+
src={product.featuredImage?.file}
7070
alt={product.title}
7171
/>
7272
<ContentCardContent>

apps/web/components/admin/my-content/content-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function MyContentCard({ item }: ContentCardProps) {
3434
}
3535
>
3636
<ContentCardImage
37-
src={item.entity.featuredImage?.thumbnail}
37+
src={item.entity.featuredImage?.file}
3838
alt={item.entity.title}
3939
/>
4040
<ContentCardContent>

apps/web/components/public/items.tsx

Lines changed: 0 additions & 107 deletions
This file was deleted.

apps/web/pages/communities2.tsx

Lines changed: 0 additions & 68 deletions
This file was deleted.

packages/common-widgets/src/featured/widget.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,6 @@ export default function Widget({
164164
product={course}
165165
siteinfo={state.siteinfo}
166166
/>
167-
// <div
168-
// key={course.courseId}
169-
// className="basis-full md:basis-[49.5%] lg:basis-[32.6666%] mb-6"
170-
// >
171-
// <CourseItem
172-
// course={course}
173-
// siteInfo={state.siteinfo}
174-
// freeCostCaption={"FREE"}
175-
// key={index}
176-
// />
177-
// </div>
178167
))}
179168
</>
180169
)}

0 commit comments

Comments
 (0)