mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
fix review findings
This commit is contained in:
@@ -33,16 +33,12 @@ type Props = {
|
||||
const GitTagInformation: FC<Props> = ({ tag }) => {
|
||||
const [t] = useTranslation("plugins");
|
||||
|
||||
if (!tag) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<h4>{t("scm-git-plugin.information.checkoutTag")}</h4>
|
||||
<pre>
|
||||
<code>
|
||||
git checkout tags/{tag?.name} -b branch/{tag?.name}
|
||||
git checkout tags/{tag.name} -b branch/{tag.name}
|
||||
</code>
|
||||
</pre>
|
||||
</>
|
||||
|
||||
@@ -27,16 +27,12 @@ import { useTranslation } from "react-i18next";
|
||||
import { Tag } from "@scm-manager/ui-types";
|
||||
|
||||
type Props = {
|
||||
tag?: Tag;
|
||||
tag: Tag;
|
||||
};
|
||||
|
||||
const HgTagInformation: FC<Props> = ({ tag }) => {
|
||||
const [t] = useTranslation("plugins");
|
||||
|
||||
if (!tag) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<h4>{t("scm-hg-plugin.information.checkoutTag")}</h4>
|
||||
|
||||
@@ -27,6 +27,6 @@ import { Links } from "./hal";
|
||||
export type Tag = {
|
||||
name: string;
|
||||
revision: string;
|
||||
date: Date;
|
||||
date?: Date;
|
||||
_links: Links;
|
||||
};
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
}
|
||||
},
|
||||
"tag": {
|
||||
"name": "Tag-Name",
|
||||
"name": "Name",
|
||||
"commit": "Commit",
|
||||
"sources": "Sources"
|
||||
},
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
}
|
||||
},
|
||||
"tag": {
|
||||
"name": "Tag-Name",
|
||||
"name": "Name",
|
||||
"commit": "Commit",
|
||||
"sources": "Sources"
|
||||
},
|
||||
|
||||
@@ -25,38 +25,44 @@
|
||||
import React, { FC } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Repository, Tag } from "@scm-manager/ui-types";
|
||||
import { DateFromNow } from "@scm-manager/ui-components";
|
||||
import { DateFromNow, Level } from "@scm-manager/ui-components";
|
||||
import styled from "styled-components";
|
||||
import TagButtonGroup from "./TagButtonGroup";
|
||||
|
||||
type Props = {
|
||||
repository: Repository;
|
||||
tag?: Tag;
|
||||
tag: Tag;
|
||||
};
|
||||
|
||||
const FlexRow = styled.div`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
`;
|
||||
|
||||
const Created = styled.div`
|
||||
margin-top: 0.5rem;
|
||||
margin-left: 0.5rem;
|
||||
font-size: 0.8rem;
|
||||
`;
|
||||
|
||||
const Label = styled.strong`
|
||||
margin-right: 0.3rem;
|
||||
`;
|
||||
|
||||
const Date = styled(DateFromNow)`
|
||||
font-size: 1rem;
|
||||
font-size: 0.8rem;
|
||||
`;
|
||||
|
||||
const TagDetail: FC<Props> = ({ tag, repository }) => {
|
||||
const [t] = useTranslation("repos");
|
||||
|
||||
if (!tag) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="media">
|
||||
<div className="media-content subtitle">
|
||||
<strong>{t("tag.name") + ":"}</strong> {tag?.name}
|
||||
<FlexRow className="media-content subtitle">
|
||||
<Label>{t("tag.name") + ": "} </Label> {tag.name}
|
||||
<Created className="is-ellipsis-overflow">
|
||||
<strong>{t("tags.overview.created") + ":"}</strong> <Date date={tag.date} className="has-text-grey" />
|
||||
{t("tags.overview.created")} <Date date={tag.date} className="has-text-grey" />
|
||||
</Created>
|
||||
</div>
|
||||
</FlexRow>
|
||||
<div className="media-right">
|
||||
<TagButtonGroup repository={repository} tag={tag} />
|
||||
</div>
|
||||
|
||||
@@ -29,7 +29,7 @@ import TagDetail from "./TagDetail";
|
||||
|
||||
type Props = {
|
||||
repository: Repository;
|
||||
tag?: Tag;
|
||||
tag: Tag;
|
||||
};
|
||||
|
||||
const TagView: FC<Props> = ({ repository, tag }) => {
|
||||
|
||||
@@ -37,14 +37,13 @@ type Props = {
|
||||
const TagRoot: FC<Props> = ({ repository, baseUrl }) => {
|
||||
const match = useRouteMatch();
|
||||
const [tags, setTags] = useState<Tag[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<Error | undefined>(undefined);
|
||||
const [tag, setTag] = useState<Tag>();
|
||||
|
||||
useEffect(() => {
|
||||
const link = (repository._links?.tags as Link)?.href;
|
||||
if (link) {
|
||||
setLoading(true);
|
||||
apiClient
|
||||
.get(link)
|
||||
.then(r => r.json())
|
||||
|
||||
@@ -69,12 +69,7 @@ const TagsOverview: FC<Props> = ({ repository, baseUrl }) => {
|
||||
return <Loading />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Subtitle subtitle={t("tags.overview.title")} />
|
||||
{renderTagsTable()}
|
||||
</>
|
||||
);
|
||||
return <>{renderTagsTable()}</>;
|
||||
};
|
||||
|
||||
export default TagsOverview;
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
// sort tags by date beginning with latest first
|
||||
import { Tag } from "@scm-manager/ui-types";
|
||||
|
||||
export default function orderTags(tags: Tag[]) {
|
||||
export default (tags: Tag[]) => {
|
||||
tags.sort((a, b) => {
|
||||
return new Date(b.date) - new Date(a.date);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user