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",
|
menuArchived: "Le tue repository archiviate",
|
||||||
emptyMenu: "Non c'è nulla qui.",
|
emptyMenu: "Non c'è nulla qui.",
|
||||||
delete: "Elimina",
|
delete: "Elimina",
|
||||||
|
share: "Condividi",
|
||||||
archive: "Archivia",
|
archive: "Archivia",
|
||||||
edit: "Modifica",
|
edit: "Modifica",
|
||||||
created: "Creata",
|
created: "Creata",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.SummaryButton {
|
.SummaryButton {
|
||||||
width: 90px;
|
width: 100px;
|
||||||
|
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
|
|
@ -20,9 +20,11 @@ import Empty from "./Empty"
|
||||||
* @returns {JSX.Element}
|
* @returns {JSX.Element}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export default function BoxRepositories({
|
export default function BoxRepositories(
|
||||||
|
{
|
||||||
repositories,
|
repositories,
|
||||||
view,
|
view,
|
||||||
|
share,
|
||||||
archive,
|
archive,
|
||||||
edit,
|
edit,
|
||||||
destroy,
|
destroy,
|
||||||
|
@ -30,7 +32,8 @@ export default function BoxRepositories({
|
||||||
running,
|
running,
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}) {
|
})
|
||||||
|
{
|
||||||
let contents
|
let contents
|
||||||
if(loading) {
|
if(loading) {
|
||||||
contents = <Loading/>
|
contents = <Loading/>
|
||||||
|
@ -44,6 +47,7 @@ export default function BoxRepositories({
|
||||||
key={repo["id"]}
|
key={repo["id"]}
|
||||||
repo={repo}
|
repo={repo}
|
||||||
view={view ? () => view(repo["id"]) : null}
|
view={view ? () => view(repo["id"]) : null}
|
||||||
|
share={share ? () => share(repo["id"]) : null}
|
||||||
archive={archive ? () => archive(repo["id"]) : null}
|
archive={archive ? () => archive(repo["id"]) : null}
|
||||||
edit={edit ? () => edit(repo["id"]) : null}
|
edit={edit ? () => edit(repo["id"]) : null}
|
||||||
destroy={destroy ? () => destroy(repo["id"]) : null}
|
destroy={destroy ? () => destroy(repo["id"]) : null}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useContext } from "react"
|
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 ContextLanguage from "../../contexts/ContextLanguage"
|
||||||
import SummaryBase from "../base/summary/SummaryBase"
|
import SummaryBase from "../base/summary/SummaryBase"
|
||||||
import SummaryLeft from "../base/summary/SummaryLeft"
|
import SummaryLeft from "../base/summary/SummaryLeft"
|
||||||
|
@ -13,6 +13,7 @@ import SummaryRight from "../base/summary/SummaryRight"
|
||||||
*
|
*
|
||||||
* @param repo - The repository to display.
|
* @param repo - The repository to display.
|
||||||
* @param view - Function with no parameters to call when the view repository button is clicked.
|
* @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 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 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.
|
* @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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export default function SummaryRepository(
|
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)
|
const { strings } = useContext(ContextLanguage)
|
||||||
|
|
||||||
|
@ -43,11 +44,22 @@ export default function SummaryRepository(
|
||||||
lowerValue={repo.end ? new Date(repo.end).toLocaleString() : null}
|
lowerValue={repo.end ? new Date(repo.end).toLocaleString() : null}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{share ?
|
||||||
|
<SummaryButton
|
||||||
|
color={"Green"}
|
||||||
|
icon={faShare}
|
||||||
|
onClick={() => share()}
|
||||||
|
disabled={running}
|
||||||
|
>
|
||||||
|
{strings.share}
|
||||||
|
</SummaryButton>
|
||||||
|
: null}
|
||||||
|
|
||||||
{destroy ?
|
{destroy ?
|
||||||
<SummaryButton
|
<SummaryButton
|
||||||
color={"Red"}
|
color={"Red"}
|
||||||
icon={faTrash}
|
icon={faTrash}
|
||||||
onClick={() => destroy(repo["id"])}
|
onClick={() => destroy()}
|
||||||
disabled={running}
|
disabled={running}
|
||||||
>
|
>
|
||||||
{strings.delete}
|
{strings.delete}
|
||||||
|
@ -58,7 +70,7 @@ export default function SummaryRepository(
|
||||||
<SummaryButton
|
<SummaryButton
|
||||||
color={"Grey"}
|
color={"Grey"}
|
||||||
icon={faArchive}
|
icon={faArchive}
|
||||||
onClick={() => archive(repo["id"])}
|
onClick={() => archive()}
|
||||||
disabled={running}
|
disabled={running}
|
||||||
>
|
>
|
||||||
{strings.archive}
|
{strings.archive}
|
||||||
|
@ -69,7 +81,7 @@ export default function SummaryRepository(
|
||||||
<SummaryButton
|
<SummaryButton
|
||||||
color={"Yellow"}
|
color={"Yellow"}
|
||||||
icon={faPencilAlt}
|
icon={faPencilAlt}
|
||||||
onClick={() => edit(repo["id"])}
|
onClick={() => edit()}
|
||||||
disabled={running}
|
disabled={running}
|
||||||
>
|
>
|
||||||
{strings.edit}
|
{strings.edit}
|
||||||
|
|
|
@ -30,6 +30,7 @@ export default function PageRepositories({ children, className, ...props }) {
|
||||||
running={bv.running}
|
running={bv.running}
|
||||||
repositories={bv.resources.filter(r => r.is_active)}
|
repositories={bv.resources.filter(r => r.is_active)}
|
||||||
view={pk => history.push(`/repositories/${pk}`)}
|
view={pk => history.push(`/repositories/${pk}`)}
|
||||||
|
share={pk => history.push(`/repositories/${pk}/share`)}
|
||||||
archive={archive}
|
archive={archive}
|
||||||
edit={pk => history.push(`/repositories/${pk}/edit`)}
|
edit={pk => history.push(`/repositories/${pk}/edit`)}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue