fixes some small bugs with signature icon

This commit is contained in:
Sebastian Sdorra
2020-07-30 12:28:46 +02:00
parent 8609a14778
commit 103edf2356
5 changed files with 22 additions and 10 deletions

View File

@@ -35,8 +35,7 @@ import ChangesetAuthor from "./ChangesetAuthor";
import ChangesetTags from "./ChangesetTags"; import ChangesetTags from "./ChangesetTags";
import ChangesetButtonGroup from "./ChangesetButtonGroup"; import ChangesetButtonGroup from "./ChangesetButtonGroup";
import ChangesetDescription from "./ChangesetDescription"; import ChangesetDescription from "./ChangesetDescription";
import SignatureIcon from "@scm-manager/ui-webapp/src/repos/components/changesets/SignatureIcon"; import SignatureIcon from "./SignatureIcon";
import { Level } from "../..";
type Props = WithTranslation & { type Props = WithTranslation & {
repository: Repository; repository: Repository;

View File

@@ -22,15 +22,26 @@
* SOFTWARE. * SOFTWARE.
*/ */
import React, { FC } from "react"; import React, { FC } from "react";
import { Icon, Tooltip } from "@scm-manager/ui-components";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Signature } from "@scm-manager/ui-types"; import { Signature } from "@scm-manager/ui-types";
import styled from "styled-components";
import Icon from "../../Icon";
import Tooltip from "../../Tooltip";
type Props = { type Props = {
signatures: Signature[]; signatures: Signature[];
className: any; className: any;
}; };
const StyledIcon = styled(Icon)`
width: 1em;
height: 1em;
vertical-align: middle;
border-radius: 0.25em;
margin-bottom: 0.2em;
`;
const SignatureIcon: FC<Props> = ({ signatures, className }) => { const SignatureIcon: FC<Props> = ({ signatures, className }) => {
const [t] = useTranslation("repos"); const [t] = useTranslation("repos");
@@ -54,14 +65,16 @@ const SignatureIcon: FC<Props> = ({ signatures, className }) => {
return `${t("changeset.signatureStatus")}: ${status}`; return `${t("changeset.signatureStatus")}: ${status}`;
} }
let message = `${t("changeset.signedBy")}: ${signature.owner ? signature.owner : t("changeset.noOwner")}\n${t("changeset.keyId")}: ${signature.keyId}\n${t( let message = `${t("changeset.keyOwner")}: ${signature.owner ? signature.owner : t("changeset.noOwner")}\n${t("changeset.keyId")}: ${signature.keyId}\n${t(
"changeset.signatureStatus" "changeset.signatureStatus"
)}: ${status}`; )}: ${status}`;
if (signature.contacts?.length > 0) { if (signature.contacts?.length > 0) {
message = message + `\n${t("changeset.keyContacts")}: ${signature.contacts.map((contact: string) => `\n- ${contact}`)}`; message += `\n${t("changeset.keyContacts")}:`;
signature.contacts.forEach((contact) => {
message += `\n- ${contact}`;
});
} }
return message; return message;
}; };
@@ -78,7 +91,7 @@ const SignatureIcon: FC<Props> = ({ signatures, className }) => {
return ( return (
<Tooltip location="top" message={createTooltipMessage()}> <Tooltip location="top" message={createTooltipMessage()}>
<Icon name={"key"} className={className} color={getColor()} /> <StyledIcon name="key" className={className} color={getColor()} />
</Tooltip> </Tooltip>
); );
}; };

View File

@@ -88,7 +88,7 @@
"shortSummary": "Committet <0/> <1/>", "shortSummary": "Committet <0/> <1/>",
"tags": "Tags", "tags": "Tags",
"diffNotSupported": "Diff des Changesets wird von diesem Repositorytyp nicht unterstützt", "diffNotSupported": "Diff des Changesets wird von diesem Repositorytyp nicht unterstützt",
"signedBy": "Signiert von", "keyOwner": "Schlüssel Besitzer",
"signatureStatus": "Status", "signatureStatus": "Status",
"keyId": "Schlüssel-ID", "keyId": "Schlüssel-ID",
"keyContacts": "Kontakte", "keyContacts": "Kontakte",

View File

@@ -87,7 +87,7 @@
"summary": "Changeset <0/> was committed <1/>", "summary": "Changeset <0/> was committed <1/>",
"shortSummary": "Committed <0/> <1/>", "shortSummary": "Committed <0/> <1/>",
"tags": "Tags", "tags": "Tags",
"signedBy": "Signed by", "keyOwner": "Key Owner",
"keyId": "Key ID", "keyId": "Key ID",
"keyContacts": "Contacts", "keyContacts": "Contacts",
"noOwner": "Unknown", "noOwner": "Unknown",

View File

@@ -43,7 +43,7 @@ import {
} from "@scm-manager/ui-components"; } from "@scm-manager/ui-components";
import ContributorTable from "./ContributorTable"; import ContributorTable from "./ContributorTable";
import { Link as ReactLink } from "react-router-dom"; import { Link as ReactLink } from "react-router-dom";
import SignatureIcon from "./SignatureIcon"; import SignatureIcon from "@scm-manager/ui-components/src/repos/changesets/SignatureIcon";
type Props = WithTranslation & { type Props = WithTranslation & {
changeset: Changeset; changeset: Changeset;