Heed peer review

This commit is contained in:
René Pfeuffer
2020-09-10 08:37:37 +02:00
parent e81341b601
commit 4df9c2947b
4 changed files with 21 additions and 21 deletions

View File

@@ -88,24 +88,20 @@ export default class CardColumnGroup extends React.Component<Props, State> {
}); });
} }
const header = url ? ( return (
<Container>
<h2> <h2>
<span className={classNames("is-size-4", "has-cursor-pointer")} onClick={this.toggleCollapse}> <span className={classNames("is-size-4", "has-cursor-pointer")} onClick={this.toggleCollapse}>
<i className={classNames("fa", icon)} /> <i className={classNames("fa", icon)} />
</span>{" "} </span>{" "}
<Link to={url} className={"has-text-dark"}>{name}</Link> {url ? (
</h2> <Link to={url} className={"has-text-dark"}>
{name}
</Link>
) : ( ) : (
<h2> name
<span className={classNames("is-size-4", "has-cursor-pointer")} onClick={this.toggleCollapse}> )}
<i className={classNames("fa", icon)} /> {name}
</span>
</h2> </h2>
);
return (
<Container>
{header}
<hr /> <hr />
<Wrapper className={classNames("columns", "card-columns", "is-multiline")}>{content}</Wrapper> <Wrapper className={classNames("columns", "card-columns", "is-multiline")}>{content}</Wrapper>
<div className="is-clearfix" /> <div className="is-clearfix" />

View File

@@ -50,7 +50,11 @@ export type RepositoryCollection = PagedCollection & {
}; };
}; };
export type NamespaceCollection = Namespace[]; export type NamespaceCollection = {
_embedded: {
namespaces: Namespace[];
};
};
export type RepositoryGroup = { export type RepositoryGroup = {
name: string; name: string;

View File

@@ -95,7 +95,7 @@ class Overview extends React.Component<Props> {
getReposLink = () => { getReposLink = () => {
const { namespace, namespaces, reposLink } = this.props; const { namespace, namespaces, reposLink } = this.props;
if (namespace) { if (namespace) {
return namespaces?.find(n => n.namespace === namespace)?._links?.repositories?.href; return namespaces?._embedded.namespaces.find(n => n.namespace === namespace)?._links?.repositories?.href;
} else { } else {
return reposLink; return reposLink;
} }
@@ -114,7 +114,7 @@ class Overview extends React.Component<Props> {
const link = namespace ? `repos/${namespace}` : "repos"; const link = namespace ? `repos/${namespace}` : "repos";
const namespacesToRender = namespaces?["", ...namespaces.map(n => n.namespace).sort()]:[]; const namespacesToRender = namespaces ? ["", ...namespaces._embedded.namespaces.map(n => n.namespace).sort()] : [];
return ( return (
<Page title={t("overview.title")} subtitle={t("overview.subtitle")} loading={loading} error={error}> <Page title={t("overview.title")} subtitle={t("overview.subtitle")} loading={loading} error={error}>

View File

@@ -422,7 +422,7 @@ const reducerByNames = (state: object, repository: Repository) => {
const reducerForNamespaces = (state: object, namespaces: NamespaceCollection) => { const reducerForNamespaces = (state: object, namespaces: NamespaceCollection) => {
return { return {
...state, ...state,
namespaces: namespaces._embedded namespaces: namespaces
}; };
}; };
@@ -467,7 +467,7 @@ export function getRepositoryCollection(state: object) {
} }
export function getNamespaceCollection(state: object) { export function getNamespaceCollection(state: object) {
return state.repos.namespaces?.namespaces; return state.repos.namespaces;
} }
export function isFetchReposPending(state: object) { export function isFetchReposPending(state: object) {