File tree Expand file tree Collapse file tree 2 files changed +42
-22
lines changed
src/app/[ownerSlug]/[repoSlug] Expand file tree Collapse file tree 2 files changed +42
-22
lines changed Original file line number Diff line number Diff line change
1
+ import { RepoCard } from '@/components/RepoCard'
2
+ import { FetchRepoService } from '@/service/get-db'
3
+ import { MarkdownContent } from '@/components/MarkdownContent'
4
+ import { notFound } from 'next/navigation'
5
+ import { formatToMarkdown } from '@/app/[ownerSlug]/[repoSlug]/formatter'
6
+
7
+ interface RepositorySummarizationContentProps {
8
+ owner : string
9
+ repo : string
10
+ }
11
+
12
+ export default async function RepositorySummarizationContent ( {
13
+ owner,
14
+ repo,
15
+ } : RepositorySummarizationContentProps ) {
16
+ const fetchRepoService = new FetchRepoService ( )
17
+ const repoDetails = await fetchRepoService . getFullRepositoryTree (
18
+ owner ,
19
+ repo
20
+ )
21
+
22
+ if ( ! repoDetails ) {
23
+ notFound ( )
24
+ }
25
+
26
+ return (
27
+ < >
28
+ < div className = "flex-1" >
29
+ < MarkdownContent content = { formatToMarkdown ( repoDetails ) } />
30
+ </ div >
31
+ < div className = "w-[300px]" >
32
+ < RepoCard repoInfo = { repoDetails . repository } />
33
+ </ div >
34
+ </ >
35
+ )
36
+ }
Original file line number Diff line number Diff line change 1
1
import { JSX , Suspense } from 'react'
2
- import { RepoCard } from '@/components/RepoCard'
3
- import { FetchRepoService } from '@/service/get-db'
4
- import { MarkdownContent } from '@/components/MarkdownContent'
5
- import { notFound } from 'next/navigation'
6
- import { formatToMarkdown } from '@/app/[ownerSlug]/[repoSlug]/formatter'
7
2
import Loading from '@/app/[ownerSlug]/[repoSlug]/loading'
3
+ import RepositorySummarizationContent from '@/app/[ownerSlug]/[repoSlug]/contents' ;
8
4
9
- // Define the correct page props type for Next.js 13+
10
5
interface PageProps {
11
6
params : Promise < { ownerSlug : string ; repoSlug : string } >
12
7
}
13
8
14
- // Main page component
15
9
export default async function Page ( {
16
10
params,
17
11
} : PageProps ) : Promise < JSX . Element > {
18
12
const { ownerSlug, repoSlug } = await params
19
13
20
- const fetchRepoService = new FetchRepoService ( )
21
- const repoDetails = await fetchRepoService . getFullRepositoryTree (
22
- ownerSlug ,
23
- repoSlug
24
- )
25
14
26
- if ( ! repoDetails ) {
27
- notFound ( )
28
- }
29
15
30
16
return (
31
17
< div className = "flex gap-6 p-6" >
32
18
< Suspense fallback = { < Loading /> } >
33
- < div className = "flex-1" >
34
- < MarkdownContent content = { formatToMarkdown ( repoDetails ) } />
35
- </ div >
36
- < div className = "w-[300px]" >
37
- < RepoCard repoInfo = { repoDetails . repository } />
38
- </ div >
39
- </ Suspense >
19
+ < RepositorySummarizationContent
20
+ owner = { ownerSlug }
21
+ repo = { repoSlug }
22
+ />
23
+ </ Suspense >
40
24
</ div >
41
25
)
42
26
}
You can’t perform that action at this time.
0 commit comments