mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
show notification if diff is empty
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import React from "react";
|
||||
import DiffFile from "./DiffFile";
|
||||
import { DiffObjectProps, File } from "./DiffTypes";
|
||||
import Notification from "../Notification";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
|
||||
type Props = DiffObjectProps & {
|
||||
diff: File[];
|
||||
defaultCollapse?: boolean;
|
||||
};
|
||||
type Props = WithTranslation &
|
||||
DiffObjectProps & {
|
||||
diff: File[];
|
||||
defaultCollapse?: boolean;
|
||||
};
|
||||
|
||||
class Diff extends React.Component<Props> {
|
||||
static defaultProps: Partial<Props> = {
|
||||
@@ -13,15 +16,17 @@ class Diff extends React.Component<Props> {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { diff, ...fileProps } = this.props;
|
||||
const { diff, t, ...fileProps } = this.props;
|
||||
return (
|
||||
<>
|
||||
{diff.map((file, index) => (
|
||||
<DiffFile key={index} file={file} {...fileProps} {...this.props} />
|
||||
))}
|
||||
{diff.length === 0 ? (
|
||||
<Notification type="info">{t("noDiffFound")}</Notification>
|
||||
) : (
|
||||
diff.map((file, index) => <DiffFile key={index} file={file} {...fileProps} {...this.props} />)
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Diff;
|
||||
export default withTranslation("plugins")(Diff);
|
||||
|
||||
Reference in New Issue
Block a user