-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
719 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use client' | ||
import CodeContent from '@/components/CodeContent'; | ||
import Bread from '@/components/BreadCrumb'; | ||
import { useSearchParams } from 'next/navigation'; | ||
import { useBlobContent } from '../api/fetcher'; | ||
import { Skeleton } from "antd/lib"; | ||
|
||
|
||
export default function BlobPage() { | ||
const searchParams = useSearchParams(); | ||
const path = searchParams.get('path'); | ||
|
||
const { blob, isBlobLoading, isBlobError } = useBlobContent(`${path}`); | ||
if (isBlobLoading) return <Skeleton />; | ||
|
||
return ( | ||
<div> | ||
<Bread path={path} /> | ||
<CodeContent fileContent={blob.data} /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
'use client' | ||
|
||
import CodeTable from '@/components/CodeTable' | ||
import Bread from '@/components/BreadCrumb' | ||
import RepoTree from '@/components/RepoTree' | ||
import { useBlobContent, useTreeCommitInfo } from '@/app/api/fetcher' | ||
import { useSearchParams } from 'next/navigation'; | ||
import { Skeleton, Flex, Layout } from "antd/lib"; | ||
|
||
|
||
export default function Page() { | ||
const searchParams = useSearchParams(); | ||
const path = searchParams.get('path'); | ||
const { tree, isTreeLoading, isTreeError } = useTreeCommitInfo(path); | ||
const { blob, isBlobLoading, isBlobError } = useBlobContent(`${path}/README.md`); | ||
if (isTreeLoading || isBlobLoading) return <Skeleton />; | ||
|
||
const treeStyle = { | ||
borderRadius: 8, | ||
overflow: 'hidden', | ||
width: 'calc(20% - 8px)', | ||
maxWidth: 'calc(20% - 8px)', | ||
background: '#fff', | ||
}; | ||
|
||
const codeStyle = { | ||
borderRadius: 8, | ||
overflow: 'hidden', | ||
width: 'calc(80% - 8px)', | ||
background: '#fff', | ||
}; | ||
|
||
const breadStyle = { | ||
minHeight: 30, | ||
borderRadius: 8, | ||
overflow: 'hidden', | ||
width: 'calc(100% - 8px)', | ||
background: '#fff', | ||
}; | ||
|
||
return ( | ||
<Flex gap="middle" wrap> | ||
<Layout style={breadStyle}> | ||
<Bread path={path} /> | ||
</Layout> | ||
<Layout style={treeStyle}> | ||
<RepoTree directory={tree.data} /> | ||
</Layout> | ||
<Layout style={codeStyle}> | ||
<CodeTable directory={tree.data} readmeContent={blob.data} /> | ||
</Layout> | ||
</Flex> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.breadCrumb { | ||
width: 80%; | ||
margin-left: 18%; | ||
margin-top: 20px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'github-markdown-css/github-markdown-light.css' | ||
import { useRouter } from 'next/navigation' | ||
import { Breadcrumb } from 'antd/lib' | ||
import styles from './BreadCrumb.module.css' | ||
|
||
const Bread = ({ path }) => { | ||
const router = useRouter(); | ||
let path_arr = path.split('/').filter(Boolean); | ||
|
||
const breadCrumbItems = path_arr.map((path, index) => { | ||
if (index == path_arr.length - 1) { | ||
return { | ||
title: path, | ||
}; | ||
} else { | ||
const href = '/tree?path=/' + path_arr.slice(0, index + 1).join('/'); | ||
return { | ||
title: path, | ||
href: href, | ||
}; | ||
} | ||
|
||
}); | ||
|
||
return ( | ||
<Breadcrumb className={styles.breadCrumb} | ||
items={breadCrumbItems} | ||
/> | ||
); | ||
}; | ||
|
||
export default Bread; |
Oops, something went wrong.