1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 23:04:21 +00:00
sophon/frontend/src/components/ResearchGroupPanel.tsx

40 lines
1.3 KiB
TypeScript
Raw Normal View History

import * as React from "react"
2021-09-20 14:55:05 +00:00
import {Panel} from "@steffo/bluelib-react";
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
2021-09-20 14:55:05 +00:00
import {faEnvelope, faGlobe, faQuestion} from "@fortawesome/free-solid-svg-icons";
2021-09-19 21:49:16 +00:00
import {ResearchGroup} from "../types";
import {UserLink} from "./UserLink";
2021-09-19 22:59:01 +00:00
import {Link} from "./Link";
2021-09-21 14:50:34 +00:00
import {ObjectPanel} from "./ObjectPanel";
2021-09-19 21:49:16 +00:00
export function ResearchGroupPanel({owner, name, access, slug}: ResearchGroup): JSX.Element {
2021-09-19 22:59:01 +00:00
let accessIcon: JSX.Element
if(access === "OPEN") {
2021-09-19 22:59:01 +00:00
accessIcon = <FontAwesomeIcon icon={faGlobe} title={"Open"}/>
}
else if(access === "MANUAL") {
2021-09-19 22:59:01 +00:00
accessIcon = <FontAwesomeIcon icon={faEnvelope} title={"Invite-only"}/>
}
else {
2021-09-19 22:59:01 +00:00
accessIcon = <FontAwesomeIcon icon={faQuestion} title={"Unknown"}/>
}
return (
2021-09-21 14:50:34 +00:00
<ObjectPanel>
<ObjectPanel.Icon>
2021-09-19 22:59:01 +00:00
{accessIcon}
2021-09-21 14:50:34 +00:00
</ObjectPanel.Icon>
<ObjectPanel.Name>
2021-09-19 22:59:01 +00:00
<Link href={`/g/${slug}/`}>{name}</Link>
2021-09-21 14:50:34 +00:00
</ObjectPanel.Name>
<ObjectPanel.Text>
Created by <UserLink id={owner}/>
2021-09-21 14:50:34 +00:00
</ObjectPanel.Text>
<ObjectPanel.Buttons>
</ObjectPanel.Buttons>
</ObjectPanel>
)
}