/* * Copyright (c) 2020 - present Cloudogu GmbH * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. */ import React, { FC } from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import styled from "styled-components"; import { Card, Icon, Menu, useKeyboardIteratorTargetV2, DateFromNow } from "@scm-manager/ui-core"; import { ExtensionPoint, extensionPoints } from "@scm-manager/ui-extensions"; import { Repository } from "@scm-manager/ui-types"; import RepositoryAvatar from "./RepositoryAvatar"; import RepositoryFlags from "./RepositoryFlags"; type Props = { repository: Repository; expectedIndex?: number; }; const Avatar = styled.div` .predefined-avatar { height: 48px; width: 48px; font-size: 1.75rem; } `; const StyledLink = styled(Link)` overflow-wrap: anywhere; `; const DescriptionRow = styled(Card.Row)` text-wrap: nowrap; overflow: hidden; text-overflow: ellipsis; `; const DetailsRow = styled(Card.Row)` gap: 0.5rem; `; const RepositoryEntry: FC = ({ repository, expectedIndex }) => { const [t] = useTranslation("repos"); const ref = useKeyboardIteratorTargetV2({ expectedIndex: expectedIndex ?? 0 }); const actions = () => ( name="repos.repository-details.information" renderAll={true} props={{ repository, }} /> } > download {t("overview.clone")} {repository.contact ? ( envelope {t("overview.sendMailToContact")} ) : null} ); const repositoryLink = `/repo/${repository.namespace}/${repository.name}/`; return ( {actions()}} rowGap="0.25rem" avatar={ } > name="repository.card.beforeTitle" props={{ repository }} /> {repository.name}{" "} {repository.description} {t("overview.lastModified")} ); }; export default RepositoryEntry;