1
1
import React , { useMemo } from 'react'
2
2
3
- import { mdiCog , mdiFileOutline , mdiGlasses , mdiInformationOutline } from '@mdi/js'
3
+ import { mdiCog , mdiFileOutline , mdiSourceCommit , mdiGlasses , mdiInformationOutline } from '@mdi/js'
4
4
import classNames from 'classnames'
5
5
import { escapeRegExp } from 'lodash'
6
6
@@ -14,7 +14,7 @@ import { SearchPatternType, type TreeFields } from '@sourcegraph/shared/src/grap
14
14
import type { PlatformContextProps } from '@sourcegraph/shared/src/platform/context'
15
15
import type { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
16
16
import { buildSearchURLQuery } from '@sourcegraph/shared/src/util/url'
17
- import { Badge , ButtonLink , Card , CardHeader , Icon , Link , Text , Tooltip } from '@sourcegraph/wildcard'
17
+ import { Badge , Button , ButtonLink , Card , CardHeader , Icon , Link , Text , Tooltip } from '@sourcegraph/wildcard'
18
18
19
19
import type { AuthenticatedUser } from '../../auth'
20
20
import {
@@ -45,6 +45,7 @@ import { getRefType } from '../utils'
45
45
46
46
import { FilesCard , ReadmePreviewCard } from './TreePagePanels'
47
47
48
+ import menuStyles from './TreePage.module.scss'
48
49
import styles from './TreePageContent.module.scss'
49
50
import contributorsStyles from './TreePageContentContributors.module.scss'
50
51
import panelStyles from './TreePagePanels.module.scss'
@@ -177,6 +178,25 @@ export const TreePageContent: React.FunctionComponent<React.PropsWithChildren<Tr
177
178
178
179
return (
179
180
< >
181
+ { ! isRoot && (
182
+ < div className = { menuStyles . menu } >
183
+ < Tooltip content = "Git commits" >
184
+ < Button
185
+ className = "flex-shrink-0"
186
+ to = { `/${ encodeURIPathComponent ( repo . name ) } ${
187
+ revision && `@${ encodeURIPathComponent ( revision ) } `
188
+ } /-/commits/${ encodeURIPathComponent ( filePath ) } `}
189
+ variant = "secondary"
190
+ outline = { true }
191
+ as = { Link }
192
+ >
193
+ < Icon aria-hidden = { true } svgPath = { mdiSourceCommit } /> { ' ' }
194
+ < span className = { menuStyles . text } > Commits</ span >
195
+ </ Button >
196
+ </ Tooltip >
197
+ </ div >
198
+ ) }
199
+
180
200
{ ( readmeEntry || isRoot ) && (
181
201
< section className = { classNames ( 'container mb-3 px-0' , styles . section ) } >
182
202
{ readmeEntry && (
@@ -196,7 +216,14 @@ export const TreePageContent: React.FunctionComponent<React.PropsWithChildren<Tr
196
216
) }
197
217
</ section >
198
218
) }
199
- < section className = { classNames ( 'test-tree-entries container mb-3 px-0' , styles . section ) } >
219
+
220
+ < section
221
+ className = { classNames (
222
+ 'test-tree-entries container mb-3 px-0' ,
223
+ styles . section ,
224
+ ! readmeEntry ? 'mt-3' : undefined
225
+ ) }
226
+ >
200
227
< FilesCard historyEntries = { treeWithHistory } entries = { tree . entries } className = { styles . files } />
201
228
202
229
{ ! isPackage && (
0 commit comments