Skip to content

Commit 6b4227d

Browse files
authored
feat: add Bazel system-file syntax highlighting and optimize list-page layout (#1610)
- enable Python syntax highlighting for .bzl extension - recognize config files: .bazelrc, .buckconfig, .buckversion - remove max-width constraint on Issue and CL list pages, switch to responsive layout - enrich file-commit details
1 parent 1103bb1 commit 6b4227d

File tree

6 files changed

+40
-25
lines changed

6 files changed

+40
-25
lines changed

moon/apps/web/components/ClView/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,10 @@ export default function CLView() {
494494
<Heading>Change List</Heading>
495495
<br />
496496
<IndexPageContainer>
497-
<IndexPageContent id='/[org]/cl' className={cn('@container', '3xl:max-w-7xl max-w-7xl')}>
497+
<IndexPageContent
498+
id='/[org]/cl'
499+
className={cn('@container', 'max-w-full lg:max-w-5xl xl:max-w-6xl 2xl:max-w-7xl')}
500+
>
498501
<div className='flex h-full flex-col'>
499502
<div className='mb-4'>
500503
<div className='group flex min-h-[42px] items-center gap-2 rounded-md border border-gray-300 bg-white px-3 py-2 shadow-sm transition-all focus-within:border-blue-500 focus-within:shadow-md focus-within:ring-2 focus-within:ring-blue-100 hover:border-gray-400'>

moon/apps/web/components/CodeView/CommitHistory.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { MemberHovercard } from '@/components/InlinePost/MemberHovercard'
88
import { useGetLatestCommit } from '@/hooks/useGetLatestCommit'
99
import { useGetOrganizationMember } from '@/hooks/useGetOrganizationMember'
1010

11-
import CommitDetails from './CommitDetails'
12-
1311
const CommitHyStyle = {
1412
width: '100%',
1513
background: '#fff',
@@ -78,7 +76,14 @@ export default function CommitHistory({ flag, path, refs }: CommitHistoryProps)
7876
</Button>
7977
</Flex>
8078
</div>
81-
{Expand && <CommitDetails />}
79+
80+
{Expand && commitData && (
81+
<p className='ml-4 text-neutral-500'>
82+
Signed-off-by: {commitData.author} {'<'}
83+
{memberData?.user?.email}
84+
{'>'}
85+
</p>
86+
)}
8287
</>
8388
)
8489
}

moon/apps/web/components/Issues/IssueIndex.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ export const IssueIndex = () => {
4444
<BreadcrumbTitlebar className='justify-between'>
4545
<IssueBreadcrumbIcon />
4646
</BreadcrumbTitlebar>
47-
<IndexPageContent id='/[org]/issue' className={cn('@container', '3xl:max-w-7xl max-w-7xl')}>
47+
<IndexPageContent
48+
id='/[org]/issue'
49+
className={cn('@container', 'max-w-full lg:max-w-5xl xl:max-w-6xl 2xl:max-w-7xl')}
50+
>
4851
<IssueSearch filterQuery={filterQuery} onClearFilters={handleClearFilters} />
49-
<IssuesContent
50-
searching={isSearching}
52+
<IssuesContent
53+
searching={isSearching}
5154
setFilterQuery={setFilterQuery}
5255
onRegisterClearFilters={setOnClearFilters}
5356
/>
@@ -129,4 +132,4 @@ export function IssueIndexEmptyState() {
129132
</div>
130133
</IndexPageEmptyState>
131134
)
132-
}
135+
}

moon/apps/web/components/Issues/IssueList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function IssueList<T>({
4040
return (
4141
<>
4242
{!isDark ? (
43-
<div className='max-h-[600px] overflow-auto rounded-md border border-[#d0d7de]'>
43+
<div className='overflow-auto rounded-md border border-[#d0d7de]'>
4444
{header}
4545

4646
{isLoading ? (

moon/apps/web/components/Issues/Pagenation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const Pagination = <T extends number>({ totalNum, pageSize, onChange, cur
3434
}, [current, totalPages])
3535
return (
3636
<>
37-
<BreadcrumbTitlebar className='h-auto justify-center gap-2 border-b-transparent'>
37+
<BreadcrumbTitlebar className='h-auto justify-center gap-2 border-b-transparent pt-1'>
3838
{current === 1 ? (
3939
<PreviousOrNext isNext={false} disabled={true} color='text-[#818b98]' />
4040
) : (

moon/apps/web/utils/getLanguageDetection.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use client'
22

3-
43
export const LANGUAGE_MAP: Record<string, string> = {
54
'.js': 'javascript',
65
'.mjs': 'javascript',
@@ -83,31 +82,37 @@ export const LANGUAGE_MAP: Record<string, string> = {
8382
'.babelrc': 'json',
8483
'.editorconfig': 'ini',
8584
'.buckconfig': 'toml',
86-
'.swcrc': 'json',
85+
'.swcrc': 'json'
8786
}
8887

89-
9088
export const SPECIAL_FILE_MAP: Record<string, string> = {
91-
'dockerfile': 'dockerfile',
92-
'rakefile': 'ruby',
93-
'gemfile': 'ruby',
94-
'podfile': 'ruby',
95-
'fastfile': 'ruby',
96-
'cartfile': 'swift',
89+
dockerfile: 'dockerfile',
90+
rakefile: 'ruby',
91+
gemfile: 'ruby',
92+
podfile: 'ruby',
93+
fastfile: 'ruby',
94+
cartfile: 'swift',
9795
'package.json': 'json',
9896
'tsconfig.json': 'json',
9997
'composer.json': 'json',
10098
'pom.xml': 'xml',
10199
'build.gradle': 'groovy',
102100
'settings.gradle': 'groovy',
103-
'buck': 'python',
104-
'makefile': 'makefile',
101+
buck: 'python',
102+
bzl: 'python',
103+
build: 'python',
104+
workspace: 'python',
105+
'workspace.bazel': 'python',
106+
'build.bazel': 'python',
107+
'.bazelrc': 'ini',
108+
'.buckconfig': 'toml',
109+
'.buckversion': 'text',
110+
makefile: 'makefile',
105111
'makefile.linux': 'makefile',
106112
'makefile.win': 'makefile',
107-
'makefile.mac': 'makefile',
113+
'makefile.mac': 'makefile'
108114
}
109115

110-
111116
export const COMPOUND_EXTENSIONS: Record<string, string> = {
112117
'.d.ts': 'typescript',
113118
'.spec.js': 'javascript',
@@ -150,10 +155,9 @@ export const COMPOUND_EXTENSIONS: Record<string, string> = {
150155
'vitest.config.json': 'json',
151156
'vitest.config.yaml': 'yaml',
152157
'vitest.config.yml': 'yaml',
153-
'vitest.config.toml': 'toml',
158+
'vitest.config.toml': 'toml'
154159
}
155160

156-
157161
export function getLangFromFileName(fileName: string): string {
158162
if (!fileName) return 'text'
159163
const lowerFileName = fileName.toLowerCase()

0 commit comments

Comments
 (0)