diff --git a/moon/apps/web/components/CodeView/CodeTable.tsx b/moon/apps/web/components/CodeView/CodeTable.tsx
index 6b26fb472..76c91b231 100644
--- a/moon/apps/web/components/CodeView/CodeTable.tsx
+++ b/moon/apps/web/components/CodeView/CodeTable.tsx
@@ -20,7 +20,7 @@ export interface DataType {
date: number
}
-const CodeTable = ({ directory, readmeContent }: any) => {
+const CodeTable = ({ directory, readmeContent, loading }: any) => {
const router = useRouter()
const pathname = usePathname()
let real_path = pathname?.replace('/tree', '')
@@ -94,7 +94,14 @@ const CodeTable = ({ directory, readmeContent }: any) => {
return (
-
+
{readmeContent && (
diff --git a/moon/apps/web/components/CodeView/Table/index.tsx b/moon/apps/web/components/CodeView/Table/index.tsx
index 330a1e150..f59a63298 100644
--- a/moon/apps/web/components/CodeView/Table/index.tsx
+++ b/moon/apps/web/components/CodeView/Table/index.tsx
@@ -1,4 +1,4 @@
-import { Table } from '@radix-ui/themes'
+import { Spinner, Table } from '@radix-ui/themes'
import { columnsType, DirectoryType } from './type'
@@ -8,7 +8,8 @@ const table =
({
size,
align,
justify,
- onClick
+ onClick,
+ loading = false
}: {
columns: columnsType[]
datasource: T[]
@@ -16,45 +17,46 @@ const table = ({
align?: 'center' | 'start' | 'end' | undefined
justify?: 'center' | 'start' | 'end' | undefined
onClick?: (record: T) => void
+ loading?: boolean
}) => {
return (
<>
-
-
-
- {columns.map((c) => (
- <>
- {c.title}
- >
- ))}
-
-
+
+
+
+
+ {columns.map((c) => (
+ {c.title}
+ ))}
+
+
-
- {datasource.map((d) => {
- if (d) {
- return (
-
- {columns.map((c, index) => (
- {
- e.stopPropagation()
- onClick?.(d)
- }}
- justify={justify}
- key={c.key}
- >
- {c.render ? c.render(c.dataIndex[0], d, index) : null}
-
- ))}
-
- )
- } else {
- return null
- }
- })}
-
-
+
+ {datasource.map((d) => {
+ if (d) {
+ return (
+
+ {columns.map((c, index) => (
+ {
+ e.stopPropagation()
+ onClick?.(d)
+ }}
+ justify={justify}
+ key={c.key + d.oid}
+ >
+ {c.render ? c.render(c.dataIndex[0], d, index) : null}
+
+ ))}
+
+ )
+ } else {
+ return null
+ }
+ })}
+
+
+
>
)
}
diff --git a/moon/apps/web/components/CodeView/TableWithLoading/index.tsx b/moon/apps/web/components/CodeView/TableWithLoading/index.tsx
new file mode 100644
index 000000000..157634840
--- /dev/null
+++ b/moon/apps/web/components/CodeView/TableWithLoading/index.tsx
@@ -0,0 +1,19 @@
+import { LoadingSpinner } from '@gitmono/ui'
+
+import CodeTable from '../CodeTable'
+
+const SpinnerTable = ({ isLoading, datasource, content }: any) => {
+ return (
+
+ {isLoading ? (
+
+
+
+ ) : (
+
+ )}
+
+ )
+}
+
+export default SpinnerTable
diff --git a/moon/apps/web/components/CodeView/index.tsx b/moon/apps/web/components/CodeView/index.tsx
index deabcd4de..ad37c5317 100644
--- a/moon/apps/web/components/CodeView/index.tsx
+++ b/moon/apps/web/components/CodeView/index.tsx
@@ -1,11 +1,12 @@
'use client'
import { useCallback, useEffect, useMemo, useState } from 'react'
+
import { CommonResultVecTreeCommitItem } from '@gitmono/types/generated'
import { useGetTreeCommitInfo } from '@/hooks/useGetTreeCommitInfo'
-import CodeTable from './CodeTable'
+import SpinnerTable from './TableWithLoading'
export default function CodeView() {
const { data: TreeCommitInfo } = useGetTreeCommitInfo('/')
@@ -31,11 +32,7 @@ export default function CodeView() {
fetchData()
}, [fetchData])
- return (
-
-
-
- )
+ return
}
async function getReadmeContent(pathname: string, directory: any) {
diff --git a/moon/apps/web/pages/[org]/code/tree/[...path]/index.tsx b/moon/apps/web/pages/[org]/code/tree/[...path]/index.tsx
index 62c91001f..318b1852f 100644
--- a/moon/apps/web/pages/[org]/code/tree/[...path]/index.tsx
+++ b/moon/apps/web/pages/[org]/code/tree/[...path]/index.tsx
@@ -1,11 +1,13 @@
'use client'
import React, { useEffect, useMemo, useState } from 'react'
-import { CommonResultVecTreeCommitItem } from '@gitmono/types/generated'
import { Theme } from '@radix-ui/themes'
import { Flex, Layout } from 'antd'
import { useParams } from 'next/navigation'
+import { CommonResultVecTreeCommitItem } from '@gitmono/types/generated'
+import { LoadingSpinner } from '@gitmono/ui'
+
import CodeTable from '@/components/CodeView/CodeTable'
import Bread from '@/components/CodeView/TreeView/BreadCrumb'
import CloneTabs from '@/components/CodeView/TreeView/CloneTabs'
@@ -71,25 +73,30 @@ function TreeDetailPage() {
}
return (
-
-
+
+ {!TreeCommitInfo ? (
+
+
+
+ ) : (
+
-
- {
- canClone?.data &&
-
-
-
- }
+
+ {canClone?.data && (
+
+
+
+ )}
- {/* tree */}
+ {/* tree */}
-
+
-
+
-
+
+ )}
)
}