From 0cdbaf6bb6b00a10b05e6ad25a74083c9c0093ac Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 12 Oct 2021 02:26:27 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A5=20Improve=20GroupResourcePanel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/group/GroupDeleteButton.tsx | 2 +- frontend/src/components/group/GroupJoinButton.tsx | 2 +- frontend/src/components/group/GroupLeaveButton.tsx | 8 ++++---- frontend/src/components/group/GroupResourcePanel.tsx | 2 +- frontend/tsconfig.json | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/group/GroupDeleteButton.tsx b/frontend/src/components/group/GroupDeleteButton.tsx index 2fb82a5..8e2aea4 100644 --- a/frontend/src/components/group/GroupDeleteButton.tsx +++ b/frontend/src/components/group/GroupDeleteButton.tsx @@ -34,7 +34,7 @@ export function GroupDeleteButton({resource}: GroupDeleteButtonProps): JSX.Eleme } return ( - +  Delete ) diff --git a/frontend/src/components/group/GroupJoinButton.tsx b/frontend/src/components/group/GroupJoinButton.tsx index 6066648..9fe29cc 100644 --- a/frontend/src/components/group/GroupJoinButton.tsx +++ b/frontend/src/components/group/GroupJoinButton.tsx @@ -15,7 +15,7 @@ export interface GroupJoinButtonProps { export function GroupJoinButton({resource}: GroupJoinButtonProps): JSX.Element | null { const authorization = useAuthorizationContext() - const trueMembers = [resource.value.owner, ...resource.value.members] + const trueMembers = [...new Set([resource.value.owner, ...resource.value.members])] const doJoin = React.useCallback( diff --git a/frontend/src/components/group/GroupLeaveButton.tsx b/frontend/src/components/group/GroupLeaveButton.tsx index e6659fb..90f68f3 100644 --- a/frontend/src/components/group/GroupLeaveButton.tsx +++ b/frontend/src/components/group/GroupLeaveButton.tsx @@ -1,10 +1,10 @@ import {faUserMinus} from "@fortawesome/free-solid-svg-icons" import {FontAwesomeIcon} from "@fortawesome/react-fontawesome" -import {Button} from "@steffo/bluelib-react" import * as React from "react" import {useAuthorizationContext} from "../../contexts/authorization" import {ManagedResource} from "../../hooks/useManagedViewSet" import {SophonResearchGroup} from "../../types/SophonTypes" +import {SafetyButton} from "../elements/SafetyButton" export interface GroupLeaveButtonProps { @@ -15,7 +15,7 @@ export interface GroupLeaveButtonProps { export function GroupLeaveButton({resource}: GroupLeaveButtonProps): JSX.Element | null { const authorization = useAuthorizationContext() - const trueMembers = [resource.value.owner, ...resource.value.members] + const trueMembers = [...new Set([resource.value.owner, ...resource.value.members])] const doLeave = React.useCallback( @@ -39,8 +39,8 @@ export function GroupLeaveButton({resource}: GroupLeaveButtonProps): JSX.Element } return ( - + ) } diff --git a/frontend/src/components/group/GroupResourcePanel.tsx b/frontend/src/components/group/GroupResourcePanel.tsx index 6c63e67..7687201 100644 --- a/frontend/src/components/group/GroupResourcePanel.tsx +++ b/frontend/src/components/group/GroupResourcePanel.tsx @@ -18,7 +18,7 @@ export interface GroupResourcePanelProps { export function GroupResourcePanel({resource}: GroupResourcePanelProps): JSX.Element { const icon = resource.value.access === "OPEN" ? faGlobe : faEnvelope - const trueMembers = [resource.value.owner, ...resource.value.members] + const trueMembers = [...new Set([resource.value.owner, ...resource.value.members])] return ( diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 27186b9..5027a9a 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "es6", "lib": [ "dom", "dom.iterable",