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 { ButtonAddons, Button } from "@scm-manager/ui-components";
|
2018-11-26 15:20:44 +01:00
|
|
|
|
2019-10-23 15:47:08 +02:00
|
|
|
type Props = WithTranslation & {
|
2019-10-19 16:38:07 +02:00
|
|
|
className?: string;
|
|
|
|
|
historyIsSelected: boolean;
|
|
|
|
|
showHistory: (p: boolean) => void;
|
2018-11-26 15:20:44 +01:00
|
|
|
};
|
|
|
|
|
|
2019-10-09 16:17:02 +02:00
|
|
|
class FileButtonAddons extends React.Component<Props> {
|
2018-11-26 15:20:44 +01:00
|
|
|
showHistory = () => {
|
|
|
|
|
this.props.showHistory(true);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
showSources = () => {
|
|
|
|
|
this.props.showHistory(false);
|
|
|
|
|
};
|
|
|
|
|
|
2019-02-07 09:29:53 +01:00
|
|
|
color = (selected: boolean) => {
|
2019-10-20 18:02:52 +02:00
|
|
|
return selected ? "link is-selected" : null;
|
2019-02-07 09:29:53 +01:00
|
|
|
};
|
|
|
|
|
|
2018-11-26 15:20:44 +01:00
|
|
|
render() {
|
2019-10-09 16:17:02 +02:00
|
|
|
const { className, t, historyIsSelected } = this.props;
|
2018-11-26 15:20:44 +01:00
|
|
|
|
|
|
|
|
return (
|
2019-10-09 16:17:02 +02:00
|
|
|
<ButtonAddons className={className}>
|
2019-10-20 18:02:52 +02:00
|
|
|
<div title={t("sources.content.sourcesButton")}>
|
2019-10-21 10:57:56 +02:00
|
|
|
<Button action={this.showSources} className="reduced" color={this.color(!historyIsSelected)}>
|
2019-08-28 09:36:52 +02:00
|
|
|
<span className="icon">
|
|
|
|
|
<i className="fas fa-code" />
|
|
|
|
|
</span>
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
2019-10-20 18:02:52 +02:00
|
|
|
<div title={t("sources.content.historyButton")}>
|
2019-10-21 10:57:56 +02:00
|
|
|
<Button action={this.showHistory} className="reduced" color={this.color(historyIsSelected)}>
|
2019-08-28 09:36:52 +02:00
|
|
|
<span className="icon">
|
|
|
|
|
<i className="fas fa-history" />
|
|
|
|
|
</span>
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
2019-06-20 14:57:00 +02:00
|
|
|
</ButtonAddons>
|
2018-11-26 15:20:44 +01:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-23 15:47:08 +02:00
|
|
|
export default withTranslation("repos")(FileButtonAddons);
|