move Person type to ui-types

This commit is contained in:
Sebastian Sdorra
2020-06-10 10:02:49 +02:00
parent 324c23e509
commit 53fc01b0ba
5 changed files with 20 additions and 37 deletions

View File

@@ -22,9 +22,10 @@
* SOFTWARE. * SOFTWARE.
*/ */
export type Person = { import { Person } from "@scm-manager/ui-types";
name: string;
mail?: string; // re export type to avoid breaking changes,
}; // after the type was moved to ui-types
export { Person };
export const EXTENSION_POINT = "avatar.factory"; export const EXTENSION_POINT = "avatar.factory";

View File

@@ -22,10 +22,10 @@
* SOFTWARE. * SOFTWARE.
*/ */
import React, { FC } from "react"; import React, { FC } from "react";
import { Changeset } from "@scm-manager/ui-types"; import { Changeset, Person } from "@scm-manager/ui-types";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useBinder } from "@scm-manager/ui-extensions"; import { useBinder } from "@scm-manager/ui-extensions";
import { EXTENSION_POINT, Person } from "../../avatar/Avatar"; import { EXTENSION_POINT } from "../../avatar/Avatar";
import styled from "styled-components"; import styled from "styled-components";
import CommaSeparatedList from "../../CommaSeparatedList"; import CommaSeparatedList from "../../CommaSeparatedList";
import ContributorAvatar from "./ContributorAvatar"; import ContributorAvatar from "./ContributorAvatar";
@@ -167,7 +167,7 @@ const ChangesetAuthor: FC<Props> = ({ changeset }) => {
coAuthors.push(...extensions); coAuthors.push(...extensions);
} }
return <CommaSeparatedList>{authorLine}</CommaSeparatedList> return <CommaSeparatedList>{authorLine}</CommaSeparatedList>;
}; };
export default ChangesetAuthor; export default ChangesetAuthor;

View File

@@ -25,15 +25,16 @@
import { Collection, Links } from "./hal"; import { Collection, Links } from "./hal";
import { Tag } from "./Tags"; import { Tag } from "./Tags";
import { Branch } from "./Branches"; import { Branch } from "./Branches";
import { Person } from "@scm-manager/ui-components/src/avatar/Avatar";
export type Person = {
name: string;
mail?: string;
};
export type Changeset = Collection & { export type Changeset = Collection & {
id: string; id: string;
date: Date; date: Date;
author: { author: Person;
name: string;
mail?: string;
};
description: string; description: string;
trailers: Trailer[]; trailers: Trailer[];
_links: Links; _links: Links;

View File

@@ -29,16 +29,12 @@ export { Me } from "./Me";
export { DisplayedUser, User } from "./User"; export { DisplayedUser, User } from "./User";
export { Group, Member } from "./Group"; export { Group, Member } from "./Group";
export { export { Repository, RepositoryCollection, RepositoryGroup } from "./Repositories";
Repository,
RepositoryCollection,
RepositoryGroup
} from "./Repositories";
export { RepositoryType, RepositoryTypeCollection } from "./RepositoryTypes"; export { RepositoryType, RepositoryTypeCollection } from "./RepositoryTypes";
export { Branch, BranchRequest } from "./Branches"; export { Branch, BranchRequest } from "./Branches";
export { Changeset } from "./Changesets"; export { Changeset, Person, Trailer, ParentChangeset } from "./Changesets";
export { Tag } from "./Tags"; export { Tag } from "./Tags";
@@ -46,22 +42,13 @@ export { Config } from "./Config";
export { IndexResources } from "./IndexResources"; export { IndexResources } from "./IndexResources";
export { export { Permission, PermissionCreateEntry, PermissionCollection } from "./RepositoryPermissions";
Permission,
PermissionCreateEntry,
PermissionCollection
} from "./RepositoryPermissions";
export { SubRepository, File } from "./Sources"; export { SubRepository, File } from "./Sources";
export { SelectValue, AutocompleteObject } from "./Autocomplete"; export { SelectValue, AutocompleteObject } from "./Autocomplete";
export { export { Plugin, PluginCollection, PluginGroup, PendingPlugins } from "./Plugin";
Plugin,
PluginCollection,
PluginGroup,
PendingPlugins
} from "./Plugin";
export { RepositoryRole } from "./RepositoryRole"; export { RepositoryRole } from "./RepositoryRole";

View File

@@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
import React, { FC } from "react"; import React, { FC } from "react";
import { Changeset } from "@scm-manager/ui-types"; import { Changeset, Person } from "@scm-manager/ui-types";
import styled from "styled-components"; import styled from "styled-components";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useBinder } from "@scm-manager/ui-extensions"; import { useBinder } from "@scm-manager/ui-extensions";
@@ -36,12 +36,6 @@ const SizedTd = styled.td`
width: 10rem; width: 10rem;
`; `;
// TODO get from ui-types?
type Person = {
name: string;
mail?: string;
};
const Contributor: FC<{ person: Person }> = ({ person }) => { const Contributor: FC<{ person: Person }> = ({ person }) => {
const [t] = useTranslation("repos"); const [t] = useTranslation("repos");
const binder = useBinder(); const binder = useBinder();
@@ -101,7 +95,7 @@ const ContributorTable: FC<Props> = ({ changeset }) => {
{getTrailersByType().map(trailer => ( {getTrailersByType().map(trailer => (
<tr key={trailer.type}> <tr key={trailer.type}>
<SizedTd>{t("changeset.trailer.type." + trailer.type) + ":"}</SizedTd> <SizedTd>{t("changeset.trailer.type." + trailer.type) + ":"}</SizedTd>
<td className="shorten-text is-marginless"> <td className="is-ellipsis-overflow is-marginless">
<CommaSeparatedList> <CommaSeparatedList>
{trailer.persons.map(person => ( {trailer.persons.map(person => (
<Contributor key={person.name} person={person} /> <Contributor key={person.name} person={person} />