2019-03-29 13:52:19 +01:00
|
|
|
//@flow
|
|
|
|
|
import React from "react";
|
|
|
|
|
import type { Repository, Branch } from "@scm-manager/ui-types";
|
2019-06-20 14:57:00 +02:00
|
|
|
import { ButtonAddons, Button } from "@scm-manager/ui-components";
|
2019-03-29 13:52:19 +01:00
|
|
|
import { translate } from "react-i18next";
|
|
|
|
|
|
|
|
|
|
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-03 10:11:43 +02:00
|
|
|
const changesetLink = `/repo/${repository.namespace}/${
|
|
|
|
|
repository.name
|
|
|
|
|
}/branch/${encodeURIComponent(branch.name)}/changesets/`;
|
|
|
|
|
const sourcesLink = `/repo/${repository.namespace}/${
|
|
|
|
|
repository.name
|
|
|
|
|
}/sources/${encodeURIComponent(branch.name)}/`;
|
2019-03-29 13:52:19 +01:00
|
|
|
|
|
|
|
|
return (
|
2019-06-20 14:57:00 +02:00
|
|
|
<ButtonAddons>
|
2019-09-25 17:25:13 +02:00
|
|
|
<Button
|
|
|
|
|
link={changesetLink}
|
|
|
|
|
icon="exchange-alt"
|
|
|
|
|
label={t("branch.commits")}
|
|
|
|
|
reducedMobile={true}
|
|
|
|
|
/>
|
|
|
|
|
<Button
|
|
|
|
|
link={sourcesLink}
|
|
|
|
|
icon="code"
|
|
|
|
|
label={t("branch.sources")}
|
|
|
|
|
reducedMobile={true}
|
|
|
|
|
/>
|
2019-06-20 14:57:00 +02:00
|
|
|
</ButtonAddons>
|
2019-03-29 13:52:19 +01:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default translate("repos")(BranchButtonGroup);
|