mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-25 06:24:19 +00:00
✨ Add share button to repositories list
This commit is contained in:
parent
7e8679a1e9
commit
e1e0218e71
5 changed files with 35 additions and 17 deletions
|
@ -53,6 +53,7 @@ export default {
|
|||
menuArchived: "Le tue repository archiviate",
|
||||
emptyMenu: "Non c'è nulla qui.",
|
||||
delete: "Elimina",
|
||||
share: "Condividi",
|
||||
archive: "Archivia",
|
||||
edit: "Modifica",
|
||||
created: "Creata",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.SummaryButton {
|
||||
width: 90px;
|
||||
width: 100px;
|
||||
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
|
|
|
@ -20,9 +20,11 @@ import Empty from "./Empty"
|
|||
* @returns {JSX.Element}
|
||||
* @constructor
|
||||
*/
|
||||
export default function BoxRepositories({
|
||||
export default function BoxRepositories(
|
||||
{
|
||||
repositories,
|
||||
view,
|
||||
share,
|
||||
archive,
|
||||
edit,
|
||||
destroy,
|
||||
|
@ -30,7 +32,8 @@ export default function BoxRepositories({
|
|||
running,
|
||||
className,
|
||||
...props
|
||||
}) {
|
||||
})
|
||||
{
|
||||
let contents
|
||||
if(loading) {
|
||||
contents = <Loading/>
|
||||
|
@ -44,6 +47,7 @@ export default function BoxRepositories({
|
|||
key={repo["id"]}
|
||||
repo={repo}
|
||||
view={view ? () => view(repo["id"]) : null}
|
||||
share={share ? () => share(repo["id"]) : null}
|
||||
archive={archive ? () => archive(repo["id"]) : null}
|
||||
edit={edit ? () => edit(repo["id"]) : null}
|
||||
destroy={destroy ? () => destroy(repo["id"]) : null}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useContext } from "react"
|
||||
import { faArchive, faFolder, faFolderOpen, faPencilAlt, faTrash } from "@fortawesome/free-solid-svg-icons"
|
||||
import { faArchive, faFolder, faFolderOpen, faPencilAlt, faShare, faTrash } from "@fortawesome/free-solid-svg-icons"
|
||||
import ContextLanguage from "../../contexts/ContextLanguage"
|
||||
import SummaryBase from "../base/summary/SummaryBase"
|
||||
import SummaryLeft from "../base/summary/SummaryLeft"
|
||||
|
@ -13,6 +13,7 @@ import SummaryRight from "../base/summary/SummaryRight"
|
|||
*
|
||||
* @param repo - The repository to display.
|
||||
* @param view - Function with no parameters to call when the view repository button is clicked.
|
||||
* @param share - Function with no parameters to call when the archive repository button is clicked.
|
||||
* @param archive - Function with no parameters to call when the archive repository button is clicked.
|
||||
* @param edit - Function with no parameters to call when the edit repository button is clicked.
|
||||
* @param destroy - Function with no parameters to call when the delete repository button is clicked.
|
||||
|
@ -23,7 +24,7 @@ import SummaryRight from "../base/summary/SummaryRight"
|
|||
* @constructor
|
||||
*/
|
||||
export default function SummaryRepository(
|
||||
{ repo, view, archive, edit, destroy, running, className, ...props },
|
||||
{ repo, view, share, archive, edit, destroy, running, className, ...props },
|
||||
) {
|
||||
const { strings } = useContext(ContextLanguage)
|
||||
|
||||
|
@ -43,11 +44,22 @@ export default function SummaryRepository(
|
|||
lowerValue={repo.end ? new Date(repo.end).toLocaleString() : null}
|
||||
/>
|
||||
|
||||
{share ?
|
||||
<SummaryButton
|
||||
color={"Green"}
|
||||
icon={faShare}
|
||||
onClick={() => share()}
|
||||
disabled={running}
|
||||
>
|
||||
{strings.share}
|
||||
</SummaryButton>
|
||||
: null}
|
||||
|
||||
{destroy ?
|
||||
<SummaryButton
|
||||
color={"Red"}
|
||||
icon={faTrash}
|
||||
onClick={() => destroy(repo["id"])}
|
||||
onClick={() => destroy()}
|
||||
disabled={running}
|
||||
>
|
||||
{strings.delete}
|
||||
|
@ -58,7 +70,7 @@ export default function SummaryRepository(
|
|||
<SummaryButton
|
||||
color={"Grey"}
|
||||
icon={faArchive}
|
||||
onClick={() => archive(repo["id"])}
|
||||
onClick={() => archive()}
|
||||
disabled={running}
|
||||
>
|
||||
{strings.archive}
|
||||
|
@ -69,7 +81,7 @@ export default function SummaryRepository(
|
|||
<SummaryButton
|
||||
color={"Yellow"}
|
||||
icon={faPencilAlt}
|
||||
onClick={() => edit(repo["id"])}
|
||||
onClick={() => edit()}
|
||||
disabled={running}
|
||||
>
|
||||
{strings.edit}
|
||||
|
|
|
@ -30,6 +30,7 @@ export default function PageRepositories({ children, className, ...props }) {
|
|||
running={bv.running}
|
||||
repositories={bv.resources.filter(r => r.is_active)}
|
||||
view={pk => history.push(`/repositories/${pk}`)}
|
||||
share={pk => history.push(`/repositories/${pk}/share`)}
|
||||
archive={archive}
|
||||
edit={pk => history.push(`/repositories/${pk}/edit`)}
|
||||
/>
|
||||
|
|
Loading…
Reference in a new issue