diff --git a/apps/server/src/models/post/post.service.ts b/apps/server/src/models/post/post.service.ts index 0df249e..03d89de 100755 --- a/apps/server/src/models/post/post.service.ts +++ b/apps/server/src/models/post/post.service.ts @@ -101,7 +101,6 @@ export class PostService extends BaseTreeService { }, params: { staff?: UserProfile; tx?: Prisma.TransactionClient }, ) { - const { courseDetail } = args; // If no transaction is provided, create a new one if (!params.tx) { @@ -124,7 +123,7 @@ export class PostService extends BaseTreeService { ) { args.data.authorId = params?.staff?.id; args.data.updatedAt = dayjs().toDate(); - + const result = await super.create(args); EventBus.emit('dataChanged', { type: ObjectType.POST, diff --git a/apps/web/src/app/main/courses/components/CourseCard.tsx b/apps/web/src/app/main/courses/components/CourseCard.tsx deleted file mode 100755 index fa4b0d5..0000000 --- a/apps/web/src/app/main/courses/components/CourseCard.tsx +++ /dev/null @@ -1,111 +0,0 @@ -import { Card, Tag, Typography, Button } from "antd"; -import { - BookOutlined, - EyeOutlined, - PlayCircleOutlined, - TeamOutlined, -} from "@ant-design/icons"; -import { CourseDto, TaxonomySlug } from "@nice/common"; -import { useNavigate } from "react-router-dom"; - -interface CourseCardProps { - course: CourseDto; - edit?: boolean; -} -const { Title, Text } = Typography; -export default function CourseCard({ course, edit = false }: CourseCardProps) { - const navigate = useNavigate(); - const handleClick = (course: CourseDto) => { - if (!edit) { - navigate(`/course/${course.id}/detail`); - } else { - navigate(`/course/${course.id}/editor`); - } - window.scrollTo({ top: 0, behavior: "smooth" }); - }; - return ( - handleClick(course)} - key={course.id} - hoverable - className="group overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2" - cover={ -
-
- -
- -
- }> -
-
-
- {course?.terms?.map((term) => { - return ( - <> - - {term.name} - - - ); - })} -
-
- - - <button> {course.title}</button> - - -
- -
- - {course?.depts?.length > 1 - ? `${course.depts[0].name}等` - : course?.depts?.[0]?.name} - {/* {course?.depts?.map((dept) => {return dept.name.length > 1 ?`${dept.name.slice}等`: dept.name})} */} - {/* {course?.depts?.map((dept)=>{return dept.name})} */} - -
-
-
- - - {`观看次数 ${course?.meta?.views || 0}`} - - - - {`学习人数 ${course?.studentIds?.length || 0}`} - -
-
- -
-
- - ); -} diff --git a/apps/web/src/app/main/courses/components/CoursesContainer.tsx b/apps/web/src/app/main/courses/components/CoursesContainer.tsx index d3b7562..72b9499 100755 --- a/apps/web/src/app/main/courses/components/CoursesContainer.tsx +++ b/apps/web/src/app/main/courses/components/CoursesContainer.tsx @@ -1,16 +1,14 @@ import { useMainContext } from "../../layout/MainProvider"; import { PostType, Prisma } from "@nice/common"; import PostList from "@web/src/components/models/course/list/PostList"; -import { useMemo } from "react"; -import CourseCard from "./CourseCard"; -import PostCard from "@web/src/components/models/course/card/PostCard"; +import CourseCard from "@web/src/components/models/post/SubPost/CourseCard"; export function CoursesContainer() { - const {searchCondition, termsCondition } = useMainContext(); + const { searchCondition, termsCondition } = useMainContext(); return ( <> } + renderItem={(post) => } params={{ pageSize: 12, where: { diff --git a/apps/web/src/app/main/home/components/CoursesSection.tsx b/apps/web/src/app/main/home/components/CoursesSection.tsx index bd2f45b..3280945 100755 --- a/apps/web/src/app/main/home/components/CoursesSection.tsx +++ b/apps/web/src/app/main/home/components/CoursesSection.tsx @@ -5,7 +5,8 @@ import { api } from "@nice/client"; import { CoursesSectionTag } from "./CoursesSectionTag"; import LookForMore from "./LookForMore"; import PostList from "@web/src/components/models/course/list/PostList"; -import CourseCard from "../../courses/components/CourseCard"; +import PostCard from "@web/src/components/models/post/PostCard"; +import CourseCard from "@web/src/components/models/post/SubPost/CourseCard"; interface GetTaxonomyProps { categories: string[]; isLoading: boolean; @@ -17,7 +18,7 @@ function useGetTaxonomy({ type }): GetTaxonomyProps { taxonomy: { slug: type, }, - parentId: null + parentId: null, }, take: 11, // 只取前10个 }); @@ -82,17 +83,17 @@ const CoursesSection: React.FC = ({ )}
} + renderItem={(post) => } params={{ page: 1, pageSize: initialVisibleCoursesCount, where: { terms: !(selectedCategory === "全部") ? { - some: { - name: selectedCategory, - }, - } + some: { + name: selectedCategory, + }, + } : {}, }, }} diff --git a/apps/web/src/app/main/layout/MainProvider.tsx b/apps/web/src/app/main/layout/MainProvider.tsx index 2fc4c5f..d928e9d 100755 --- a/apps/web/src/app/main/layout/MainProvider.tsx +++ b/apps/web/src/app/main/layout/MainProvider.tsx @@ -1,4 +1,4 @@ -import { PostType, Prisma } from "packages/common/dist"; +import { PostType, Prisma } from "@nice/common"; import React, { createContext, ReactNode, diff --git a/apps/web/src/app/main/my-duty/components/MyDutyListContainer.tsx b/apps/web/src/app/main/my-duty/components/MyDutyListContainer.tsx index f656398..727e828 100644 --- a/apps/web/src/app/main/my-duty/components/MyDutyListContainer.tsx +++ b/apps/web/src/app/main/my-duty/components/MyDutyListContainer.tsx @@ -1,9 +1,9 @@ import PostList from "@web/src/components/models/course/list/PostList"; import { useAuth } from "@web/src/providers/auth-provider"; - -import CourseCard from "../../courses/components/CourseCard"; import { PostType } from "@nice/common"; import { useMainContext } from "../../layout/MainProvider"; +import PostCard from "@web/src/components/models/post/PostCard"; +import CourseCard from "@web/src/components/models/post/SubPost/CourseCard"; export default function MyDutyListContainer() { const { user } = useAuth(); @@ -11,9 +11,7 @@ export default function MyDutyListContainer() { return ( <> ( - - )} + renderItem={(post) => } params={{ pageSize: 12, where: { diff --git a/apps/web/src/app/main/my-learning/components/MyLearningListContainer.tsx b/apps/web/src/app/main/my-learning/components/MyLearningListContainer.tsx index a6e8226..be281ae 100644 --- a/apps/web/src/app/main/my-learning/components/MyLearningListContainer.tsx +++ b/apps/web/src/app/main/my-learning/components/MyLearningListContainer.tsx @@ -1,8 +1,9 @@ import PostList from "@web/src/components/models/course/list/PostList"; import { useAuth } from "@web/src/providers/auth-provider"; import { useMainContext } from "../../layout/MainProvider"; -import CourseCard from "../../courses/components/CourseCard"; import { PostType } from "@nice/common"; +import PostCard from "@web/src/components/models/post/PostCard"; +import CourseCard from "@web/src/components/models/post/SubPost/CourseCard"; export default function MyLearningListContainer() { const { user } = useAuth(); @@ -10,9 +11,7 @@ export default function MyLearningListContainer() { return ( <> ( - - )} + renderItem={(post) => } params={{ pageSize: 12, where: { diff --git a/apps/web/src/app/main/my-path/components/MyPathListContainer.tsx b/apps/web/src/app/main/my-path/components/MyPathListContainer.tsx index ebbba92..33e0346 100644 --- a/apps/web/src/app/main/my-path/components/MyPathListContainer.tsx +++ b/apps/web/src/app/main/my-path/components/MyPathListContainer.tsx @@ -1,10 +1,10 @@ import PostList from "@web/src/components/models/course/list/PostList"; import { useAuth } from "@web/src/providers/auth-provider"; - import { PostType } from "@nice/common"; import { useMainContext } from "../../layout/MainProvider"; -import PathCard from "../../path/components/PathCard"; +import PostCard from "@web/src/components/models/post/PostCard"; +import PathCard from "@web/src/components/models/post/SubPost/PathCard"; export default function MyPathListContainer() { const { user } = useAuth(); @@ -12,7 +12,7 @@ export default function MyPathListContainer() { return ( <> } + renderItem={(post) => } params={{ pageSize: 12, where: { diff --git a/apps/web/src/app/main/path/components/DeptInfo.tsx b/apps/web/src/app/main/path/components/DeptInfo.tsx index 2cec836..fe82bbd 100644 --- a/apps/web/src/app/main/path/components/DeptInfo.tsx +++ b/apps/web/src/app/main/path/components/DeptInfo.tsx @@ -1,22 +1,41 @@ -import { TeamOutlined } from "@ant-design/icons"; +import { BookOutlined, EyeOutlined, TeamOutlined } from "@ant-design/icons"; import { Typography } from "antd"; +import { PostDto } from "@nice/common"; const { Title, Text } = Typography; -const DeptInfo = ({ path }) => { - return ( -
- - {path?.depts && path?.depts?.length > 0 ? ( - - {path?.depts?.length > 1 ? `${path.depts[0].name}等` : path?.depts?.[0]?.name} - - ) : ( - - 未设置单位 - - )} -
- ); +const DeptInfo = ({ post }: { post: PostDto }) => { + return ( +
+
+ + {post?.depts && post?.depts?.length > 0 ? ( + + {post?.depts?.length > 1 + ? `${post.depts[0].name}等` + : post?.depts?.[0]?.name} + + ) : ( + + 未设置单位 + + )} +
+ {post && ( +
+ + + {`${post?.meta?.views || 0}`} + + {post?.studentIds && post?.studentIds?.length > 0 && ( + + + {`${post?.studentIds?.length || 0}`} + + )} +
+ )} +
+ ); }; -export default DeptInfo; \ No newline at end of file +export default DeptInfo; diff --git a/apps/web/src/app/main/path/components/PathCard.tsx b/apps/web/src/app/main/path/components/PathCard.tsx deleted file mode 100755 index 32f5d43..0000000 --- a/apps/web/src/app/main/path/components/PathCard.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { Card, Tag, Typography, Button } from "antd"; -import { - EyeOutlined -} from "@ant-design/icons"; -import { PostDto, TaxonomySlug } from "@nice/common"; -import { useNavigate } from "react-router-dom"; -import DeptInfo from "./DeptInfo"; -import TermInfo from "./TermInfo"; -interface pathCardProps { - path: PostDto; -} -const { Title, Text } = Typography; -export default function PathCard({ path }: pathCardProps) { - const navigate = useNavigate(); - const handleClick = (path: PostDto) => { - navigate(`/path/editor/${path.id}`); - window.scrollTo({ top: 0, behavior: "smooth" }); - }; - return ( - handleClick(path)} - key={path.id} - hoverable - className=" group overflow-hidden rounded-xl border border-gray-200 bg-white shadow-xl hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2" - cover={ -
-
- {/*
*/} -
- }> -
- - - <button> {path.title}</button> - - -
- - - - {path?.meta?.views - ? `观看次数 ${path?.meta?.views}` - : 0} - -
-
- -
-
- - ); -} diff --git a/apps/web/src/app/main/path/components/PathListContainer.tsx b/apps/web/src/app/main/path/components/PathListContainer.tsx index 57dfcb9..4e7ade6 100755 --- a/apps/web/src/app/main/path/components/PathListContainer.tsx +++ b/apps/web/src/app/main/path/components/PathListContainer.tsx @@ -1,15 +1,15 @@ import PostList from "@web/src/components/models/course/list/PostList"; import { useMainContext } from "../../layout/MainProvider"; import { PostType, Prisma } from "@nice/common"; -import PathCard from "./PathCard"; -import PostCard from "@web/src/components/models/course/card/PostCard"; +import PostCard from "@web/src/components/models/post/PostCard"; +import PathCard from "@web/src/components/models/post/SubPost/PathCard"; export function PathListContainer() { const { searchCondition, termsCondition } = useMainContext(); return ( <> } + renderItem={(post) => } params={{ pageSize: 12, where: { diff --git a/apps/web/src/app/main/path/components/TermInfo.tsx b/apps/web/src/app/main/path/components/TermInfo.tsx index 421909b..d034888 100644 --- a/apps/web/src/app/main/path/components/TermInfo.tsx +++ b/apps/web/src/app/main/path/components/TermInfo.tsx @@ -1,41 +1,43 @@ import { Tag } from "antd"; -import { TaxonomySlug } from "@nice/common"; +import { PostDto, TaxonomySlug } from "@nice/common"; -const TermInfo = ({ path }) => { - console.log('xx',path?.terms); - - return <> - {path?.terms && path?.terms?.length > 0 ? ( -
- {path?.terms?.map((term:any) => { - return ( - - {term.name} - - ); - })} -
- ) : ( -
- - {"未设置分类"} - -
- )} - +const TermInfo = ({ post }: { post: PostDto }) => { + console.log("xx", post?.terms); + + return ( + <> + {post?.terms && post?.terms?.length > 0 ? ( +
+ {post?.terms?.map((term: any) => { + return ( + + {term.name} + + ); + })} +
+ ) : ( +
+ + {"未设置分类"} + +
+ )} + + ); }; -export default TermInfo; \ No newline at end of file +export default TermInfo; diff --git a/apps/web/src/app/main/search/components/SearchContainer.tsx b/apps/web/src/app/main/search/components/SearchContainer.tsx index cbfbf56..292d9b5 100644 --- a/apps/web/src/app/main/search/components/SearchContainer.tsx +++ b/apps/web/src/app/main/search/components/SearchContainer.tsx @@ -1,14 +1,24 @@ import PostList from "@web/src/components/models/course/list/PostList"; import { useMainContext } from "../../layout/MainProvider"; -import PathCard from "../../path/components/PathCard"; -import { useEffect } from "react"; +import PostCard from "@web/src/components/models/post/PostCard"; +import { PostType } from "@nice/common"; +import CourseCard from "@web/src/components/models/post/SubPost/CourseCard"; +import PathCard from "@web/src/components/models/post/SubPost/PathCard"; +const POST_TYPE_COMPONENTS = { + [PostType.COURSE]: CourseCard, + [PostType.PATH]: PathCard, +}; export default function SearchListContainer() { const { searchCondition, termsCondition, searchMode } = useMainContext(); return ( <> } + renderItem={(post) => { + const Component = + POST_TYPE_COMPONENTS[post.type] || PostCard; + return ; + }} params={{ pageSize: 12, where: { diff --git a/apps/web/src/components/models/course/card/CourseCard.tsx b/apps/web/src/components/models/course/card/CourseCard.tsx deleted file mode 100755 index 60e1f48..0000000 --- a/apps/web/src/components/models/course/card/CourseCard.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { CourseDto } from "@nice/common"; -import { Card } from "@web/src/components/common/container/Card"; -import { CourseHeader } from "./CourseHeader"; -import { CourseStats } from "./CourseStats"; -import { Popover } from "@web/src/components/presentation/popover"; -import { useState } from "react"; - -interface CourseCardProps { - course: CourseDto; - onClick?: () => void; -} - -export const CourseCard = ({ course, onClick }: CourseCardProps) => { - return ( - - - - - ); -}; diff --git a/apps/web/src/components/models/course/card/PostCard.tsx b/apps/web/src/components/models/course/card/PostCard.tsx deleted file mode 100644 index 369fbeb..0000000 --- a/apps/web/src/components/models/course/card/PostCard.tsx +++ /dev/null @@ -1,127 +0,0 @@ -import { Card, Tag, Typography, Button } from "antd"; -import { - BookOutlined, - EyeOutlined, - PlayCircleOutlined, - TeamOutlined, -} from "@ant-design/icons"; -import { CourseDto, PostDto, TaxonomySlug } from "@nice/common"; -import { useNavigate } from "react-router-dom"; -import { useEffect } from "react"; - -interface PostCardProps { - course?: CourseDto; - path?: PostDto -} -const { Title, Text } = Typography; -export default function PostCard({ course = null, path = null }: PostCardProps) { - const navigate = useNavigate(); - const handleClick = (course: CourseDto) => { - if (course) { - navigate(`/course/${course.id}/detail`); - } else if (path) { - navigate(`/path/editor/${path.id}`); - } - window.scrollTo({ top: 0, behavior: "smooth", }) - }; - return ( - handleClick(course)} - key={course?.id} - hoverable - className="group overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2" - cover={ -
-
- - {course && ( - <> -
- - - )} -
- }> -
-
-
- {course?.terms?.map((term) => { - return ( - <> - - {term.name} - - - ); - })} -
-
- - - <button> {course?.title}</button> - -
- -
- - {course?.depts?.length > 1 - ? `${course.depts[0].name}等` - : course?.depts?.[0]?.name} - {/* {course?.depts?.map((dept) => {return dept.name.length > 1 ?`${dept.name.slice}等`: dept.name})} */} - {/* {course?.depts?.map((dept)=>{return dept.name})} */} - - -
- {!course && ( - <> - - {path?.meta?.views - ? `观看次数 ${path?.meta?.views}` - : null} - - - )} -
- {course && ( -
- - - {`观看次数 ${course?.meta?.views || 0}`} - - - - {`学习人数 ${course?.studentIds?.length || 0}`} - -
- )} -
- -
-
- - ); -} diff --git a/apps/web/src/components/models/course/editor/context/CourseEditorContext.tsx b/apps/web/src/components/models/course/editor/context/CourseEditorContext.tsx index 88571a3..bc84b18 100755 --- a/apps/web/src/components/models/course/editor/context/CourseEditorContext.tsx +++ b/apps/web/src/components/models/course/editor/context/CourseEditorContext.tsx @@ -98,12 +98,18 @@ export function CourseFormProvider({ thumbnail: values?.meta?.thumbnail, }), }, - terms: { - set: termIds.map((id) => ({ id })), // 转换成 connect 格式 - }, - depts: { - set: deptIds.map((id) => ({ id })), - }, + terms: + termIds?.length > 0 + ? { + set: termIds.map((id) => ({ id })), // 转换成 connect 格式 + } + : undefined, + depts: + deptIds?.length > 0 + ? { + set: deptIds.map((id) => ({ id })), + } + : undefined, }; // 删除原始的 taxonomy 字段 taxonomies.forEach((tax) => { diff --git a/apps/web/src/components/models/course/editor/form/CourseContentForm/SortableLecture.tsx b/apps/web/src/components/models/course/editor/form/CourseContentForm/SortableLecture.tsx index 26282d2..3c9f279 100755 --- a/apps/web/src/components/models/course/editor/form/CourseContentForm/SortableLecture.tsx +++ b/apps/web/src/components/models/course/editor/form/CourseContentForm/SortableLecture.tsx @@ -26,6 +26,7 @@ import CollapsibleContent from "@web/src/components/common/container/Collapsible import { VideoPlayer } from "@web/src/components/presentation/video-player/VideoPlayer"; import MultiAvatarUploader from "@web/src/components/common/uploader/MultiAvatarUploader"; import ResourcesShower from "@web/src/components/common/uploader/ResourceShower"; +import { set } from "idb-keyval"; interface SortableLectureProps { field: Lecture; @@ -82,13 +83,16 @@ export const SortableLecture: React.FC = ({ ? `http://${env.SERVER_IP}:${env.FILE_PORT}/uploads/${videoUrlId}/stream/index.m3u8` : undefined, }, - resources: { - connect: [videoUrlId, ...fileIds] - .filter(Boolean) - .map((fileId) => ({ - fileId, - })), - }, + resources: + [videoUrlId, ...fileIds].filter(Boolean)?.length > 0 + ? { + connect: [videoUrlId, ...fileIds] + .filter(Boolean) + .map((fileId) => ({ + fileId, + })), + } + : undefined, content: values?.content, }, }); @@ -108,13 +112,16 @@ export const SortableLecture: React.FC = ({ ? `http://${env.SERVER_IP}:${env.FILE_PORT}/uploads/${videoUrlId}/stream/index.m3u8` : undefined, }, - resources: { - connect: [videoUrlId, ...fileIds] - .filter(Boolean) - .map((fileId) => ({ - fileId, - })), - }, + resources: + [videoUrlId, ...fileIds].filter(Boolean)?.length > 0 + ? { + connect: [videoUrlId, ...fileIds] + .filter(Boolean) + .map((fileId) => ({ + fileId, + })), + } + : undefined, content: values?.content, }, }); @@ -199,13 +206,7 @@ export const SortableLecture: React.FC = ({ + className="mb-0 flex-1">
diff --git a/apps/web/src/components/models/course/editor/form/CourseContentForm/SortableSection.tsx b/apps/web/src/components/models/course/editor/form/CourseContentForm/SortableSection.tsx index bf6af5b..1b6dfaa 100755 --- a/apps/web/src/components/models/course/editor/form/CourseContentForm/SortableSection.tsx +++ b/apps/web/src/components/models/course/editor/form/CourseContentForm/SortableSection.tsx @@ -135,7 +135,7 @@ export const SortableSection: React.FC = ({ ) : (
- + = ({ /> {field.title || "未命名章节"} - - - -
) } + extra={ + !editing && ( + e.stopPropagation()}> + + + + ) + } key={field.id || "new"}> {children} diff --git a/apps/web/src/components/models/course/list/PostList.tsx b/apps/web/src/components/models/course/list/PostList.tsx index 665e30b..ce9da18 100755 --- a/apps/web/src/components/models/course/list/PostList.tsx +++ b/apps/web/src/components/models/course/list/PostList.tsx @@ -1,5 +1,5 @@ import { Pagination, Empty, Skeleton } from "antd"; -import { courseDetailSelect, CourseDto, Prisma } from "@nice/common"; +import { courseDetailSelect, CourseDto, PostDto, Prisma } from "@nice/common"; import { api } from "@nice/client"; import { DefaultArgs } from "@prisma/client/runtime/library"; import React, { useEffect, useMemo, useState } from "react"; @@ -12,7 +12,7 @@ interface PostListProps { }; cols?: number; showPagination?: boolean; - renderItem: (post: any) => React.ReactNode; + renderItem: (post: PostDto) => React.ReactNode; } interface PostPagnationProps { data: { diff --git a/apps/web/src/components/models/post/PostCard.tsx b/apps/web/src/components/models/post/PostCard.tsx new file mode 100644 index 0000000..856cce4 --- /dev/null +++ b/apps/web/src/components/models/post/PostCard.tsx @@ -0,0 +1,59 @@ +import { Card, Typography, Button } from "antd"; + +import { PostDto } from "@nice/common"; +import DeptInfo from "@web/src/app/main/path/components/DeptInfo"; +import TermInfo from "@web/src/app/main/path/components/TermInfo"; + +interface PostCardProps { + post?: PostDto; + onClick?: (post?: PostDto) => void; +} +const { Title } = Typography; +export default function PostCard({ post, onClick }: PostCardProps) { + const handleClick = (post: PostDto) => { + onClick?.(post); + }; + return ( + handleClick(post)} + key={post?.id} + hoverable + className="group overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2" + cover={ +
+
+
+ }> +
+
+
+ +
+
+ + <button> {post?.title}</button> + +
+ +
+ +
+ +
+
+ + ); +} diff --git a/apps/web/src/components/models/post/SubPost/CourseCard.tsx b/apps/web/src/components/models/post/SubPost/CourseCard.tsx new file mode 100644 index 0000000..981182a --- /dev/null +++ b/apps/web/src/components/models/post/SubPost/CourseCard.tsx @@ -0,0 +1,13 @@ +import { CourseDto, PostDto } from "@nice/common"; +import { useNavigate } from "react-router-dom"; +import PostCard from "../PostCard"; +export default function CourseCard({ post }: { post: PostDto }) { + const navigate = useNavigate(); + return ( + { + navigate(`/course/${post?.id}/detail`); + }}> + ); +} diff --git a/apps/web/src/components/models/post/SubPost/PathCard.tsx b/apps/web/src/components/models/post/SubPost/PathCard.tsx new file mode 100644 index 0000000..c6e5a85 --- /dev/null +++ b/apps/web/src/components/models/post/SubPost/PathCard.tsx @@ -0,0 +1,14 @@ +import { PostDto } from "@nice/common"; +import { useNavigate } from "react-router-dom"; +import PostCard from "../PostCard"; + +export default function PathCard({ post }: { post: PostDto }) { + const navigate = useNavigate(); + return ( + { + navigate(`/path/editor/${post?.id}`); + }}> + ); +} diff --git a/packages/common/src/models/post.ts b/packages/common/src/models/post.ts index 170d0d8..037d004 100755 --- a/packages/common/src/models/post.ts +++ b/packages/common/src/models/post.ts @@ -48,6 +48,7 @@ export type PostDto = Post & { thumbnail?: string; views?: number; }; + studentIds?: string[]; }; export type LectureMeta = {