-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
88 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,56 @@ | ||
import { FormControl, InputLabel, MenuItem, Select } from "@mui/material"; | ||
import { match } from "assert"; | ||
import { MenuItem } from "@mui/material"; | ||
|
||
interface HighlightMenuItemProps extends React.ComponentProps<typeof MenuItem>{ | ||
condition: boolean; | ||
customColor?: string; | ||
} | ||
interface HighlightMenuItemProps extends React.ComponentProps<typeof MenuItem> { | ||
condition: boolean; | ||
customColor?: string; | ||
} | ||
|
||
export const DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR = 'yellow'; | ||
export const DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR = "yellow"; | ||
|
||
export const HighlightMenuItem = ({ condition, children, customColor = DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, ...props }: HighlightMenuItemProps) => { | ||
const highlightStyle = { | ||
backgroundColor: customColor?customColor:DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, | ||
}; | ||
return ( | ||
<MenuItem | ||
{...props} | ||
sx={{ | ||
...(condition && highlightStyle), | ||
}} | ||
> | ||
{children} | ||
</MenuItem> | ||
); | ||
export const HighlightMenuItem = ({ | ||
condition, | ||
children, | ||
customColor = DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, | ||
...props | ||
}: HighlightMenuItemProps) => { | ||
const highlightStyle = { | ||
backgroundColor: customColor | ||
? customColor | ||
: DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, | ||
}; | ||
return ( | ||
<MenuItem | ||
{...props} | ||
sx={{ | ||
...(condition && highlightStyle), | ||
}} | ||
> | ||
{children} | ||
</MenuItem> | ||
); | ||
}; | ||
|
||
export function isCommitStringHighlight(commit:string,commits: any[],filenameFilter:string|undefined){ | ||
const matchedCommit = commits.find((c:any) => c.head_sha === commit); | ||
if (!matchedCommit) { | ||
return false; | ||
} | ||
return isCommitHighlight(filenameFilter,matchedCommit); | ||
export function isCommitStringHighlight( | ||
commit: string, | ||
commits: any[], | ||
filenameFilter: string | undefined | ||
) { | ||
const matchedCommit = commits.find((c: any) => c.head_sha === commit); | ||
if (!matchedCommit) { | ||
return false; | ||
} | ||
return isCommitHighlight(filenameFilter, matchedCommit); | ||
} | ||
|
||
export function isCommitHighlight(filenameFilter: string | undefined, commit: any) { | ||
if (filenameFilter === undefined || filenameFilter == "all") { | ||
return false; | ||
} | ||
const found = commit.filenames.filter((f: string) => f.includes(filenameFilter)); | ||
return found.length > 0; | ||
export function isCommitHighlight( | ||
filenameFilter: string | undefined, | ||
commit: any | ||
) { | ||
if (filenameFilter === undefined || filenameFilter == "all") { | ||
return false; | ||
} | ||
const found = commit.filenames.filter((f: string) => | ||
f.includes(filenameFilter) | ||
); | ||
return found.length > 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters