diff --git a/moon/apps/web/components/CodeView/TreeView/BreadCrumb.tsx b/moon/apps/web/components/CodeView/TreeView/BreadCrumb.tsx index d6cd35cd6..ec8ff5b69 100644 --- a/moon/apps/web/components/CodeView/TreeView/BreadCrumb.tsx +++ b/moon/apps/web/components/CodeView/TreeView/BreadCrumb.tsx @@ -1,29 +1,47 @@ +import React from 'react'; import 'github-markdown-css/github-markdown-light.css' -import { Breadcrumb } from 'antd' import { useRouter } from 'next/router'; +import { BreadcrumbLabel } from '@/components/Titlebar/BreadcrumbTitlebar' +import { Link } from '@gitmono/ui' +import { UrlObject } from 'url'; const Bread = ({ path }:any) => { const router = useRouter(); const scope = router.query.org as string - const breadCrumbItems = path?.map((sub_path: any, index: number) => { - if (index == path?.length - 1) { - return { - title: sub_path, - }; - } else { - const href = `/${scope}/code/tree/${path?.slice(0, index + 1).join('/')}`; + const breadCrumbItems = path?.map((subPath: any, index: number) => { + const href = `/${scope}/code/tree/${path.slice(0, index + 1).join('/')}`; - return { - title: sub_path, - href: href, - }; - } - }); + return { + title: subPath, + href: href, + isLast: index === path.length - 1, + }; + }); return ( -
- +
+ + {breadCrumbItems?.map((item: { isLast: any; title: string; href: string | UrlObject; }, index: number) => ( + + {/* displayed after the home item and before non-last items */} + {index > 0 && ( + / + )} + {/* Current breadcrumb item */} + {item.isLast ? ( + // last item + + {item?.title} + + ) : ( + // middle item + + {item?.title} + + )} + +))}
); }; diff --git a/moon/apps/web/components/CodeView/TreeView/CloneTabs.tsx b/moon/apps/web/components/CodeView/TreeView/CloneTabs.tsx index fe277d400..e7a0b66c4 100644 --- a/moon/apps/web/components/CodeView/TreeView/CloneTabs.tsx +++ b/moon/apps/web/components/CodeView/TreeView/CloneTabs.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useState } from 'react'; import { Tabs, TabsProps, Button, Space, Popover, Input } from 'antd'; import copy from 'copy-to-clipboard'; -import {CopyIcon, AlarmCheckIcon, DownloadIcon} from '@gitmono/ui/Icons' -// import { CopyOutlined, CheckOutlined, DownloadOutlined } from '@ant-design/icons'; +import {CopyIcon, DownloadIcon} from '@gitmono/ui/Icons' +import { CheckOutlined, } from '@ant-design/icons'; import { usePathname } from 'next/navigation'; @@ -43,7 +43,7 @@ const CloneTabs = ({ endpoint }:any) => { children: -