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

🔧 Improve group flow

This commit is contained in:
Steffo 2021-10-13 05:21:38 +02:00
parent 6c690312b9
commit 4e509c2721
2 changed files with 10 additions and 4 deletions

View file

@ -147,7 +147,7 @@ export function GroupCreateBox({viewSet, resource}: GroupCreateBoxProps): JSX.El
<Box> <Box>
<Details> <Details>
<Details.Summary> <Details.Summary>
{resource ? <>Edit <I>{resource.value.name}</I></> : "Create a new group"} {resource ? <>Edit <I>{resource.value.name}</I></> : "Create a new research group"}
</Details.Summary> </Details.Summary>
<Details.Content> <Details.Content>
<Form> <Form>

View file

@ -1,5 +1,8 @@
import {Box, Heading, Idiomatic, ListUnordered} from "@steffo/bluelib-react" import {faUsersCog} from "@fortawesome/free-solid-svg-icons"
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"
import {Box, Heading, Idiomatic, ListUnordered, UAnnotation} from "@steffo/bluelib-react"
import * as React from "react" import * as React from "react"
import {useAuthorizationContext} from "../../contexts/authorization"
import {useCacheContext} from "../../contexts/cache" import {useCacheContext} from "../../contexts/cache"
import {ManagedResource} from "../../hooks/useManagedViewSet" import {ManagedResource} from "../../hooks/useManagedViewSet"
import {SophonResearchGroup} from "../../types/SophonTypes" import {SophonResearchGroup} from "../../types/SophonTypes"
@ -11,6 +14,7 @@ export interface GroupMembersBoxProps {
export function GroupMembersBox({resource}: GroupMembersBoxProps): JSX.Element | null { export function GroupMembersBox({resource}: GroupMembersBoxProps): JSX.Element | null {
const authorization = useAuthorizationContext()
const cache = useCacheContext() const cache = useCacheContext()
if(!cache) { if(!cache) {
@ -29,9 +33,11 @@ export function GroupMembersBox({resource}: GroupMembersBoxProps): JSX.Element |
return null return null
} }
const username = id === authorization?.state.user?.id ? <UAnnotation>{user.value.username}</UAnnotation> : user.value.username
return ( return (
<ListUnordered.Item bluelibClassNames={index === 0 ? "color-blue" : ""} key={id}> <ListUnordered.Item bluelibClassNames={index === 0 ? "color-blue" : ""} key={id}>
{user.value.username} {username}
</ListUnordered.Item> </ListUnordered.Item>
) )
}) })
@ -39,7 +45,7 @@ export function GroupMembersBox({resource}: GroupMembersBoxProps): JSX.Element |
return ( return (
<Box> <Box>
<Heading level={3}> <Heading level={3}>
Members of <Idiomatic>{resource.value.name}</Idiomatic> <FontAwesomeIcon icon={faUsersCog}/> Members of <Idiomatic>{resource.value.name}</Idiomatic>
</Heading> </Heading>
<ListUnordered> <ListUnordered>
{users} {users}