mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
rename trailer to contributor
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
import React, { FC, useState } from "react";
|
||||
import {Trans, useTranslation, WithTranslation, withTranslation} from "react-i18next";
|
||||
import { Trans, useTranslation, WithTranslation, withTranslation } from "react-i18next";
|
||||
import classNames from "classnames";
|
||||
import styled from "styled-components";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
@@ -66,7 +66,7 @@ const BottomMarginLevel = styled(Level)`
|
||||
`;
|
||||
|
||||
const countContributors = (changeset: Changeset) => {
|
||||
return changeset.trailers.length + 1;
|
||||
return changeset.contributors.length + 1;
|
||||
};
|
||||
|
||||
const ContributorLine = styled.div`
|
||||
@@ -101,12 +101,12 @@ const ContributorToggleLine = styled.p`
|
||||
|
||||
const Contributors: FC<{ changeset: Changeset }> = ({ changeset }) => {
|
||||
const [t] = useTranslation("repos");
|
||||
const [open, setOpen] = useState(true);
|
||||
const [open, setOpen] = useState(false);
|
||||
if (open) {
|
||||
return (
|
||||
<ContributorDetails>
|
||||
<ContributorToggleLine onClick={e => setOpen(!open)}>
|
||||
<Icon name="angle-down" /> {t("changesets.contributors")}
|
||||
<Icon name="angle-down" /> {t("changeset.contributors.list")}
|
||||
</ContributorToggleLine>
|
||||
<ContributorTable changeset={changeset} />
|
||||
</ContributorDetails>
|
||||
@@ -119,7 +119,11 @@ const Contributors: FC<{ changeset: Changeset }> = ({ changeset }) => {
|
||||
<Icon name="angle-right" /> <ChangesetAuthor changeset={changeset} />
|
||||
</ContributorColumn>
|
||||
<CountColumn>
|
||||
(<span className="has-text-link">{countContributors(changeset)} Contributors</span>)
|
||||
(
|
||||
<span className="has-text-link">
|
||||
{t("changeset.contributors.count", { count: countContributors(changeset) })}
|
||||
</span>
|
||||
)
|
||||
</CountColumn>
|
||||
</ContributorLine>
|
||||
</>
|
||||
|
||||
@@ -53,7 +53,7 @@ const Contributor: FC<{ person: Person }> = ({ person }) => {
|
||||
}
|
||||
if (person.mail) {
|
||||
return (
|
||||
<a href={"mailto:" + person.mail} title={t("changeset.author.mailto") + " " + person.mail}>
|
||||
<a href={"mailto:" + person.mail} title={t("changeset.contributors.mailto") + " " + person.mail}>
|
||||
{prefix}
|
||||
{person.name}
|
||||
</a>
|
||||
@@ -65,39 +65,39 @@ const Contributor: FC<{ person: Person }> = ({ person }) => {
|
||||
const ContributorTable: FC<Props> = ({ changeset }) => {
|
||||
const [t] = useTranslation("plugins");
|
||||
|
||||
const collectAvailableTrailerTypes = () => {
|
||||
const collectAvailableContributorTypes = () => {
|
||||
// @ts-ignore
|
||||
return [...new Set(changeset.trailers.map(trailer => trailer.trailerType))];
|
||||
return [...new Set(changeset.contributors.map(contributor => contributor.type))];
|
||||
};
|
||||
|
||||
const getPersonsByTrailersType = (type: string) => {
|
||||
return changeset.trailers?.filter(trailer => trailer.trailerType === type).map(t => t.person);
|
||||
const getPersonsByContributorType = (type: string) => {
|
||||
return changeset.contributors?.filter(contributor => contributor.type === type).map(t => t.person);
|
||||
};
|
||||
|
||||
const getTrailersByType = () => {
|
||||
const availableTrailerTypes: string[] = collectAvailableTrailerTypes();
|
||||
const getContributorsByType = () => {
|
||||
const availableContributorTypes: string[] = collectAvailableContributorTypes();
|
||||
|
||||
const personsByTrailerType = [];
|
||||
for (const type of availableTrailerTypes) {
|
||||
personsByTrailerType.push({ type, persons: getPersonsByTrailersType(type) });
|
||||
const personsByContributorType = [];
|
||||
for (const type of availableContributorTypes) {
|
||||
personsByContributorType.push({ type, persons: getPersonsByContributorType(type) });
|
||||
}
|
||||
return personsByTrailerType;
|
||||
return personsByContributorType;
|
||||
};
|
||||
|
||||
return (
|
||||
<table>
|
||||
<tr>
|
||||
<SizedTd>{t("changeset.trailer.type.author") + ":"}</SizedTd>
|
||||
<SizedTd>{t("changeset.contributor.type.author") + ":"}</SizedTd>
|
||||
<td>
|
||||
<Contributor person={changeset.author} />
|
||||
</td>
|
||||
</tr>
|
||||
{getTrailersByType().map(trailer => (
|
||||
<tr key={trailer.type}>
|
||||
<SizedTd>{t("changeset.trailer.type." + trailer.type) + ":"}</SizedTd>
|
||||
{getContributorsByType().map(contributor => (
|
||||
<tr key={contributor.type}>
|
||||
<SizedTd>{t("changeset.contributor.type." + contributor.type) + ":"}</SizedTd>
|
||||
<td className="is-ellipsis-overflow is-marginless">
|
||||
<CommaSeparatedList>
|
||||
{trailer.persons.map(person => (
|
||||
{contributor.persons.map(person => (
|
||||
<Contributor key={person.name} person={person} />
|
||||
))}
|
||||
</CommaSeparatedList>
|
||||
|
||||
Reference in New Issue
Block a user