1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-23 07:14:21 +00:00

💥 Improve GroupResourcePanel

This commit is contained in:
Steffo 2021-10-12 02:26:27 +02:00
parent 1fe27c2002
commit 0cdbaf6bb6
Signed by: steffo
GPG key ID: 6965406171929D01
5 changed files with 8 additions and 8 deletions

View file

@ -34,7 +34,7 @@ export function GroupDeleteButton({resource}: GroupDeleteButtonProps): JSX.Eleme
} }
return ( return (
<SafetyButton timeout={5} onClick={doDelete}> <SafetyButton timeout={3} onClick={doDelete}>
<FontAwesomeIcon icon={faTrash} pulse={resource.busy}/>&nbsp;Delete <FontAwesomeIcon icon={faTrash} pulse={resource.busy}/>&nbsp;Delete
</SafetyButton> </SafetyButton>
) )

View file

@ -15,7 +15,7 @@ export interface GroupJoinButtonProps {
export function GroupJoinButton({resource}: GroupJoinButtonProps): JSX.Element | null { export function GroupJoinButton({resource}: GroupJoinButtonProps): JSX.Element | null {
const authorization = useAuthorizationContext() const authorization = useAuthorizationContext()
const trueMembers = [resource.value.owner, ...resource.value.members] const trueMembers = [...new Set([resource.value.owner, ...resource.value.members])]
const doJoin = const doJoin =
React.useCallback( React.useCallback(

View file

@ -1,10 +1,10 @@
import {faUserMinus} from "@fortawesome/free-solid-svg-icons" import {faUserMinus} from "@fortawesome/free-solid-svg-icons"
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome" import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"
import {Button} from "@steffo/bluelib-react"
import * as React from "react" import * as React from "react"
import {useAuthorizationContext} from "../../contexts/authorization" import {useAuthorizationContext} from "../../contexts/authorization"
import {ManagedResource} from "../../hooks/useManagedViewSet" import {ManagedResource} from "../../hooks/useManagedViewSet"
import {SophonResearchGroup} from "../../types/SophonTypes" import {SophonResearchGroup} from "../../types/SophonTypes"
import {SafetyButton} from "../elements/SafetyButton"
export interface GroupLeaveButtonProps { export interface GroupLeaveButtonProps {
@ -15,7 +15,7 @@ export interface GroupLeaveButtonProps {
export function GroupLeaveButton({resource}: GroupLeaveButtonProps): JSX.Element | null { export function GroupLeaveButton({resource}: GroupLeaveButtonProps): JSX.Element | null {
const authorization = useAuthorizationContext() const authorization = useAuthorizationContext()
const trueMembers = [resource.value.owner, ...resource.value.members] const trueMembers = [...new Set([resource.value.owner, ...resource.value.members])]
const doLeave = const doLeave =
React.useCallback( React.useCallback(
@ -39,8 +39,8 @@ export function GroupLeaveButton({resource}: GroupLeaveButtonProps): JSX.Element
} }
return ( return (
<Button disabled={resource.busy} onClick={doLeave} bluelibClassNames={resource.busy ? "color-yellow" : ""}> <SafetyButton timeout={3} disabled={resource.busy} onClick={doLeave} bluelibClassNames={resource.busy ? "color-yellow" : ""}>
<FontAwesomeIcon icon={faUserMinus} pulse={resource.busy}/>&nbsp;Leave <FontAwesomeIcon icon={faUserMinus} pulse={resource.busy}/>&nbsp;Leave
</Button> </SafetyButton>
) )
} }

View file

@ -18,7 +18,7 @@ export interface GroupResourcePanelProps {
export function GroupResourcePanel({resource}: GroupResourcePanelProps): JSX.Element { export function GroupResourcePanel({resource}: GroupResourcePanelProps): JSX.Element {
const icon = resource.value.access === "OPEN" ? faGlobe : faEnvelope 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 ( return (
<ResourcePanel> <ResourcePanel>

View file

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es6",
"lib": [ "lib": [
"dom", "dom",
"dom.iterable", "dom.iterable",