improve contributor list in changeset detail view

This commit is contained in:
Sebastian Sdorra
2020-06-10 09:28:40 +02:00
parent 3c40608d4c
commit 452b379a28
5 changed files with 32 additions and 7 deletions

View File

@@ -79,7 +79,8 @@
"errorSubtitle": "Changesets konnten nicht abgerufen werden", "errorSubtitle": "Changesets konnten nicht abgerufen werden",
"noChangesets": "Keine Changesets in diesem Branch gefunden. Die Commits könnten gelöscht worden sein.", "noChangesets": "Keine Changesets in diesem Branch gefunden. Die Commits könnten gelöscht worden sein.",
"branchSelectorLabel": "Branches", "branchSelectorLabel": "Branches",
"collapseDiffs": "Auf-/Zuklappen" "collapseDiffs": "Auf-/Zuklappen",
"contributors": "Liste der Mitwirkenden"
}, },
"changeset": { "changeset": {
"description": "Beschreibung", "description": "Beschreibung",

View File

@@ -80,6 +80,7 @@
"noChangesets": "No changesets found for this branch. The commits could have been removed.", "noChangesets": "No changesets found for this branch. The commits could have been removed.",
"branchSelectorLabel": "Branches", "branchSelectorLabel": "Branches",
"collapseDiffs": "Collapse", "collapseDiffs": "Collapse",
"contributors": "List of contributors",
"authors": { "authors": {
"and": "and", "and": "and",
"authoredBy": "Authored by", "authoredBy": "Authored by",

View File

@@ -79,7 +79,8 @@
"errorSubtitle": "No se han podido recuperar los changesets", "errorSubtitle": "No se han podido recuperar los changesets",
"noChangesets": "No se han encontrado changesets para esta rama branch. Los commits podrían haber sido eliminados.", "noChangesets": "No se han encontrado changesets para esta rama branch. Los commits podrían haber sido eliminados.",
"branchSelectorLabel": "Ramas", "branchSelectorLabel": "Ramas",
"collapseDiffs": "Colapso" "collapseDiffs": "Colapso",
"contributors": "Lista de contribuyentes"
}, },
"changeset": { "changeset": {
"description": "Descripción", "description": "Descripción",

View File

@@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
import React, { FC, useState } from "react"; import React, { FC, useState } from "react";
import { Trans, WithTranslation, withTranslation } from "react-i18next"; import {Trans, useTranslation, WithTranslation, withTranslation} from "react-i18next";
import classNames from "classnames"; import classNames from "classnames";
import styled from "styled-components"; import styled from "styled-components";
import { ExtensionPoint } from "@scm-manager/ui-extensions"; import { ExtensionPoint } from "@scm-manager/ui-extensions";
@@ -87,19 +87,41 @@ const CountColumn = styled.p`
white-space: nowrap; white-space: nowrap;
`; `;
const ContributorDetails = styled.div`
display: flex;
flex-direction: column;
margin-bottom: 1rem;
`;
const ContributorToggleLine = styled.p`
cursor: pointer;
/** maring-bottom is inherit from content p **/
margin-bottom: 0.5rem !important;
`;
const Contributors: FC<{ changeset: Changeset }> = ({ changeset }) => { const Contributors: FC<{ changeset: Changeset }> = ({ changeset }) => {
const [open, setOpen] = useState(false); const [t] = useTranslation("repos");
const [open, setOpen] = useState(true);
if (open) {
return (
<ContributorDetails>
<ContributorToggleLine onClick={e => setOpen(!open)}>
<Icon name="angle-down" /> {t("changesets.contributors")}
</ContributorToggleLine>
<ContributorTable changeset={changeset} />
</ContributorDetails>
);
}
return ( return (
<> <>
<ContributorLine onClick={e => setOpen(!open)}> <ContributorLine onClick={e => setOpen(!open)}>
<ContributorColumn> <ContributorColumn>
<Icon name={open ? "angle-down" : "angle-right"} /> <ChangesetAuthor changeset={changeset} /> <Icon name="angle-right" /> <ChangesetAuthor changeset={changeset} />
</ContributorColumn> </ContributorColumn>
<CountColumn> <CountColumn>
(<span className="has-text-link">{countContributors(changeset)} Contributors</span>) (<span className="has-text-link">{countContributors(changeset)} Contributors</span>)
</CountColumn> </CountColumn>
</ContributorLine> </ContributorLine>
{open && <ContributorTable changeset={changeset} />}
</> </>
); );
}; };

View File

@@ -45,7 +45,7 @@ type Person = {
const ContributorAvatar = styled(Image)` const ContributorAvatar = styled(Image)`
width: 1em; width: 1em;
height: 1em; height: 1em;
margin-right: 0.5em; margin-right: 0.25em;
vertical-align: middle; vertical-align: middle;
border-radius: 0.25em; border-radius: 0.25em;
margin-bottom: 0.2em; margin-bottom: 0.2em;