Files
SCM-Manager/scm-ui/src/repos/branches/components/BranchDetailTable.js

56 lines
1.3 KiB
JavaScript
Raw Normal View History

//@flow
import React from "react";
import type { Repository, Branch } from "@scm-manager/ui-types";
import { translate } from "react-i18next";
import BranchButtonGroup from "./BranchButtonGroup";
type Props = {
repository: Repository,
branch: Branch,
// context props
t: string => string
};
class BranchDetailTable extends React.Component<Props> {
render() {
const { repository, branch, t } = this.props;
2019-04-01 13:47:41 +02:00
return (
<table className="table">
<tbody>
<tr>
<th>{t("branch.name")}</th>
2019-04-01 13:47:41 +02:00
<td>
{branch.name} {this.renderDefaultBranch()}
</td>
</tr>
<tr>
<th>
{t("branch.repository")}
</th>
<td>{repository.name}</td>
</tr>
<tr>
<th>{t("branch.actions")}</th>
2019-04-01 13:47:41 +02:00
<td>
<BranchButtonGroup repository={repository} branch={branch} />
</td>
</tr>
</tbody>
</table>
);
}
2019-04-01 13:47:41 +02:00
renderDefaultBranch() {
const { branch } = this.props;
let defaultLabel = null;
if (branch.defaultBranch) {
defaultLabel = <span className="tag is-dark">Default</span>;
}
return defaultLabel;
}
}
export default translate("repos")(BranchDetailTable);