Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions packages/viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,17 @@
"@luogu-discussion-archive/remark-lda-lfm": "workspace:*",
"@prisma/client": "^5.15.0",
"bootstrap": "^5.3.3",
"highlight.js": "^11.9.0",
"highlight.js": "^11.11.1",
"jsdom": "^22.1.0",
"katex": "^0.16.10",
"next": "^14.2.4",
"prismjs": "^1.29.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^4.12.0",
"react-infinite-scroll-component": "^6.1.0",
"react-markdown": "^9.0.1",
"rehype-highlight": "^6.0.0",
"rehype-highlight": "^7.0.2",
"rehype-katex": "^7.0.0",
"rehype-prism-plus": "^2.0.0",
"remark-math": "^6.0.0",
"rsuite": "^5.68.1",
"socket.io-client": "^4.7.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/viewer/src/app/r/[rid]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default async function Page({ params }: { params: { rid: string } }) {
<div className="rounded-4 shadow-bssb">
<div className="px-md-4x px-4 pt-md-3x pt-2x pb-md-4x pb-4 position-relative">
<Content
discussionAuthor={reply.post.snapshots[0].author.id}
postAuthor={reply.post.snapshots[0].author.id}
content={reply.snapshots[0].content}
/>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function UserDiscussions({ uid }: { uid: string }) {
}
>
<Content
discussionAuthor={discussion.snapshots[0].author.id}
postAuthor={discussion.snapshots[0].author.id}
content={discussion.snapshots[0].content}
// usersMetioned={discussion.usersMetioned}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default function UserParticipated({
</span>
</summary>
<Content
discussionAuthor={discussion.snapshots[0].author.id}
postAuthor={discussion.snapshots[0].author.id}
content={discussion.snapshots[0].content}
// usersMetioned={discussion.usersMetioned}
/>
Expand Down Expand Up @@ -180,9 +180,7 @@ export default function UserParticipated({
</div>
<div className="px-4 py-2 position-relative">
<Content
discussionAuthor={
discussion.snapshots[0].author.id
}
postAuthor={discussion.snapshots[0].author.id}
content={reply.snapshots[0].content}
// usersMetioned={reply.usersMetioned}
/>
Expand Down
12 changes: 6 additions & 6 deletions packages/viewer/src/components/replies/Content.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use client";

import "katex/dist/katex.min.css";
import "highlight.js/styles/tokyo-night-dark.css";
import "prismjs/themes/prism-okaidia.min.css";
import "highlight.js/styles/base16/tomorrow.min.css";

import remarkLuoguFlavor from "@luogu-discussion-archive/remark-lda-lfm";
import rehypePrism from "rehype-prism-plus";
import rehypeHighlight from "rehype-highlight";

import { MutableRefObject, useEffect, useRef, useState } from "react";

Expand Down Expand Up @@ -82,11 +82,11 @@ function Tooltip({

export default function Content({
content,
discussionAuthor: postAuthor,
postAuthor,
userMentionedState,
}: {
content: string;
discussionAuthor: number;
postAuthor: number;
// eslint-disable-next-line react/require-default-props
userMentionedState?: [number | null, (uid: number | null) => void];
}) {
Expand Down Expand Up @@ -171,7 +171,7 @@ export default function Content({
ref={contentRef}
>
<Markdown
rehypePlugins={[rehypeKatex, rehypePrism]}
rehypePlugins={[rehypeKatex, rehypeHighlight]}
remarkPlugins={[
[remarkMath, {}],
[remarkLuoguFlavor, { userLinkPointToLuogu: false }],
Expand Down
2 changes: 1 addition & 1 deletion packages/viewer/src/components/replies/ContextViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default function ContextViewer({
</span>
)}
<Content
discussionAuthor={discussionAuthor}
postAuthor={discussionAuthor}
content={data!.reply.snapshots[0].content}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/viewer/src/components/replies/Reply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default function Reply({
<div className="reply-content pe-4 py-2 position-relative">
{children}
<Content
discussionAuthor={post.authorId}
postAuthor={post.authorId}
content={snapshot.content}
userMentionedState={[userId, setUserId]}
key={userId}
Expand Down
Loading