Moved changeset code to repos

This commit is contained in:
Philipp Czora
2018-09-19 14:10:50 +02:00
parent 10b120c862
commit c853a3eb80
9 changed files with 21 additions and 21 deletions

View File

@@ -0,0 +1,28 @@
//@flow
import React from "react";
import {ExtensionPoint} from "@scm-manager/ui-extensions";
import type {Changeset} from "@scm-manager/ui-types";
import {Image} from "@scm-manager/ui-components";
type Props = {
changeset: Changeset
};
class ChangesetAvatar extends React.Component<Props> {
render() {
const { changeset } = this.props;
return (
<p className="image is-64x64">
<ExtensionPoint
name="repos.changeset-table.information"
renderAll={true}
props={{ changeset }}
>
<Image src="/images/blib.jpg" alt="Logo" />
</ExtensionPoint>
</p>
);
}
}
export default ChangesetAvatar;

View File

@@ -0,0 +1,69 @@
//@flow
import React from "react";
import type { Changeset } from "@scm-manager/ui-types";
import classNames from "classnames";
import { translate } from "react-i18next";
import ChangesetAvatar from "./ChangesetAvatar";
import injectSheet from "react-jss";
const styles = {
pointer: {
cursor: "pointer"
},
changesetGroup: {
marginBottom: "1em"
}
};
type Props = {
changeset: Changeset,
t: any,
classes: any
};
class ChangesetRow extends React.Component<Props> {
createLink = (changeset: Changeset) => {
return `/repo/changeset/${changeset.id}`;
};
render() {
const { changeset, t, classes } = this.props;
const changesetLink = this.createLink(changeset);
const authorLine = (
<>
{changeset.author.name}{" "}
<a
className="is-hidden-mobile"
href={"mailto:" + changeset.author.mail}
>
&lt;
{changeset.author.mail}
&gt;
</a>
</>
);
// todo: i18n
return (
<article className={classNames("media", classes.inner)}>
<figure className="media-left">
<ChangesetAvatar changeset={changeset} />
</figure>
<div className="media-content">
<div className="content">
<p className="is-ellipsis-overflow">
{changeset.description}
<br />
{t("changeset.summary", {
id: changeset.id,
time: changeset.date
})}
</p>
<p className="is-size-7">{authorLine}</p>
</div>
</div>
</article>
);
}
}
export default injectSheet(styles)(translate("changesets")(ChangesetRow));

View File

@@ -0,0 +1,21 @@
// @flow
import ChangesetRow from "./ChangesetRow";
import React from "react";
import type { Changeset } from "@scm-manager/ui-types";
import classNames from "classnames";
type Props = {
changesets: Changeset[]
};
class ChangesetTable extends React.Component<Props> {
render() {
const { changesets } = this.props;
const content = changesets.map((changeset, index) => {
return <ChangesetRow key={index} changeset={changeset} />;
});
return <div className={classNames("box")}>{content}</div>;
}
}
export default ChangesetTable;

View File

@@ -0,0 +1,30 @@
// @flow
import React from "react";
type Props = {
options: string[],
optionSelected: string => void,
preselectedOption: string
}
class DropDown extends React.Component<Props> {
render() {
const {options, preselectedOption} = this.props;
return <div className="select">
<select value={preselectedOption} onChange={this.change}>
<option key=""></option>
{options.map(option => {
return <option key={option}
value={option}>{option}</option>
})}
</select>
</div>
}
change = (event) => {
this.props.optionSelected(event.target.value);
}
}
export default DropDown;