2019-03-29 13:52:19 +01:00
|
|
|
//@flow
|
|
|
|
|
import React from "react";
|
|
|
|
|
import type { Repository, Branch } from "@scm-manager/ui-types";
|
|
|
|
|
import { ButtonGroup, Button } from "@scm-manager/ui-components";
|
|
|
|
|
import { translate } from "react-i18next";
|
2019-04-02 09:27:34 +02:00
|
|
|
import { createChangesetLink, createSourcesLink } from "../modules/branches";
|
2019-03-29 13:52:19 +01:00
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
repository: Repository,
|
|
|
|
|
branch: Branch,
|
|
|
|
|
|
|
|
|
|
// context props
|
|
|
|
|
t: string => string
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class BranchButtonGroup extends React.Component<Props> {
|
|
|
|
|
render() {
|
|
|
|
|
const { repository, branch, t } = this.props;
|
|
|
|
|
|
2019-04-01 15:25:55 +02:00
|
|
|
const changesetLink = createChangesetLink(repository, branch);
|
|
|
|
|
const sourcesLink = createSourcesLink(repository, branch);
|
2019-03-29 13:52:19 +01:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<ButtonGroup>
|
|
|
|
|
<Button link={changesetLink}>
|
|
|
|
|
<span className="icon">
|
|
|
|
|
<i className="fas fa-exchange-alt" />
|
|
|
|
|
</span>
|
|
|
|
|
<span className="is-hidden-mobile is-hidden-tablet-only">
|
|
|
|
|
{t("branch.commits")}
|
|
|
|
|
</span>
|
|
|
|
|
</Button>
|
|
|
|
|
<Button link={sourcesLink}>
|
|
|
|
|
<span className="icon">
|
|
|
|
|
<i className="fas fa-code" />
|
|
|
|
|
</span>
|
|
|
|
|
<span className="is-hidden-mobile is-hidden-tablet-only">
|
|
|
|
|
{t("branch.sources")}
|
|
|
|
|
</span>
|
|
|
|
|
</Button>
|
|
|
|
|
</ButtonGroup>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default translate("repos")(BranchButtonGroup);
|