-
Notifications
You must be signed in to change notification settings - Fork 122
Add page scrolling, display README files, and show commit history. #1138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bb23f6f
fc7ce35
7926244
34cd2fa
48408ee
851b3e3
25951e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import React from 'react'; | ||
|
|
||
| const CommitDetails = () => { | ||
|
|
||
| return ( | ||
| <div> | ||
| CommitDetails <br/> | ||
| CommitDetails <br/> | ||
| CommitDetails <br/> | ||
| CommitDetails <br/> | ||
| CommitDetails <br/> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default CommitDetails; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,8 +2,8 @@ import React, { useEffect, useState } from 'react' | |||||
| import { Button, Input, Popover, Space, Tabs, TabsProps } from 'antd' | ||||||
| import copy from 'copy-to-clipboard' | ||||||
| import { usePathname } from 'next/navigation' | ||||||
|
|
||||||
| import { CheckIcon, CopyIcon, DownloadIcon } from '@gitmono/ui/Icons' | ||||||
| import {LEGACY_API_URL} from '@gitmono/config' | ||||||
|
|
||||||
| const CloneTabs = ({ endpoint }: any) => { | ||||||
|
||||||
| const CloneTabs = ({ endpoint }: any) => { | |
| const CloneTabs = () => { |
Copilot
AI
Jun 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path replacement is hardcoded to '/myorganization/code/tree/'. Consider deriving the org and repo dynamically from route params to support multiple orgs.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1,22 @@ | ||
| 'use client' | ||
|
|
||
| import { useCallback, useEffect, useMemo, useState } from 'react' | ||
| import { useMemo } from 'react' | ||
|
|
||
| import { CommonResultVecTreeCommitItem } from '@gitmono/types/generated' | ||
|
|
||
| import { useGetTreeCommitInfo } from '@/hooks/useGetTreeCommitInfo' | ||
|
|
||
| import SpinnerTable from './TableWithLoading' | ||
| import { useGetBlob } from '@/hooks/useGetBlob' | ||
|
|
||
| export default function CodeView() { | ||
| const { data: TreeCommitInfo } = useGetTreeCommitInfo('/') | ||
|
|
||
| type DirectoryType = NonNullable<CommonResultVecTreeCommitItem['data']> | ||
| const directory: DirectoryType = useMemo(() => TreeCommitInfo?.data ?? [], [TreeCommitInfo]) | ||
|
|
||
| const [readmeContent, setReadmeContent] = useState('') | ||
| const reqPath = `/README.md` | ||
| const {data: readmeContent} = useGetBlob({path:reqPath}) | ||
|
|
||
| const fetchData = useCallback(async () => { | ||
| if (directory.length === 0) return | ||
|
|
||
| try { | ||
| const content = await getReadmeContent('/', directory) | ||
|
|
||
| setReadmeContent(content) | ||
| } catch (error) { | ||
| // console.error('Error fetching data:', error); | ||
| } | ||
| }, [directory]) | ||
|
|
||
| useEffect(() => { | ||
| fetchData() | ||
| }, [fetchData]) | ||
|
|
||
| return <SpinnerTable isLoading={!TreeCommitInfo} datasource={directory} content={readmeContent} /> | ||
| } | ||
|
|
||
| async function getReadmeContent(pathname: string, directory: any) { | ||
| let readmeContent = '' | ||
|
|
||
| for (const project of directory || []) { | ||
| if (project.name === 'README.md' && project.content_type === 'file') { | ||
| const res = await fetch(`/api/blob?path=${pathname}/README.md`) | ||
| const response = await res.json() | ||
|
|
||
| readmeContent = response.data.data | ||
| break | ||
| } | ||
| } | ||
| return readmeContent | ||
| return <SpinnerTable isLoading={!TreeCommitInfo} datasource={directory} content={readmeContent?.data} /> | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] There’s an extra space before the zero in
margin:' 0 auto'. Also consider moving repeated inline styles into a shared CSS or styled component for consistency.