import React from "react"; import { Interpolate, translate } from "react-i18next"; import classNames from "classnames"; import styled from "styled-components"; import { ExtensionPoint } from "@scm-manager/ui-extensions"; import { Changeset, Repository, Tag } from "@scm-manager/ui-types"; import { DateFromNow, ChangesetId, ChangesetTag, ChangesetAuthor, ChangesetDiff, AvatarWrapper, AvatarImage, changesets, Level, Button } from "@scm-manager/ui-components"; type Props = { changeset: Changeset; repository: Repository; // context props t: (p: string) => string; }; type State = { collapsed: boolean; }; const RightMarginP = styled.p` margin-right: 1em; `; const TagsWrapper = styled.div` & .tag { margin-left: 0.25rem; } `; const BottomMarginLevel = styled(Level)` margin-bottom: 1rem !important; `; class ChangesetDetails extends React.Component { constructor(props: Props) { super(props); this.state = { collapsed: false }; } render() { const { changeset, repository, t } = this.props; const { collapsed } = this.state; const description = changesets.parseDescription(changeset.description); const id = ( ); const date = ; return ( <>

{description.title}

{this.renderTags()}

{description.message.split("\n").map((item, key) => { return ( {item}
); })}

} />
); } getTags = () => { return this.props.changeset._embedded.tags || []; }; renderTags = () => { const tags = this.getTags(); if (tags.length > 0) { return ( {tags.map((tag: Tag) => { return ; })} ); } return null; }; collapseDiffs = () => { this.setState(state => ({ collapsed: !state.collapsed })); }; } export default translate("repos")(ChangesetDetails);