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
2 changes: 1 addition & 1 deletion moon/apps/web/components/CodeView/BlobView/CodeContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'github-markdown-css/github-markdown-light.css';
import styles from './CodeContent.module.css';

const suffixToLangMap: Record<string, string> = {
'.js': 'jsx',
'.jsx': 'jsx',
'.tsx': 'tsx',
'.kt': 'kotlin',
Expand Down Expand Up @@ -186,7 +187,6 @@ const CodeContent = ({ fileContent, path }: { fileContent: string, path?: string
<button className={styles.toolbarRightButton}>Edit</button>
</div>
</div>
{/*todo: Dynamic support for language types*/}
<Highlight theme={themes.github} code={fileContent} language={getLangFromFileName(filename)}>
{({ style, tokens, getLineProps, getTokenProps }) => (
<pre
Expand Down
62 changes: 0 additions & 62 deletions moon/apps/web/pages/[org]/code/blob/[...path].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { AppLayout } from '@/components/Layout/AppLayout'
import AuthAppProviders from '@/components/Providers/AuthAppProviders'
import { useGetBlob } from '@/hooks/useGetBlob'
import { useRouter } from 'next/router'
import { CommentSection } from '@/components/CodeView/BlobView/CommentSection'
import CommitHistory, { CommitInfo } from '@/components/CodeView/CommitHistory'
import RepoTree from '@/components/CodeView/TreeView/RepoTree'
import { CommonResultVecTreeCommitItem } from '@gitmono/types/generated'
Expand All @@ -27,57 +26,10 @@ const treeStyle = {
background: '#fff'
}

interface Comment {
id: string
content: string
author: {
id: string
name: string
avatar?: string
}
createdAt: Date
replies?: Comment[]
}

function BlobPage() {
const { path = [] } = useRouter().query as { path?: string[] }
const new_path = '/' + path.join('/')
const fileContent = useGetBlob({ path: new_path }).data?.data?? ""
const mockComments: Comment[] = [
{
id: '1',
content: '这段代码逻辑很清晰,建议可以添加一些错误处理。',
author: {
id: '1',
name: '张三',
avatar: ''
},
createdAt: new Date('2024-12-01 10:30:00'),
replies: []
},
{
id: '2',
content: '同意。',
author: {
id: '2',
name: '李四',
avatar: ''
},
createdAt: new Date('2024-12-01 10:30:00'),
replies: [
{
id: '3',
content: '好的,收到。',
author: {
id: '3',
name: '王五',
avatar: ''
},
createdAt: new Date('2024-12-01 10:30:00')
}
]
}
]
const commitInfo: CommitInfo = {
user: {
avatar_url: 'https://avatars.githubusercontent.com/u/112836202?v=4&size=40',
Expand Down Expand Up @@ -105,16 +57,6 @@ function BlobPage() {
return directory.filter(item => item.name === currentFileName);
}, [directory, new_path]);


const handleAddComment = (__content: string, __lineNumber?: number) => {
//wait for complete
}

const handleReplyComment = (__commentId: string, __content: string) => {
//wait for complete
}


return (
<div style={{overflow: 'auto'}}>
<Flex vertical gap='middle'>
Expand All @@ -135,10 +77,6 @@ function BlobPage() {
<Layout style={codeStyle}>
<CodeContent fileContent={fileContent} path={path} />
</Layout>
<Layout>
{/* @ts-ignore */}
<CommentSection comments={mockComments} onAddComment={handleAddComment} onReplyComment={handleReplyComment} />
</Layout>
</Flex>
</Layout>
</Flex>
Expand Down