2019-10-20 18:02:52 +02:00
|
|
|
import React from "react";
|
2019-10-23 15:47:08 +02:00
|
|
|
import { WithTranslation, withTranslation } from "react-i18next";
|
2019-10-20 18:02:52 +02:00
|
|
|
import { Repository, Branch } from "@scm-manager/ui-types";
|
|
|
|
|
import { ButtonAddons, Button } from "@scm-manager/ui-components";
|
2019-03-29 13:52:19 +01:00
|
|
|
|
2019-10-23 15:47:08 +02:00
|
|
|
type Props = WithTranslation & {
|
2019-10-19 16:38:07 +02:00
|
|
|
repository: Repository;
|
|
|
|
|
branch: Branch;
|
2019-03-29 13:52:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class BranchButtonGroup extends React.Component<Props> {
|
|
|
|
|
render() {
|
|
|
|
|
const { repository, branch, t } = this.props;
|
|
|
|
|
|
2019-10-21 10:57:56 +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-10-21 10:57:56 +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
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-23 15:47:08 +02:00
|
|
|
export default withTranslation("repos")(BranchButtonGroup);
|