2019-10-19 16:38:07 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
import { Repository, Branch } from '@scm-manager/ui-types';
|
|
|
|
|
import { ButtonAddons, Button } from '@scm-manager/ui-components';
|
|
|
|
|
import { translate } from 'react-i18next';
|
2019-03-29 13:52:19 +01:00
|
|
|
|
|
|
|
|
type Props = {
|
2019-10-19 16:38:07 +02:00
|
|
|
repository: Repository;
|
|
|
|
|
branch: Branch;
|
2019-03-29 13:52:19 +01:00
|
|
|
|
|
|
|
|
// context props
|
2019-10-19 16:38:07 +02:00
|
|
|
t: (p: string) => string;
|
2019-03-29 13:52:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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"
|
2019-10-19 16:38:07 +02:00
|
|
|
label={t('branch.commits')}
|
2019-09-25 17:25:13 +02:00
|
|
|
reducedMobile={true}
|
|
|
|
|
/>
|
|
|
|
|
<Button
|
|
|
|
|
link={sourcesLink}
|
|
|
|
|
icon="code"
|
2019-10-19 16:38:07 +02:00
|
|
|
label={t('branch.sources')}
|
2019-09-25 17:25:13 +02:00
|
|
|
reducedMobile={true}
|
|
|
|
|
/>
|
2019-06-20 14:57:00 +02:00
|
|
|
</ButtonAddons>
|
2019-03-29 13:52:19 +01:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-19 16:38:07 +02:00
|
|
|
export default translate('repos')(BranchButtonGroup);
|