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 ChangesetButtonGroup from "./ChangesetButtonGroup";
import ChangesetDescription from "./ChangesetDescription";
import SignatureIcon from "@scm-manager/ui-webapp/src/repos/components/changesets/SignatureIcon";
import { Level } from "../..";
import SignatureIcon from "./SignatureIcon";
type Props = WithTranslation & {
repository: Repository;

View File

@@ -22,15 +22,26 @@
* SOFTWARE.
*/
import React, { FC } from "react";
import { Icon, Tooltip } from "@scm-manager/ui-components";
import { useTranslation } from "react-i18next";
import { Signature } from "@scm-manager/ui-types";
import styled from "styled-components";
import Icon from "../../Icon";
import Tooltip from "../../Tooltip";
type Props = {
signatures: Signature[];
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 [t] = useTranslation("repos");
@@ -54,14 +65,16 @@ const SignatureIcon: FC<Props> = ({ signatures, className }) => {
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"
)}: ${status}`;
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;
};
@@ -78,7 +91,7 @@ const SignatureIcon: FC<Props> = ({ signatures, className }) => {
return (
<Tooltip location="top" message={createTooltipMessage()}>
<Icon name={"key"} className={className} color={getColor()} />
<StyledIcon name="key" className={className} color={getColor()} />
</Tooltip>
);
};

View File

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

View File

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

View File

@@ -43,7 +43,7 @@ import {
} from "@scm-manager/ui-components";
import ContributorTable from "./ContributorTable";
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 & {
changeset: Changeset;