use reflow to migrate from flow to typescript

This commit is contained in:
Sebastian Sdorra
2019-10-19 16:38:07 +02:00
parent f7b8050dfa
commit 6e7a08a3bb
495 changed files with 14239 additions and 13766 deletions

View File

@@ -0,0 +1,39 @@
import React from 'react';
import { Changeset } from '@scm-manager/ui-types';
import LoadingDiff from '../LoadingDiff';
import Notification from '../../Notification';
import { translate } from 'react-i18next';
type Props = {
changeset: Changeset;
defaultCollapse?: boolean;
// context props
t: (p: string) => string;
};
class ChangesetDiff extends React.Component<Props> {
isDiffSupported(changeset: Changeset) {
return !!changeset._links.diff;
}
createUrl(changeset: Changeset) {
return changeset._links.diff.href + '?format=GIT';
}
render() {
const { changeset, defaultCollapse, t } = this.props;
if (!this.isDiffSupported(changeset)) {
return (
<Notification type="danger">
{t('changeset.diffNotSupported')}
</Notification>
);
} else {
const url = this.createUrl(changeset);
return <LoadingDiff url={url} defaultCollapse={defaultCollapse} />;
}
}
}
export default translate('repos')(ChangesetDiff);