Skip to content

Commit a42936a

Browse files
awesomeYGawesomeYG
andauthored
refactor: remove DetailLayout component and clean up related code (#58)
- Deleted the DetailLayout component from the project. - Updated TitleCard and EditorContent components to remove unused props and added console logs for debugging. - Minor formatting adjustments in TitleCard for consistency. Co-authored-by: awesomeYG <gang.yang@chaitin.com>
1 parent 67f7a19 commit a42936a

File tree

4 files changed

+5
-68
lines changed

4 files changed

+5
-68
lines changed

ui/front/src/app/[route_name]/[id]/ui/detailLayout.tsx

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

ui/front/src/app/[route_name]/[id]/ui/titleCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const animationStyles = `
5757
dayjs.extend(relativeTime)
5858
dayjs.locale('zh-cn')
5959

60-
const TitleCard = ({ data }: { data: ModelDiscussionDetail }) => {
60+
const TitleCard = ({ data }: { data: ModelDiscussionDetail}) => {
6161
const [menuVisible, { setFalse: menuClose, setTrue: menuOpen }] = useBoolean(false)
6262
const { user } = useContext(AuthContext)
6363
const [releaseVisible, { setFalse: releaseClose, setTrue: releaseOpen }] = useBoolean(false)
@@ -371,7 +371,7 @@ const TitleCard = ({ data }: { data: ModelDiscussionDetail }) => {
371371
</Stack>
372372
</Stack>
373373
<Divider sx={{ mt: 2, mb: 1 }} />
374-
<EditorContent content={data.content} onTocUpdate={() => {}} />
374+
<EditorContent content={data.content} onTocUpdate={()=>{}} />
375375

376376
{/* 回答/回复/评论 按钮 */}
377377
<Box sx={{ mt: 1, pt: 1 }}>

ui/front/src/components/EditorContent.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const ContentSkeleton: React.FC = () => {
2525
}
2626

2727
const EditorContent: React.FC<MarkDownProps> = (props) => {
28-
const { content = '', sx, truncateLength = 0, onTocUpdate, autoFocus = true } = props
28+
const { content = '', sx, truncateLength = 0, onTocUpdate } = props
2929
const [isMounted, setIsMounted] = useState(false)
3030

3131
const isHTML = /<[^>]+>/.test(content)
@@ -69,6 +69,7 @@ const EditorContent: React.FC<MarkDownProps> = (props) => {
6969
immediatelyRender: false,
7070
// 大纲更新回调:透传给父级,同时广播全局事件供兄弟侧栏使用
7171
onTocUpdate: (toc: any) => {
72+
console.log(toc, onTocUpdate)
7273
const enabled = !!onTocUpdate
7374
if (!enabled) return
7475
try {

ui/front/src/components/Toc.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const HeadingSx = [
2424

2525
const Toc = ({ headings }: TocProps) => {
2626
const levels = Array.from(new Set(headings.map((it) => it.level).sort((a, b) => a - b))).slice(0, 3)
27-
27+
console.log(headings)
2828
return (
2929
<>
3030
<Stack

0 commit comments

Comments
 (0)